cvs: php4 /pear/DB/tests/driver 01connect.phpt 02fetch.phpt 03simplequery.phpt 04numcols.phpt 05sequences.phpt 06prepexec.phpt 08affectedrows.phpt
09numrows.phpt 10errormap.phpt 13limit.phpt 14fetchmode_object.phpt README connect.inc mktable.inc setup.inc skipif.inc
| From: | Thomas V.V.Cox | Date: | Sun, 06 Jan 2002 05:10:48 +0000 |
| Subject: | cvs: php4 /pear/DB/tests/driver 01connect.phpt 02fetch.phpt 03simplequery.phpt 04numcols.phpt 05sequences.phpt 06prepexec.phpt 08affectedrows.phpt 09numrows.phpt 10errormap.phpt 13limit.phpt 14fetchmode_object.phpt README connect.inc mktable.inc setup.inc skipif.inc |
||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-1846@lists.php.net to get a copy of this message | ||
cox Sun Jan 6 00:10:48 2002 EDT
Added files:
/php4/pear/DB/tests/driver 01connect.phpt 02fetch.phpt
03simplequery.phpt 04numcols.phpt
05sequences.phpt 06prepexec.phpt
08affectedrows.phpt 09numrows.phpt
10errormap.phpt 13limit.phpt
14fetchmode_object.phpt README
connect.inc mktable.inc setup.inc
skipif.inc
Log:
Multi-Driver portability test
Index: php4/pear/DB/tests/driver/01connect.phpt +++ php4/pear/DB/tests/driver/01connect.phpt --TEST-- DB_driver::connect test --SKIPIF-- <?php require "skipif.inc"; ?> --FILE-- <?php require "connect.inc"; if (is_object($dbh)) { print "\$dbh is an object\n"; } if (is_resource($dbh->connection)) { print "\$dbh is connected\n"; } ?> --EXPECT-- $dbh is an object $dbh is connected Index: php4/pear/DB/tests/driver/02fetch.phpt +++ php4/pear/DB/tests/driver/02fetch.phpt --TEST-- DB_driver::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: 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 fetchmodes: fetchinto default default 0 1 2 3 testing fetchmodes: fetchrow ordered default 0 1 2 3 testing fetchmodes: fetchrow assoc default a b c d testing fetchmodes: fetchrow ordered default with assoc specified a b c d testing fetchmodes: fetchrow assoc default with ordered specified 0 1 2 3 testing fetchmodes: fetchinto ordered default 0 1 2 3 testing fetchmodes: fetchinto assoc default a b c d testing fetchmodes: fetchinto ordered default with assoc specified a b c d testing fetchmodes: fetchinto assoc default with ordered specified 0 1 2 3 Index: php4/pear/DB/tests/driver/03simplequery.phpt +++ php4/pear/DB/tests/driver/03simplequery.phpt --TEST-- DB_driver::simpleQuery test --SKIPIF-- <?php include("skipif.inc"); ?> --FILE-- <?php require_once "DB.php"; include("mktable.inc"); include("../simplequery.inc"); ?> --EXPECT-- resource Index: php4/pear/DB/tests/driver/04numcols.phpt +++ php4/pear/DB/tests/driver/04numcols.phpt --TEST-- DB_driver::numCols test --SKIPIF-- <?php include("skipif.inc"); ?> --FILE-- <?php require_once "DB.php"; include("mktable.inc"); include("../numcols.inc"); ?> --EXPECT-- 1 2 3 4 Index: php4/pear/DB/tests/driver/05sequences.phpt +++ php4/pear/DB/tests/driver/05sequences.phpt --TEST-- DB_driver::sequences --SKIPIF-- <?php require "skipif.inc"; ?> --FILE-- <?php require "connect.inc"; require "../sequences.inc"; ?> --EXPECT-- DB Error: no such table a=1 b=2 b-a=1 c=1 d=1 Index: php4/pear/DB/tests/driver/06prepexec.phpt +++ php4/pear/DB/tests/driver/06prepexec.phpt --TEST-- DB_driver::prepare/execute test --SKIPIF-- <?php include("skipif.inc"); ?> --FILE-- <?php require_once "DB.php"; include("mktable.inc"); include("../prepexe.inc"); ?> --EXPECT-- sth1,sth2,sth3 created sth1 executed sth2 executed sth3 executed results: 72 - - - 72 - bing - - 72 - gazonk - opaque placeholder test - Index: php4/pear/DB/tests/driver/08affectedrows.phpt +++ php4/pear/DB/tests/driver/08affectedrows.phpt --TEST-- DB_driver::affectedRows test --SKIPIF-- <?php include("skipif.inc"); ?> --FILE-- <?php require_once "DB.php"; include("mktable.inc"); // Clean table $dbh->query("DELETE FROM phptest"); // Affected rows by INSERT statement $dbh->query("INSERT INTO phptest (a,b) VALUES(1, 'test')"); $dbh->query("INSERT INTO phptest (a,b) VALUES(2, 'test')"); printf("%d after insert\n", $dbh->affectedRows()); // Affected rows by SELECT statement $dbh->query("SELECT * FROM phptest"); printf("%d after select\n", $dbh->affectedRows()); $dbh->query("DELETE FROM phptest WHERE b = 'test'"); printf("%d after delete\n", $dbh->affectedRows()); // Affected rows by DELETE statement $dbh->query("INSERT INTO phptest (a,b) VALUES(1, 'test')"); $dbh->query("INSERT INTO phptest (a,b) VALUES(2, 'test')"); $dbh->setOption("optimize", "portability"); $dbh->query("DELETE FROM phptest"); printf("%d after delete all (optimize=%s)\n", $dbh->affectedRows(), $dbh->getOption("optimize")); ?> --EXPECT-- 1 after insert 0 after select 2 after delete 2 after delete all (optimize=portability) Index: php4/pear/DB/tests/driver/09numrows.phpt +++ php4/pear/DB/tests/driver/09numrows.phpt --TEST-- DB_driver::numRows test --SKIPIF-- <?php require "skipif.inc"; ?> --FILE-- <?php require "connect.inc"; require "mktable.inc"; require "../numrows.inc"; ?> --EXPECT-- 1 2 3 4 5 6 2 0 Index: php4/pear/DB/tests/driver/10errormap.phpt +++ php4/pear/DB/tests/driver/10errormap.phpt --TEST-- DB_driver::error mapping --SKIPIF-- <?php require "skipif.inc"; ?> --FILE-- <?php require "connect.inc"; require "mktable.inc"; require "../errors.inc"; ?> --EXPECT-- Trying to provoke DB_ERROR_NOSUCHTABLE DB Error: no such table Trying to provoke DB_ERROR_ALREADY_EXISTS DB Error: already exists Trying to provoke DB_ERROR_NOSUCHTABLE DB Error: no such table Trying to provoke DB_ERROR_CONSTRAINT DB Error: constraint violation Trying to provoke DB_ERROR_DIVZERO DB Error: division by zero Trying to provoke DB_ERROR_INVALID_NUMBER DB Error: invalid number Trying to provoke DB_ERROR_NOSUCHFIELD DB Error: no such field Trying to provoke DB_ERROR_SYNTAX DB Error: syntax error Index: php4/pear/DB/tests/driver/13limit.phpt +++ php4/pear/DB/tests/driver/13limit.phpt --TEST-- DB_driver::row limit --SKIPIF-- <?php require "skipif.inc"; ?> --FILE-- <?php require 'connect.inc'; include '../limit.inc'; ?> --EXPECT-- ======= From: 0 || Number of rows to fetch: 10 ======= 1.- result 0 2.- result 1 3.- result 2 4.- result 3 5.- result 4 6.- result 5 7.- result 6 8.- result 7 9.- result 8 10.- result 9 ======= From: 10 || Number of rows to fetch: 10 ======= 11.- result 10 12.- result 11 13.- result 12 14.- result 13 15.- result 14 16.- result 15 17.- result 16 18.- result 17 19.- result 18 20.- result 19 ======= From: 20 || Number of rows to fetch: 10 ======= 21.- result 20 22.- result 21 23.- result 22 24.- result 23 25.- result 24 26.- result 25 27.- result 26 28.- result 27 29.- result 28 30.- result 29 ======= From: 30 || Number of rows to fetch: 10 ======= 31.- result 30 32.- result 31 33.- result 32 Index: php4/pear/DB/tests/driver/14fetchmode_object.phpt +++ php4/pear/DB/tests/driver/14fetchmode_object.phpt --TEST-- DB_driver::fetchmode object --SKIPIF-- <?php require "skipif.inc"; ?> --FILE-- <?php require './connect.inc'; include '../fetchmode_object.inc'; ?> --EXPECT-- --- fetch with param DB_FETCHMODE_OBJECT --- stdClass -> a b c d stdClass -> a b c d --- fetch with default fetchmode DB_FETCHMODE_OBJECT --- stdClass -> a b c d stdClass -> a b c d --- fetch with default fetchmode DB_FETCHMODE_OBJECT and class DB_Row --- db_row -> a b c d db_row -> a b c d Index: php4/pear/DB/tests/driver/connect.inc +++ php4/pear/DB/tests/driver/connect.inc <?php require './setup.inc'; error_reporting(E_ALL); require_once "DB.php"; $dbh = DB::connect(DRIVER_DSN, array('optimize' => 'portability')); if (DB::isError($dbh)) { die("connect.inc: ".$dbh->toString()); } function debug_die($o){ die($o->toString()); } ?> Index: php4/pear/DB/tests/driver/mktable.inc +++ php4/pear/DB/tests/driver/mktable.inc <?php require_once "./connect.inc"; $dbh->setErrorHandling(PEAR_ERROR_RETURN); $dbh->query("DROP TABLE phptest"); //$dbh->setErrorHandling(PEAR_ERROR_TRIGGER); $dbh->setErrorHandling(PEAR_ERROR_CALLBACK, 'debug_die'); $test_mktable_query = "CREATE TABLE phptest (a INTEGER, b VARCHAR(40), c VARCHAR(255), d VARCHAR(20))"; $dbh->query($test_mktable_query); $dbh->query("INSERT INTO phptest VALUES(42, 'bing', 'This is a test', '1999-11-21')"); $dbh->setErrorHandling(PEAR_ERROR_RETURN); ?> Index: php4/pear/DB/tests/driver/setup.inc +++ php4/pear/DB/tests/driver/setup.inc <?php define('DRIVER_DSN', ''); //define('DRIVER_DSN', 'pgsql://postgres@localhost/test'); //define('DRIVER_DSN', 'pgsql://root@localhost/test'); //define('DRIVER_DSN', 'oci8://system:manager@'); ?> Index: php4/pear/DB/tests/driver/skipif.inc +++ php4/pear/DB/tests/driver/skipif.inc <?php // This script prints "skip" unless: // * the mysql extension is built-in or loadable, AND // * there is a database called "test" accessible // with no username/password, AND // * we have create/drop privileges on the entire "test" // database include './setup.inc'; require_once 'DB.php'; if (!defined('DRIVER_DSN') || DRIVER_DSN == '') { die("skip\n"); } $db = DB::connect(DRIVER_DSN); if (DB::isError($db)) { die("skip\n"); } ?>
Index: php4/pear/DB/tests/driver/01connect.phpt +++ php4/pear/DB/tests/driver/01connect.phpt --TEST-- DB_driver::connect test --SKIPIF-- <?php require "skipif.inc"; ?> --FILE-- <?php require "connect.inc"; if (is_object($dbh)) { print "\$dbh is an object\n"; } if (is_resource($dbh->connection)) { print "\$dbh is connected\n"; } ?> --EXPECT-- $dbh is an object $dbh is connected Index: php4/pear/DB/tests/driver/02fetch.phpt +++ php4/pear/DB/tests/driver/02fetch.phpt --TEST-- DB_driver::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: 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 fetchmodes: fetchinto default default 0 1 2 3 testing fetchmodes: fetchrow ordered default 0 1 2 3 testing fetchmodes: fetchrow assoc default a b c d testing fetchmodes: fetchrow ordered default with assoc specified a b c d testing fetchmodes: fetchrow assoc default with ordered specified 0 1 2 3 testing fetchmodes: fetchinto ordered default 0 1 2 3 testing fetchmodes: fetchinto assoc default a b c d testing fetchmodes: fetchinto ordered default with assoc specified a b c d testing fetchmodes: fetchinto assoc default with ordered specified 0 1 2 3 Index: php4/pear/DB/tests/driver/03simplequery.phpt +++ php4/pear/DB/tests/driver/03simplequery.phpt --TEST-- DB_driver::simpleQuery test --SKIPIF-- <?php include("skipif.inc"); ?> --FILE-- <?php require_once "DB.php"; include("mktable.inc"); include("../simplequery.inc"); ?> --EXPECT-- resource Index: php4/pear/DB/tests/driver/04numcols.phpt +++ php4/pear/DB/tests/driver/04numcols.phpt --TEST-- DB_driver::numCols test --SKIPIF-- <?php include("skipif.inc"); ?> --FILE-- <?php require_once "DB.php"; include("mktable.inc"); include("../numcols.inc"); ?> --EXPECT-- 1 2 3 4 Index: php4/pear/DB/tests/driver/05sequences.phpt +++ php4/pear/DB/tests/driver/05sequences.phpt --TEST-- DB_driver::sequences --SKIPIF-- <?php require "skipif.inc"; ?> --FILE-- <?php require "connect.inc"; require "../sequences.inc"; ?> --EXPECT-- DB Error: no such table a=1 b=2 b-a=1 c=1 d=1 Index: php4/pear/DB/tests/driver/06prepexec.phpt +++ php4/pear/DB/tests/driver/06prepexec.phpt --TEST-- DB_driver::prepare/execute test --SKIPIF-- <?php include("skipif.inc"); ?> --FILE-- <?php require_once "DB.php"; include("mktable.inc"); include("../prepexe.inc"); ?> --EXPECT-- sth1,sth2,sth3 created sth1 executed sth2 executed sth3 executed results: 72 - - - 72 - bing - - 72 - gazonk - opaque placeholder test - Index: php4/pear/DB/tests/driver/08affectedrows.phpt +++ php4/pear/DB/tests/driver/08affectedrows.phpt --TEST-- DB_driver::affectedRows test --SKIPIF-- <?php include("skipif.inc"); ?> --FILE-- <?php require_once "DB.php"; include("mktable.inc"); // Clean table $dbh->query("DELETE FROM phptest"); // Affected rows by INSERT statement $dbh->query("INSERT INTO phptest (a,b) VALUES(1, 'test')"); $dbh->query("INSERT INTO phptest (a,b) VALUES(2, 'test')"); printf("%d after insert\n", $dbh->affectedRows()); // Affected rows by SELECT statement $dbh->query("SELECT * FROM phptest"); printf("%d after select\n", $dbh->affectedRows()); $dbh->query("DELETE FROM phptest WHERE b = 'test'"); printf("%d after delete\n", $dbh->affectedRows()); // Affected rows by DELETE statement $dbh->query("INSERT INTO phptest (a,b) VALUES(1, 'test')"); $dbh->query("INSERT INTO phptest (a,b) VALUES(2, 'test')"); $dbh->setOption("optimize", "portability"); $dbh->query("DELETE FROM phptest"); printf("%d after delete all (optimize=%s)\n", $dbh->affectedRows(), $dbh->getOption("optimize")); ?> --EXPECT-- 1 after insert 0 after select 2 after delete 2 after delete all (optimize=portability) Index: php4/pear/DB/tests/driver/09numrows.phpt +++ php4/pear/DB/tests/driver/09numrows.phpt --TEST-- DB_driver::numRows test --SKIPIF-- <?php require "skipif.inc"; ?> --FILE-- <?php require "connect.inc"; require "mktable.inc"; require "../numrows.inc"; ?> --EXPECT-- 1 2 3 4 5 6 2 0 Index: php4/pear/DB/tests/driver/10errormap.phpt +++ php4/pear/DB/tests/driver/10errormap.phpt --TEST-- DB_driver::error mapping --SKIPIF-- <?php require "skipif.inc"; ?> --FILE-- <?php require "connect.inc"; require "mktable.inc"; require "../errors.inc"; ?> --EXPECT-- Trying to provoke DB_ERROR_NOSUCHTABLE DB Error: no such table Trying to provoke DB_ERROR_ALREADY_EXISTS DB Error: already exists Trying to provoke DB_ERROR_NOSUCHTABLE DB Error: no such table Trying to provoke DB_ERROR_CONSTRAINT DB Error: constraint violation Trying to provoke DB_ERROR_DIVZERO DB Error: division by zero Trying to provoke DB_ERROR_INVALID_NUMBER DB Error: invalid number Trying to provoke DB_ERROR_NOSUCHFIELD DB Error: no such field Trying to provoke DB_ERROR_SYNTAX DB Error: syntax error Index: php4/pear/DB/tests/driver/13limit.phpt +++ php4/pear/DB/tests/driver/13limit.phpt --TEST-- DB_driver::row limit --SKIPIF-- <?php require "skipif.inc"; ?> --FILE-- <?php require 'connect.inc'; include '../limit.inc'; ?> --EXPECT-- ======= From: 0 || Number of rows to fetch: 10 ======= 1.- result 0 2.- result 1 3.- result 2 4.- result 3 5.- result 4 6.- result 5 7.- result 6 8.- result 7 9.- result 8 10.- result 9 ======= From: 10 || Number of rows to fetch: 10 ======= 11.- result 10 12.- result 11 13.- result 12 14.- result 13 15.- result 14 16.- result 15 17.- result 16 18.- result 17 19.- result 18 20.- result 19 ======= From: 20 || Number of rows to fetch: 10 ======= 21.- result 20 22.- result 21 23.- result 22 24.- result 23 25.- result 24 26.- result 25 27.- result 26 28.- result 27 29.- result 28 30.- result 29 ======= From: 30 || Number of rows to fetch: 10 ======= 31.- result 30 32.- result 31 33.- result 32 Index: php4/pear/DB/tests/driver/14fetchmode_object.phpt +++ php4/pear/DB/tests/driver/14fetchmode_object.phpt --TEST-- DB_driver::fetchmode object --SKIPIF-- <?php require "skipif.inc"; ?> --FILE-- <?php require './connect.inc'; include '../fetchmode_object.inc'; ?> --EXPECT-- --- fetch with param DB_FETCHMODE_OBJECT --- stdClass -> a b c d stdClass -> a b c d --- fetch with default fetchmode DB_FETCHMODE_OBJECT --- stdClass -> a b c d stdClass -> a b c d --- fetch with default fetchmode DB_FETCHMODE_OBJECT and class DB_Row --- db_row -> a b c d db_row -> a b c d Index: php4/pear/DB/tests/driver/connect.inc +++ php4/pear/DB/tests/driver/connect.inc <?php require './setup.inc'; error_reporting(E_ALL); require_once "DB.php"; $dbh = DB::connect(DRIVER_DSN, array('optimize' => 'portability')); if (DB::isError($dbh)) { die("connect.inc: ".$dbh->toString()); } function debug_die($o){ die($o->toString()); } ?> Index: php4/pear/DB/tests/driver/mktable.inc +++ php4/pear/DB/tests/driver/mktable.inc <?php require_once "./connect.inc"; $dbh->setErrorHandling(PEAR_ERROR_RETURN); $dbh->query("DROP TABLE phptest"); //$dbh->setErrorHandling(PEAR_ERROR_TRIGGER); $dbh->setErrorHandling(PEAR_ERROR_CALLBACK, 'debug_die'); $test_mktable_query = "CREATE TABLE phptest (a INTEGER, b VARCHAR(40), c VARCHAR(255), d VARCHAR(20))"; $dbh->query($test_mktable_query); $dbh->query("INSERT INTO phptest VALUES(42, 'bing', 'This is a test', '1999-11-21')"); $dbh->setErrorHandling(PEAR_ERROR_RETURN); ?> Index: php4/pear/DB/tests/driver/setup.inc +++ php4/pear/DB/tests/driver/setup.inc <?php define('DRIVER_DSN', ''); //define('DRIVER_DSN', 'pgsql://postgres@localhost/test'); //define('DRIVER_DSN', 'pgsql://root@localhost/test'); //define('DRIVER_DSN', 'oci8://system:manager@'); ?> Index: php4/pear/DB/tests/driver/skipif.inc +++ php4/pear/DB/tests/driver/skipif.inc <?php // This script prints "skip" unless: // * the mysql extension is built-in or loadable, AND // * there is a database called "test" accessible // with no username/password, AND // * we have create/drop privileges on the entire "test" // database include './setup.inc'; require_once 'DB.php'; if (!defined('DRIVER_DSN') || DRIVER_DSN == '') { die("skip\n"); } $db = DB::connect(DRIVER_DSN); if (DB::isError($db)) { die("skip\n"); } ?>