Annotation of embedaddon/php/ext/sqlite3/tests/sqlite3_27_reset_prepared_stmt_result.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: SQLite3::reset prepared statement results
! 3: --SKIPIF--
! 4: <?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
! 5: --FILE--
! 6: <?php
! 7:
! 8: require_once(dirname(__FILE__) . '/new_db.inc');
! 9: define('TIMENOW', time());
! 10:
! 11: echo "Creating Table\n";
! 12: var_dump($db->exec('CREATE TABLE test (time INTEGER, id STRING)'));
! 13:
! 14: echo "INSERT into table\n";
! 15: var_dump($db->exec("INSERT INTO test (time, id) VALUES (" . TIMENOW . ", 'a')"));
! 16: var_dump($db->exec("INSERT INTO test (time, id) VALUES (" . TIMENOW . ", 'b')"));
! 17:
! 18: echo "SELECTING results\n";
! 19: $stmt = $db->prepare("SELECT * FROM test WHERE id = ? ORDER BY id ASC");
! 20: $foo = 'c';
! 21: echo "BINDING Parameter\n";
! 22: var_dump($stmt->bindParam(1, $foo, SQLITE3_TEXT));
! 23: $foo = 'a';
! 24: $results = $stmt->execute();
! 25: while ($result = $results->fetchArray(SQLITE3_NUM)) {
! 26: var_dump($result);
! 27: }
! 28: $results->reset();
! 29: while ($result = $results->fetchArray(SQLITE3_NUM)) {
! 30: var_dump($result);
! 31: }
! 32: $results->finalize();
! 33:
! 34: echo "Closing database\n";
! 35: var_dump($db->close());
! 36: echo "Done\n";
! 37: ?>
! 38: --EXPECTF--
! 39: Creating Table
! 40: bool(true)
! 41: INSERT into table
! 42: bool(true)
! 43: bool(true)
! 44: SELECTING results
! 45: BINDING Parameter
! 46: bool(true)
! 47: array(2) {
! 48: [0]=>
! 49: int(%d)
! 50: [1]=>
! 51: string(1) "a"
! 52: }
! 53: array(2) {
! 54: [0]=>
! 55: int(%d)
! 56: [1]=>
! 57: string(1) "a"
! 58: }
! 59: Closing database
! 60: bool(true)
! 61: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>