1--TEST--
2SQLite3::prepare Bound Value test
3--SKIPIF--
4<?php require_once(__DIR__ . '/skipif.inc'); ?>
5--FILE--
6<?php
7
8require_once(__DIR__ . '/new_db.inc');
9define('TIMENOW', time());
10
11echo "Creating Table\n";
12var_dump($db->exec('CREATE TABLE test (time INTEGER, id STRING)'));
13
14echo "INSERT into table\n";
15var_dump($db->exec("INSERT INTO test (time, id) VALUES (" . TIMENOW . ", 'a')"));
16var_dump($db->exec("INSERT INTO test (time, id) VALUES (" . TIMENOW . ", 'b')"));
17
18echo "SELECTING results\n";
19$stmt = $db->prepare("SELECT * FROM test WHERE id = @id ORDER BY id ASC");
20$foo = 'a';
21echo "BINDING Value\n";
22var_dump($stmt->bindValue('@id', $foo, SQLITE3_TEXT));
23$results = $stmt->execute();
24while ($result = $results->fetchArray(SQLITE3_NUM))
25{
26    var_dump($result);
27}
28$results->finalize();
29
30echo "Closing database\n";
31var_dump($db->close());
32echo "Done\n";
33?>
34--EXPECTF--
35Creating Table
36bool(true)
37INSERT into table
38bool(true)
39bool(true)
40SELECTING results
41BINDING Value
42bool(true)
43array(2) {
44  [0]=>
45  int(%d)
46  [1]=>
47  string(1) "a"
48}
49Closing database
50bool(true)
51Done
52