1--TEST--
2SQLite3::prepare Bound Variable 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 = ? ORDER BY id ASC");
20$foo = 'c';
21echo "BINDING Parameter\n";
22var_dump($stmt->bindParam(1, $foo, SQLITE3_TEXT));
23$foo = 'a';
24$results = $stmt->execute();
25while ($result = $results->fetchArray(SQLITE3_NUM))
26{
27	var_dump($result);
28}
29$results->finalize();
30
31echo "Closing database\n";
32var_dump($db->close());
33echo "Done\n";
34?>
35--EXPECTF--
36Creating Table
37bool(true)
38INSERT into table
39bool(true)
40bool(true)
41SELECTING results
42BINDING Parameter
43bool(true)
44array(2) {
45  [0]=>
46  int(%d)
47  [1]=>
48  string(1) "a"
49}
50Closing database
51bool(true)
52Done
53