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