Annotation of embedaddon/php/ext/sqlite3/tests/sqlite3_11_numrows.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: SQLite3::prepare number of rows
! 3: --SKIPIF--
! 4: <?php require_once(dirname(__FILE__) . '/skipif.inc');
! 5: // Create an instance of the ReflectionMethod class
! 6: try {
! 7: $method = new ReflectionMethod('sqlite3result', 'numRows');
! 8: } catch (ReflectionException $e) {
! 9: die("skip");
! 10: }
! 11: ?>
! 12: --FILE--
! 13: <?php
! 14:
! 15: require_once(dirname(__FILE__) . '/new_db.inc');
! 16: define('TIMENOW', time());
! 17:
! 18: echo "Creating Table\n";
! 19: var_dump($db->exec('CREATE TABLE test (time INTEGER, id STRING)'));
! 20:
! 21: echo "INSERT into table\n";
! 22: var_dump($db->exec("INSERT INTO test (time, id) VALUES (" . TIMENOW . ", 'a')"));
! 23: var_dump($db->exec("INSERT INTO test (time, id) VALUES (" . TIMENOW . ", 'b')"));
! 24:
! 25: echo "SELECTING results\n";
! 26: $results = $db->query("SELECT * FROM test ORDER BY id ASC");
! 27: echo "Number of rows\n";
! 28: var_dump($results->numRows());
! 29: $results->finalize();
! 30:
! 31: echo "Closing database\n";
! 32: var_dump($db->close());
! 33: echo "Done\n";
! 34: ?>
! 35: --EXPECTF--
! 36: Creating Table
! 37: bool(true)
! 38: INSERT into table
! 39: bool(true)
! 40: bool(true)
! 41: SELECTING results
! 42: Number of rows
! 43: int(2)
! 44: Closing database
! 45: bool(true)
! 46: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>