cvs: php4 /pear/DB STATUS /pear/DB/tests numcols.inc prepexe.inc simplequery.inc /pear/DB/tests/mysql 001.phpt 002.phpt 003.phpt 004.phpt 005.phpt
006.phpt 007.phpt

From: Date: Wed, 06 Dec 2000 20:18:42 +0000
Subject: cvs: php4 /pear/DB STATUS /pear/DB/tests numcols.inc prepexe.inc simplequery.inc /pear/DB/tests/mysql 001.phpt 002.phpt 003.phpt 004.phpt 005.phpt
006.phpt 007.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-2980@lists.php.net to get a copy of this message
ssb Wed Dec 6 12:18:42 2000 EDT Added files: /php4/pear/DB/tests numcols.inc prepexe.inc simplequery.inc /php4/pear/DB/tests/mysql 004.phpt 006.phpt 007.phpt Modified files: /php4/pear/DB STATUS /php4/pear/DB/tests/mysql 003.phpt 001.phpt 002.phpt 005.phpt Log: * added more tests for MySQL, including some test files common for all backends Index: php4/pear/DB/STATUS diff -u php4/pear/DB/STATUS:1.1 php4/pear/DB/STATUS:1.2 --- php4/pear/DB/STATUS:1.1 Tue Dec 5 17:35:34 2000 +++ php4/pear/DB/STATUS Wed Dec 6 12:18:40 2000 @@ -1,10 +1,22 @@ DB driver feature matrix: -FEATURE ibase msql mssql mysql oci8 odbc pgsql sybase -simpleQuery x x x x x x x x -numCols x x x x x - x x -numRows - - - - - - x - -errorNative - - - x x - x - -prepare/execute x o o o o o o o -sequences - - - o - - - - -affectedRows - - - - x - - - +Symbols: + "x" - implementation using native functions, without regression test + "X" - implementation using native functions, complete with regression test + "e" - emulating implementation, without regression test + "E" - emulating implementation, complete with regression test + "n" - returns a "not capable" error + "-" - no implementation of this feature + +Each symbol is uppercased as tests are written for the feature. + +FEATURE ibase msql mssql mysql oci8 odbc pgsql sybase +simpleQuery x x x X x x x x +numCols x x x X x - x x +numRows - - - - - - x - +errorNative - - - x x - x - +prepare/execute x e e E e e e e +sequences - - - E - - - - +affectedRows - - - - x - - - +fetch modes x x x X x - x x +transactions n n n n x - n n Index: php4/pear/DB/tests/mysql/003.phpt diff -u /dev/null php4/pear/DB/tests/mysql/003.phpt:1.3 --- /dev/null Wed Dec 6 12:18:41 2000 +++ php4/pear/DB/tests/mysql/003.phpt Wed Dec 6 12:18:41 2000 @@ -0,0 +1,12 @@ +--TEST-- +DB_mysql::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/mysql/001.phpt diff -u php4/pear/DB/tests/mysql/001.phpt:1.1 php4/pear/DB/tests/mysql/001.phpt:1.2 --- php4/pear/DB/tests/mysql/001.phpt:1.1 Mon Sep 11 17:27:50 2000 +++ php4/pear/DB/tests/mysql/001.phpt Wed Dec 6 12:18:41 2000 @@ -1,5 +1,5 @@ --TEST-- -MySQL DB::connect +DB_mysql::connect test --SKIPIF-- <?php include("skipif.inc"); ?> --FILE-- Index: php4/pear/DB/tests/mysql/002.phpt diff -u php4/pear/DB/tests/mysql/002.phpt:1.1 php4/pear/DB/tests/mysql/002.phpt:1.2 --- php4/pear/DB/tests/mysql/002.phpt:1.1 Mon Sep 11 17:27:50 2000 +++ php4/pear/DB/tests/mysql/002.phpt Wed Dec 6 12:18:41 2000 @@ -1,5 +1,5 @@ --TEST-- -MySQL DB fetch modes +DB_mysql fetch modes test --SKIPIF-- <?php include("skipif.inc"); ?> --FILE-- Index: php4/pear/DB/tests/mysql/005.phpt diff -u php4/pear/DB/tests/mysql/005.phpt:1.1 php4/pear/DB/tests/mysql/005.phpt:1.2 --- php4/pear/DB/tests/mysql/005.phpt:1.1 Tue Dec 5 03:58:23 2000 +++ php4/pear/DB/tests/mysql/005.phpt Wed Dec 6 12:18:41 2000 @@ -1,5 +1,5 @@ --TEST-- -MySQL sequence emulation +DB_mysql::nextId test --SKIPIF-- <?php include("skipif.inc"); ?> --FILE-- Index: php4/pear/DB/tests/numcols.inc +++ php4/pear/DB/tests/numcols.inc <?php $dbh->setErrorHandling(PEAR_ERROR_DIE); $sth = $dbh->query("SELECT a FROM phptest"); printf("%d\n", $sth->numCols()); $sth = $dbh->query("SELECT a,b FROM phptest"); printf("%d\n", $sth->numCols()); $sth = $dbh->query("SELECT a,b,c FROM phptest"); printf("%d\n", $sth->numCols()); $sth = $dbh->query("SELECT * FROM phptest"); printf("%d\n", $sth->numCols()); ?> Index: php4/pear/DB/tests/prepexe.inc +++ php4/pear/DB/tests/prepexe.inc <?php $dbh->setErrorHandling(PEAR_ERROR_DIE); $sth1 = $dbh->prepare("INSERT INTO phptest (a) VALUES(?)"); $sth2 = $dbh->prepare("INSERT INTO phptest (a,b) VALUES(?,?)"); $sth3 = $dbh->prepare("INSERT INTO phptest (a,b,c) VALUES(?,?,&)"); print "sth1,sth2,sth3 created\n"; $tmpfile = tempnam("/tmp", "phptmp"); register_shutdown_function("shutdown"); $fp = fopen($tmpfile, "w"); fwrite($fp, "opaque\nplaceholder\ntest"); fclose($fp); if (($res = $dbh->execute($sth1, array(72))) == DB_OK) { print "sth1 executed\n"; } if (($res = $dbh->execute($sth2, array(72,'bing'))) == DB_OK) { print "sth2 executed\n"; } if (($res = $dbh->execute($sth3, array(72,'gazonk',$tmpfile))) == DB_OK) { print "sth3 executed\n"; } print "results:\n"; $sth = $dbh->query("SELECT * FROM phptest WHERE a = 72"); while ($row = $sth->fetchRow(DB_FETCHMODE_ORDERED)) { print implode(" - ", $row) . "\n"; } function shutdown() { global $tmpfile; unlink($tmpfile); } ?> Index: php4/pear/DB/tests/simplequery.inc +++ php4/pear/DB/tests/simplequery.inc <?php $dbh->setErrorHandling(PEAR_ERROR_DIE); $sth = $dbh->simpleQuery("SELECT * FROM phptest"); print gettype($sth)."\n"; ?> Index: php4/pear/DB/tests/mysql/004.phpt +++ php4/pear/DB/tests/mysql/004.phpt --TEST-- DB_mysql::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/mysql/006.phpt +++ php4/pear/DB/tests/mysql/006.phpt --TEST-- DB_mysql::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/mysql/007.phpt +++ php4/pear/DB/tests/mysql/007.phpt --TEST-- DB_mysql::errorNative test --SKIPIF-- <?php include("skipif.inc"); ?> --FILE-- <?php require_once "DB.php"; include("mktable.inc"); $dbh->query("syntax error please"); print "error code " . $dbh->errorNative() . "\n"; ?> --EXPECT-- error code 1064

« previous php.cvs (#2980) next »