Annotation of embedaddon/php/ext/sqlite3/tests/sqlite3_07_prepared_stmt.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: SQLite3::prepare Bound Value test
! 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 = 'a';
! 21: echo "BINDING Value\n";
! 22: var_dump($stmt->bindValue(1, $foo, SQLITE3_TEXT));
! 23: $results = $stmt->execute();
! 24: while ($result = $results->fetchArray(SQLITE3_NUM))
! 25: {
! 26: var_dump($result);
! 27: }
! 28: $results->finalize();
! 29:
! 30: echo "Closing database\n";
! 31: var_dump($db->close());
! 32: echo "Done\n";
! 33: ?>
! 34: --EXPECTF--
! 35: Creating Table
! 36: bool(true)
! 37: INSERT into table
! 38: bool(true)
! 39: bool(true)
! 40: SELECTING results
! 41: BINDING Value
! 42: bool(true)
! 43: array(2) {
! 44: [0]=>
! 45: int(%d)
! 46: [1]=>
! 47: string(1) "a"
! 48: }
! 49: Closing database
! 50: bool(true)
! 51: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>