From: alex <bin...@li...> - 2001-08-22 18:22:55
|
alex Wed Aug 22 11:22:49 2001 EDT Modified files: /r2/binarycloud/user/conf datasources.php /r2/binarycloud/user/mod/query_example QueryExample.php Log: Working QM & QueryExample module Index: r2/binarycloud/user/conf/datasources.php diff -u r2/binarycloud/user/conf/datasources.php:1.4 r2/binarycloud/user/conf/datasources.php:1.5 --- r2/binarycloud/user/conf/datasources.php:1.4 Mon Aug 20 13:00:14 2001 +++ r2/binarycloud/user/conf/datasources.php Wed Aug 22 11:22:49 2001 @@ -1,10 +1,10 @@ <?php // {{{ Header /* - * -File $Id: datasources.php,v 1.4 2001/08/20 20:00:14 alex Exp $ - * -License LGPL (http://www.gnu.org/copyleft/lesser.html) + * -File $Id: datasources.php,v 1.5 2001/08/22 18:22:49 alex Exp $ + * -License LGPL (http://www.gnu.org/copyleft/lesser.html) * -Copyright 2001, The Turing Studio, Inc. - * -Author alex black, en...@tu... * + * -Author alex black, en...@tu... */ // }}} // {{{ Datasources @@ -12,44 +12,35 @@ global $QueryManager; $QueryManager->datasources = array( +// uncomment if you use oci 'query_example' => array( 'database_name' => 'test', - 'Type' => "mysql", - 'Host' => "localhost", // replace - 'User' => "root", // with your - 'Password' => "sql", // setup + 'Type' => "oci", + 'User' => "r2", + 'Password' => "testpasswd", 'IncludePath' => BC_PATH."/ext/metabase", 'Persistent' => true, - ), - 'oracle_dev' => array( - 'database_name' => "binarycloud_db", - 'Type' => "oci", - 'User' => "your_user", - 'Password' => "your_password", - 'IncludePath' => BC_PATH_BASE."db/", - 'Persistent' => TRUE, 'Options' => array( - 'SID' => "sidv", + 'SID' => "DBTRNG", 'HOME' => "/u01/oracle/product/8.1.6", - 'DBAUser' => "system", - 'DBAPassword' => "sys_passwd", - 'mcryptkey' => "Kay string. Can be a file.", - 'mcryptmode' => MCRYPT_MODE_CFB, - 'mcryptcipher' => MCRYPT_TripleDES, - 'mcryptiv' => "qwertyui" + 'DBAUser' => "System", + 'DBAPassword' => "Systhma", ), ), - 'mysql_base' => array( - 'database_name' => 'binarycloud', +// uncomment if you use mysql +/* + 'query_example' => array( + 'database_name' => 'test', 'Type' => "mysql", - 'Host' => "localhost", - 'User' => "example_user", - 'Password' => "example_password", - 'IncludePath' => BC_PATH_BASE."db/", - 'Persistent' => TRUE + 'Host' => "localhost", // replace + 'User' => "root", // with your + 'Password' => "sql", // setup + 'IncludePath' => BC_PATH."/ext/metabase", + 'Persistent' => true, ), +*/ ); // }}} -?> \ No newline at end of file +?> Index: r2/binarycloud/user/mod/query_example/QueryExample.php diff -u r2/binarycloud/user/mod/query_example/QueryExample.php:1.2 r2/binarycloud/user/mod/query_example/QueryExample.php:1.3 --- r2/binarycloud/user/mod/query_example/QueryExample.php:1.2 Tue Aug 21 19:02:43 2001 +++ r2/binarycloud/user/mod/query_example/QueryExample.php Wed Aug 22 11:22:49 2001 @@ -1,7 +1,7 @@ <?php // Header {{{ /* - * -File $Id: QueryExample.php,v 1.2 2001/08/22 02:02:43 alex Exp $ + * -File $Id: QueryExample.php,v 1.3 2001/08/22 18:22:49 alex Exp $ * -License LGPL (http://www.gnu.org/copyleft/lesser.html) * -Copyright 2001, Entity * -Author Andreas Aderhold, a.a...@th... @@ -29,7 +29,7 @@ // doing a simple custom SELECT query $query = array( - 'QUERY' => 'SELECT newsid, news FROM news', + 'QUERY' => 'SELECT NEWSID, NEWS FROM NEWS', 'ARGTYPES' => array('integer','text'), ); $this->result = $QueryManager->DoCustomQuery($query, null, true); @@ -46,21 +46,24 @@ */ function Output() { - echo "<table>"; - echo "<th>NewsId</th>"; - echo "<th>News</th>"; - for ($row = 0; $row < count($this->result); $row++) { - printf("<tr valign=\"top\"><td>%s</td><td>%s</td></tr>", - $this->result[$row]['newsId'], - $this->result[$row]['news'] - ); - } - echo "</table>"; +?> +<table> +<th>News ID</th> +<th>News</th> +<? for ($row = 0; $row < count($this->result); $row++) { ?> +<tr valign="top"> +<td><? echo $this->result[$row]['NEWSID']; ?></td> +<td><? echo $this->result[$row]['NEWS']; ?></td> +</tr> +<? } ?> +</table> +<? } // }}} // {{{ Vars var $params; + var $result; // }}} } // }}} |