cvs: pear /DB/tests/driver 16tableinfo.phpt
| From: | Daniel Convissor | Date: | Thu, 29 Apr 2004 20:39:16 +0000 |
| Subject: | cvs: pear /DB/tests/driver 16tableinfo.phpt | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-18982@lists.php.net to get a copy of this message | ||
danielc Thu Apr 29 16:39:16 2004 EDT
Modified files:
/pear/DB/tests/driver 16tableinfo.phpt
Log:
Run query each time because mysqli_fetch_field() only goes through results once.
http://cvs.php.net/diff.php/pear/DB/tests/driver/16tableinfo.phpt?r1=1.21&r2=1.22&ty=u
Index: pear/DB/tests/driver/16tableinfo.phpt
diff -u pear/DB/tests/driver/16tableinfo.phpt:1.21 pear/DB/tests/driver/16tableinfo.phpt:1.22
--- pear/DB/tests/driver/16tableinfo.phpt:1.21 Wed Mar 24 23:28:27 2004
+++ pear/DB/tests/driver/16tableinfo.phpt Thu Apr 29 16:39:16 2004
@@ -37,7 +37,7 @@
* @see DB_common::tableInfo()
*
* @package DB
- * @version $Id: 16tableinfo.phpt,v 1.21 2004/03/25 04:28:27 danielc Exp $
+ * @version $Id: 16tableinfo.phpt,v 1.22 2004/04/29 20:39:16 danielc Exp $
* @category Database
* @author Daniel Convissor <danielc@analysisandsolutions.com>
* @internal
@@ -54,7 +54,7 @@
--FILE--
<?php
-// $Id: 16tableinfo.phpt,v 1.21 2004/03/25 04:28:27 danielc Exp $
+// $Id: 16tableinfo.phpt,v 1.22 2004/04/29 20:39:16 danielc Exp $
/**
* Connect to the database and make the phptest table.
@@ -564,18 +564,21 @@
$dbh->query("INSERT INTO phptest_fk VALUES (20, 2, 'Two', '2001-02-15',
'c2', 2.2)");
$dbh->query("INSERT INTO phptest_fk VALUES (30, 3, 'Three',
'2001-02-14', 'c3', 3.3)");
-
-$resultobj =& $dbh->query('SELECT phptest_fk.a, phptest_fk.fk,
- phptest_fk.c, phptest_fk.d, phptest_fk.e, phptest_fk.f,
- phptest.a, phptest.b, phptest.c, phptest.d
- FROM phptest_fk, phptest WHERE phptest.a = phptest_fk.fk');
-
+function &runQuery() {
+ global $dbh, $resultobj;
+ $resultobj =& $dbh->query('SELECT phptest_fk.a, phptest_fk.fk,
+ phptest_fk.c, phptest_fk.d, phptest_fk.e, phptest_fk.f,
+ phptest.a, phptest.b, phptest.c, phptest.d
+ FROM phptest_fk, phptest WHERE phptest.a = phptest_fk.fk');
+ return $resultobj;
+}
print "\n==========================================\n";
print "Passing result OBJECT to method in DB_<type>.\n";
print "Output = default.\n";
print "------------------------------------------\n";
+$resultobj =& runQuery();
$array = $dbh->tableInfo($resultobj);
print "\nfirst field:\n";
@@ -590,6 +593,7 @@
print "Passing result ID to method in DB_<type>.\n";
print "Output = DB_TABLEINFO_ORDER.\n";
print "------------------------------------------\n";
+$resultobj =& runQuery();
$array = $dbh->tableInfo($resultobj->result, DB_TABLEINFO_ORDER);
print "\nfirst field:\n";
@@ -615,6 +619,7 @@
print "Passing DB_TABLEINFO_ORDERTABLE to method in DB_result.\n";
print "Output = DB_TABLEINFO_ORDERTABLE.\n";
print "------------------------------------------\n";
+$resultobj =& runQuery();
$array = $resultobj->tableInfo(DB_TABLEINFO_ORDERTABLE);
// Free this to keep interbase happy.
$resultobj->free();