1--TEST--
2SQLite3::query INSERT tests
3--EXTENSIONS--
4sqlite3
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$results = $db->query("SELECT * FROM test ORDER BY id ASC");
20while ($result = $results->fetchArray(SQLITE3_NUM))
21{
22    var_dump($result);
23}
24$results->finalize();
25
26echo "Closing database\n";
27var_dump($db->close());
28echo "Done\n";
29?>
30--EXPECTF--
31Creating Table
32bool(true)
33INSERT into table
34bool(true)
35bool(true)
36SELECTING results
37array(2) {
38  [0]=>
39  int(%d)
40  [1]=>
41  string(1) "a"
42}
43array(2) {
44  [0]=>
45  int(%d)
46  [1]=>
47  string(1) "b"
48}
49Closing database
50bool(true)
51Done
52