ssb Sun Feb 18 16:50:32 2001 EDT Added files: /php4/pear/DB/tests fetchrow.inc /php4/pear/DB/tests/mysql README /php4/pear/DB/tests/pgsql README Modified files: /php4/pear/DB/tests fetchmodes.inc /php4/pear/DB/tests/ibase .cvsignore 002.phpt connect.inc mktable.inc skipif.inc /php4/pear/DB/tests/mysql 002.phpt mktable.inc /php4/pear/DB/tests/odbc 002.phpt mktable.inc /php4/pear/DB/tests/pgsql 002.phpt connect.inc mktable.inc Log: * added "fetchRow returns NULL at end of resultset" tests
Index: php4/pear/DB/tests/fetchmodes.inc diff -u php4/pear/DB/tests/fetchmodes.inc:1.3 php4/pear/DB/tests/fetchmodes.inc:1.4 --- php4/pear/DB/tests/fetchmodes.inc:1.3 Wed Dec 13 06:41:04 2000 +++ php4/pear/DB/tests/fetchmodes.inc Sun Feb 18 16:50:30 2001 @@ -2,63 +2,63 @@ $dbh->setErrorHandling(PEAR_ERROR_DIE); -print "testing fetchrow default default\n"; +print "testing fetchmodes: fetchrow default default\n"; $sth = $dbh->query("SELECT * FROM phptest"); $row = $sth->fetchRow(); print implode(" ", array_keys($row))."\n"; -print "testing fetchinto default default\n"; +print "testing fetchmodes: fetchinto default default\n"; $sth = $dbh->query("SELECT * FROM phptest"); $row = array(); $sth->fetchInto($row); print implode(" ", array_keys($row))."\n"; -print "testing fetchrow ordered default\n"; +print "testing fetchmodes: fetchrow ordered default\n"; $dbh->setFetchMode(DB_FETCHMODE_ORDERED); $sth = $dbh->query("SELECT * FROM phptest"); $row = $sth->fetchRow(); print implode(" ", array_keys($row))."\n"; -print "testing fetchrow assoc default\n"; +print "testing fetchmodes: fetchrow assoc default\n"; $dbh->setFetchMode(DB_FETCHMODE_ASSOC); $sth = $dbh->query("SELECT * FROM phptest"); $row = $sth->fetchRow(); print implode(" ", array_keys($row))."\n"; -print "testing fetchrow ordered default with assoc specified\n"; +print "testing fetchmodes: fetchrow ordered default with assoc specified\n"; $dbh->setFetchMode(DB_FETCHMODE_ORDERED); $sth = $dbh->query("SELECT * FROM phptest"); $row = $sth->fetchRow(DB_FETCHMODE_ASSOC); print implode(" ", array_keys($row))."\n"; -print "testing fetchrow assoc default with ordered specified\n"; +print "testing fetchmodes: fetchrow assoc default with ordered specified\n"; $dbh->setFetchMode(DB_FETCHMODE_ASSOC); $sth = $dbh->query("SELECT * FROM phptest"); $row = $sth->fetchRow(DB_FETCHMODE_ORDERED); print implode(" ", array_keys($row))."\n"; -print "testing fetchinto ordered default\n"; +print "testing fetchmodes: fetchinto ordered default\n"; $dbh->setFetchMode(DB_FETCHMODE_ORDERED); $sth = $dbh->query("SELECT * FROM phptest"); $row = array(); $sth->fetchInto($row); print implode(" ", array_keys($row))."\n"; -print "testing fetchinto assoc default\n"; +print "testing fetchmodes: fetchinto assoc default\n"; $dbh->setFetchMode(DB_FETCHMODE_ASSOC); $sth = $dbh->query("SELECT * FROM phptest"); $row = array(); $sth->fetchInto($row); print implode(" ", array_keys($row))."\n"; -print "testing fetchinto ordered default with assoc specified\n"; +print "testing fetchmodes: fetchinto ordered default with assoc specified\n"; $dbh->setFetchMode(DB_FETCHMODE_ORDERED); $sth = $dbh->query("SELECT * FROM phptest"); $row = array(); $sth->fetchInto($row, DB_FETCHMODE_ASSOC); print implode(" ", array_keys($row))."\n"; -print "testing fetchinto assoc default with ordered specified\n"; +print "testing fetchmodes: fetchinto assoc default with ordered specified\n"; $dbh->setFetchMode(DB_FETCHMODE_ASSOC); $sth = $dbh->query("SELECT * FROM phptest"); $row = array(); Index: php4/pear/DB/tests/ibase/.cvsignore diff -u php4/pear/DB/tests/ibase/.cvsignore:1.1 php4/pear/DB/tests/ibase/.cvsignore:1.2 --- php4/pear/DB/tests/ibase/.cvsignore:1.1 Sat Jan 13 16:30:02 2001 +++ php4/pear/DB/tests/ibase/.cvsignore Sun Feb 18 16:50:30 2001 @@ -2,3 +2,4 @@ *.out *.php phpt.* +test.gdb Index: php4/pear/DB/tests/ibase/002.phpt diff -u php4/pear/DB/tests/ibase/002.phpt:1.1 php4/pear/DB/tests/ibase/002.phpt:1.2 --- php4/pear/DB/tests/ibase/002.phpt:1.1 Sat Jan 13 16:30:02 2001 +++ php4/pear/DB/tests/ibase/002.phpt Sun Feb 18 16:50:30 2001 @@ -1,31 +1,38 @@ --TEST-- -DB_ibase fetch modes test +DB_ibase fetch test --SKIPIF-- <?php include("skipif.inc"); ?> --FILE-- <?php require_once "DB.php"; include("mktable.inc"); +include("../fetchrow.inc"); include("../fetchmodes.inc"); ?> --EXPECT-- -testing fetchrow default default +testing fetchrow: +row 1: 42, bing, This is a test, 1999-11-21 +row 2: 1, one, One, 2001-02-16 +row 3: 2, two, Two, 2001-02-15 +row 4: 3, three, Three, 2001-02-14 +row 5: NULL +testing fetchmodes: fetchrow default default 0 1 2 3 -testing fetchinto default default +testing fetchmodes: fetchinto default default 0 1 2 3 -testing fetchrow ordered default +testing fetchmodes: fetchrow ordered default 0 1 2 3 -testing fetchrow assoc default +testing fetchmodes: fetchrow assoc default a b c d -testing fetchrow ordered default with assoc specified +testing fetchmodes: fetchrow ordered default with assoc specified a b c d -testing fetchrow assoc default with ordered specified +testing fetchmodes: fetchrow assoc default with ordered specified 0 1 2 3 -testing fetchinto ordered default +testing fetchmodes: fetchinto ordered default 0 1 2 3 -testing fetchinto assoc default +testing fetchmodes: fetchinto assoc default a b c d -testing fetchinto ordered default with assoc specified +testing fetchmodes: fetchinto ordered default with assoc specified a b c d -testing fetchinto assoc default with ordered specified +testing fetchmodes: fetchinto assoc default with ordered specified 0 1 2 3 Index: php4/pear/DB/tests/ibase/connect.inc diff -u php4/pear/DB/tests/ibase/connect.inc:1.1 php4/pear/DB/tests/ibase/connect.inc:1.2 --- php4/pear/DB/tests/ibase/connect.inc:1.1 Sat Jan 13 16:30:02 2001 +++ php4/pear/DB/tests/ibase/connect.inc Sun Feb 18 16:50:30 2001 @@ -1,4 +1,4 @@ <?php require_once "DB.php"; -$dbh = DB::connect("ibase://localhost/test"); +$dbh = DB::connect("ibase://localhost/test.gdb"); ?> Index: php4/pear/DB/tests/ibase/mktable.inc diff -u php4/pear/DB/tests/ibase/mktable.inc:1.1 php4/pear/DB/tests/ibase/mktable.inc:1.2 --- php4/pear/DB/tests/ibase/mktable.inc:1.1 Sat Jan 13 16:30:02 2001 +++ php4/pear/DB/tests/ibase/mktable.inc Sun Feb 18 16:50:30 2001 @@ -1,6 +1,6 @@ <?php -require "connect.inc"; +require_once "connect.inc"; $dbh->setErrorHandling(PEAR_ERROR_RETURN); $dbh->query("DROP TABLE phptest"); Index: php4/pear/DB/tests/ibase/skipif.inc diff -u php4/pear/DB/tests/ibase/skipif.inc:1.1 php4/pear/DB/tests/ibase/skipif.inc:1.2 --- php4/pear/DB/tests/ibase/skipif.inc:1.1 Sat Jan 13 16:30:02 2001 +++ php4/pear/DB/tests/ibase/skipif.inc Sun Feb 18 16:50:30 2001 @@ -10,7 +10,7 @@ if (!extension_loaded("interbase")) { die("skip\n"); } -$conn = @ibase_connect("test"); +$conn = @ibase_connect("test.gdb"); if (!is_resource($conn)) { die("skip\n"); } Index: php4/pear/DB/tests/mysql/002.phpt diff -u php4/pear/DB/tests/mysql/002.phpt:1.4 php4/pear/DB/tests/mysql/002.phpt:1.5 --- php4/pear/DB/tests/mysql/002.phpt:1.4 Wed Dec 13 06:41:04 2000 +++ php4/pear/DB/tests/mysql/002.phpt Sun Feb 18 16:50:30 2001 @@ -1,31 +1,38 @@ --TEST-- -DB_mysql fetch modes test +DB_mysql fetch test --SKIPIF-- <?php include("skipif.inc"); ?> --FILE-- <?php require_once "DB.php"; include("mktable.inc"); +include("../fetchrow.inc"); include("../fetchmodes.inc"); ?> --EXPECT-- -testing fetchrow default default +testing fetchrow: +row 1: 42, bing, This is a test, 1999-11-21 +row 2: 1, one, One, 2001-02-16 +row 3: 2, two, Two, 2001-02-15 +row 4: 3, three, Three, 2001-02-14 +row 5: NULL +testing fetchmodes: fetchrow default default 0 1 2 3 -testing fetchinto default default +testing fetchmodes: fetchinto default default 0 1 2 3 -testing fetchrow ordered default +testing fetchmodes: fetchrow ordered default 0 1 2 3 -testing fetchrow assoc default +testing fetchmodes: fetchrow assoc default a b c d -testing fetchrow ordered default with assoc specified +testing fetchmodes: fetchrow ordered default with assoc specified a b c d -testing fetchrow assoc default with ordered specified +testing fetchmodes: fetchrow assoc default with ordered specified 0 1 2 3 -testing fetchinto ordered default +testing fetchmodes: fetchinto ordered default 0 1 2 3 -testing fetchinto assoc default +testing fetchmodes: fetchinto assoc default a b c d -testing fetchinto ordered default with assoc specified +testing fetchmodes: fetchinto ordered default with assoc specified a b c d -testing fetchinto assoc default with ordered specified +testing fetchmodes: fetchinto assoc default with ordered specified 0 1 2 3 Index: php4/pear/DB/tests/mysql/mktable.inc diff -u php4/pear/DB/tests/mysql/mktable.inc:1.2 php4/pear/DB/tests/mysql/mktable.inc:1.3 --- php4/pear/DB/tests/mysql/mktable.inc:1.2 Wed Dec 13 06:41:04 2000 +++ php4/pear/DB/tests/mysql/mktable.inc Sun Feb 18 16:50:30 2001 @@ -1,6 +1,6 @@ <?php -require "connect.inc"; +require_once "connect.inc"; $dbh->setErrorHandling(PEAR_ERROR_RETURN); $dbh->query("DROP TABLE phptest"); Index: php4/pear/DB/tests/odbc/002.phpt diff -u php4/pear/DB/tests/odbc/002.phpt:1.1 php4/pear/DB/tests/odbc/002.phpt:1.2 --- php4/pear/DB/tests/odbc/002.phpt:1.1 Sun Jan 14 17:10:14 2001 +++ php4/pear/DB/tests/odbc/002.phpt Sun Feb 18 16:50:30 2001 @@ -1,31 +1,38 @@ --TEST-- -DB_odbc fetch modes test +DB_odbc fetch test --SKIPIF-- <?php include("skipif.inc"); ?> --FILE-- <?php require_once "DB.php"; include("mktable.inc"); +include("../fetchrow.inc"); include("../fetchmodes.inc"); ?> --EXPECT-- -testing fetchrow default default +testing fetchrow: +row 1: 42, bing, This is a test, 1999-11-21 +row 2: 1, one, One, 2001-02-16 +row 3: 2, two, Two, 2001-02-15 +row 4: 3, three, Three, 2001-02-14 +row 5: NULL +testing fetchmodes: fetchrow default default 0 1 2 3 -testing fetchinto default default +testing fetchmodes: fetchinto default default 0 1 2 3 -testing fetchrow ordered default +testing fetchmodes: fetchrow ordered default 0 1 2 3 -testing fetchrow assoc default +testing fetchmodes: fetchrow assoc default a b c d -testing fetchrow ordered default with assoc specified +testing fetchmodes: fetchrow ordered default with assoc specified a b c d -testing fetchrow assoc default with ordered specified +testing fetchmodes: fetchrow assoc default with ordered specified 0 1 2 3 -testing fetchinto ordered default +testing fetchmodes: fetchinto ordered default 0 1 2 3 -testing fetchinto assoc default +testing fetchmodes: fetchinto assoc default a b c d -testing fetchinto ordered default with assoc specified +testing fetchmodes: fetchinto ordered default with assoc specified a b c d -testing fetchinto assoc default with ordered specified +testing fetchmodes: fetchinto assoc default with ordered specified 0 1 2 3 Index: php4/pear/DB/tests/odbc/mktable.inc diff -u php4/pear/DB/tests/odbc/mktable.inc:1.1 php4/pear/DB/tests/odbc/mktable.inc:1.2 --- php4/pear/DB/tests/odbc/mktable.inc:1.1 Sun Jan 14 17:10:14 2001 +++ php4/pear/DB/tests/odbc/mktable.inc Sun Feb 18 16:50:30 2001 @@ -1,6 +1,6 @@ <?php -require "connect.inc"; +require_once "connect.inc"; $dbh->setErrorHandling(PEAR_ERROR_RETURN); $dbh->query("DROP TABLE phptest"); Index: php4/pear/DB/tests/pgsql/002.phpt diff -u php4/pear/DB/tests/pgsql/002.phpt:1.2 php4/pear/DB/tests/pgsql/002.phpt:1.3 --- php4/pear/DB/tests/pgsql/002.phpt:1.2 Wed Dec 13 06:41:04 2000 +++ php4/pear/DB/tests/pgsql/002.phpt Sun Feb 18 16:50:31 2001 @@ -1,31 +1,38 @@ --TEST-- -DB_pgsql fetch modes test +DB_pgsql fetch test --SKIPIF-- <?php include("skipif.inc"); ?> --FILE-- <?php require_once "DB.php"; include("mktable.inc"); +include("../fetchrow.inc"); include("../fetchmodes.inc"); ?> --EXPECT-- -testing fetchrow default default +testing fetchrow: +row 1: 42, bing, This is a test, 11-21-1999 +row 2: 1, one, One, 02-16-2001 +row 3: 2, two, Two, 02-15-2001 +row 4: 3, three, Three, 02-14-2001 +row 5: NULL +testing fetchmodes: fetchrow default default 0 1 2 3 -testing fetchinto default default +testing fetchmodes: fetchinto default default 0 1 2 3 -testing fetchrow ordered default +testing fetchmodes: fetchrow ordered default 0 1 2 3 -testing fetchrow assoc default +testing fetchmodes: fetchrow assoc default a b c d -testing fetchrow ordered default with assoc specified +testing fetchmodes: fetchrow ordered default with assoc specified a b c d -testing fetchrow assoc default with ordered specified +testing fetchmodes: fetchrow assoc default with ordered specified 0 1 2 3 -testing fetchinto ordered default +testing fetchmodes: fetchinto ordered default 0 1 2 3 -testing fetchinto assoc default +testing fetchmodes: fetchinto assoc default a b c d -testing fetchinto ordered default with assoc specified +testing fetchmodes: fetchinto ordered default with assoc specified a b c d -testing fetchinto assoc default with ordered specified +testing fetchmodes: fetchinto assoc default with ordered specified 0 1 2 3 Index: php4/pear/DB/tests/pgsql/connect.inc diff -u php4/pear/DB/tests/pgsql/connect.inc:1.1 php4/pear/DB/tests/pgsql/connect.inc:1.2 --- php4/pear/DB/tests/pgsql/connect.inc:1.1 Wed Dec 13 06:41:04 2000 +++ php4/pear/DB/tests/pgsql/connect.inc Sun Feb 18 16:50:31 2001 @@ -1,4 +1,4 @@ <?php require_once "DB.php"; -$dbh = DB::connect("pgsql://localhost/test"); +$dbh = DB::connect("pgsql://unix+localhost/test"); ?> Index: php4/pear/DB/tests/pgsql/mktable.inc diff -u php4/pear/DB/tests/pgsql/mktable.inc:1.2 php4/pear/DB/tests/pgsql/mktable.inc:1.3 --- php4/pear/DB/tests/pgsql/mktable.inc:1.2 Wed Dec 13 06:41:04 2000 +++ php4/pear/DB/tests/pgsql/mktable.inc Sun Feb 18 16:50:31 2001 @@ -1,6 +1,6 @@ <?php -require "connect.inc"; +require_once "connect.inc"; $dbh->setErrorHandling(PEAR_ERROR_RETURN); $dbh->query("DROP TABLE phptest"); Index: php4/pear/DB/tests/fetchrow.inc +++ php4/pear/DB/tests/fetchrow.inc <?php $dbh->setErrorHandling(PEAR_ERROR_DIE); $dbh->query("INSERT INTO phptest VALUES(1, 'one', 'One', '2001-02-16')"); $dbh->query("INSERT INTO phptest VALUES(2, 'two', 'Two', '2001-02-15')"); $dbh->query("INSERT INTO phptest VALUES(3, 'three', 'Three', '2001-02-14')"); print "testing fetchrow:\n"; $sth = $dbh->query("SELECT * FROM phptest"); for ($i = 1; $i <= 5; $i++) { print "row $i: "; $row = $sth->fetchRow(); if (is_array($row)) { print implode(", ", $row) . "\n"; } else { var_dump($row); } } $dbh->query("DELETE FROM phptest WHERE a <> 42"); ?>
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]