cvs: php4 /pear/DB/tests limit.inc /pear/DB/tests/mysql 13limit.phpt /pear/DB/tests/pgsql 12limit.phpt

From: Date: Wed, 31 Oct 2001 16:01:16 +0000
Subject: cvs: php4 /pear/DB/tests limit.inc /pear/DB/tests/mysql 13limit.phpt /pear/DB/tests/pgsql 12limit.phpt
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-1220@lists.php.net to get a copy of this message
cox Wed Oct 31 11:01:16 2001 EDT Added files: /php4/pear/DB/tests limit.inc /php4/pear/DB/tests/pgsql 12limit.phpt /php4/pear/DB/tests/mysql 13limit.phpt Log: added test for row limit support Index: php4/pear/DB/tests/limit.inc +++ php4/pear/DB/tests/limit.inc <?php function pe($obj) { die($obj->getMessage() . "\n" . $obj->getDebugInfo()); } $dbh->setErrorHandling(PEAR_ERROR_RETURN); $dbh->query("DROP TABLE php_limit"); $dbh->setErrorHandling(PEAR_ERROR_CALLBACK, 'pe'); $dbh->query("CREATE TABLE php_limit (a VARCHAR(20))"); $from = 0; $count = 10; $numrows = 30; for ($i=0; $i<=$numrows+2; $i++) { $dbh->query("INSERT INTO php_limit VALUES('result $i')"); } for ($i=0; $i <= ($numrows + 2); $i=$i+$count) { $from = $i; $res = $dbh->limitQuery("select * from php_limit", $from, $count); echo "======= From: $from || Number of rows to fetch: $count =======\n"; while ($row = $res->fetchRowByLimit(DB_FETCHMODE_ASSOC)) { echo $res->getRowCounter() . '.- ' . $row['a'] . "\n"; } } $dbh->query("DROP TABLE php_limit"); ?> Index: php4/pear/DB/tests/pgsql/12limit.phpt +++ php4/pear/DB/tests/pgsql/12limit.phpt --TEST-- DB_pgsql 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/mysql/13limit.phpt +++ php4/pear/DB/tests/mysql/13limit.phpt --TEST-- DB_mysql 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

« previous php.pear.cvs (#1220) next »