cvs: php4 /pear/DB STATUS mysql.php /pear/DB/tests numrows.inc /pear/DB/tests/mysql 009.phpt /pear/DB/tests/pgsql 009.phpt
| From: | Stig Bakken | Date: | Sun, 10 Dec 2000 01:13:13 +0000 |
| Subject: | cvs: php4 /pear/DB STATUS mysql.php /pear/DB/tests numrows.inc /pear/DB/tests/mysql 009.phpt /pear/DB/tests/pgsql 009.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-3047@lists.php.net to get a copy of this message | ||
ssb Sat Dec 9 17:13:13 2000 EDT
Added files:
/php4/pear/DB/tests numrows.inc
/php4/pear/DB/tests/mysql 009.phpt
/php4/pear/DB/tests/pgsql 009.phpt
Modified files:
/php4/pear/DB STATUS mysql.php
Log:
* added numRows tests for mysql and pgsql
Index: php4/pear/DB/STATUS
diff -u php4/pear/DB/STATUS:1.8 php4/pear/DB/STATUS:1.9
--- php4/pear/DB/STATUS:1.8 Thu Dec 7 19:22:15 2000
+++ php4/pear/DB/STATUS Sat Dec 9 17:13:12 2000
@@ -12,14 +12,14 @@
Each symbol is uppercased as tests are written for the feature.
FEATURE ibase msql mssql mysql oci8 odbc pgsql sybase
-simpleQuery x x x T x x x x
-numCols x x x T x - x x
-numRows - - - x - - x -
-errorNative - - - T x - x -
-prepare/execute x e e E e e e e
+simpleQuery x x x T x x T x
+numCols x x x T x - T x
+numRows - - - T - - T -
+errorNative - - - T x - T -
+prepare/execute x e e E e e E e
sequences - - - E - - - -
-affectedRows - - - T x - x -
-fetch modes x x x T x - x x
+affectedRows - - - T x - T -
+fetch modes x x x T x - T x
transactions x n n n x - x n
auto-commit x n n n x - - n
error mapping - - - x - x - -
Index: php4/pear/DB/mysql.php
diff -u php4/pear/DB/mysql.php:1.36 php4/pear/DB/mysql.php:1.37
--- php4/pear/DB/mysql.php:1.36 Thu Dec 7 19:22:15 2000
+++ php4/pear/DB/mysql.php Sat Dec 9 17:13:12 2000
@@ -358,7 +358,7 @@
*/
function affectedRows()
{
- if (preg_match('/(INSERT|UPDATE|DELETE)/i', $this->last_query)) {
+ if (DB::isManip($this->last_query)) {
$result = mysql_affected_rows($this->connection);
} else {
$result = 0;
Index: php4/pear/DB/tests/numrows.inc
+++ php4/pear/DB/tests/numrows.inc
<?php
$dbh->setErrorHandling(PEAR_ERROR_DIE);
$sth = $dbh->query("SELECT a FROM phptest");
printf("%d\n", $sth->numRows());
for ($i = 0; $i < 5; $i++) {
$sth = $dbh->query("INSERT INTO phptest (a) VALUES($i)");
$sth = $dbh->query("SELECT a FROM phptest");
printf("%d\n", $sth->numRows());
}
$dbh->query("DELETE FROM phptest WHERE a < 4");
$sth = $dbh->query("SELECT a FROM phptest");
printf("%d\n", $sth->numRows());
?>
Index: php4/pear/DB/tests/mysql/009.phpt
+++ php4/pear/DB/tests/mysql/009.phpt
--TEST--
DB_mysql::numRows test
--SKIPIF--
<?php include("skipif.inc"); ?>
--FILE--
<?php
require_once "DB.php";
require "mktable.inc";
require "../numrows.inc";
?>
--EXPECT--
1
2
3
4
5
6
2
Index: php4/pear/DB/tests/pgsql/009.phpt
+++ php4/pear/DB/tests/pgsql/009.phpt
--TEST--
DB_pgsql::numRows test
--SKIPIF--
<?php include("skipif.inc"); ?>
--FILE--
<?php
require_once "DB.php";
require "mktable.inc";
require "../numrows.inc";
?>
--EXPECT--
1
2
3
4
5
6
2