1--TEST--
2SQLite3::query DELETE 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 "DELETING a row\n";
27var_dump($db->exec("DELETE FROM test WHERE id = 'a'"));
28
29echo "Checking results\n";
30$results = $db->query("SELECT * FROM test ORDER BY id ASC");
31while ($result = $results->fetchArray(SQLITE3_NUM))
32{
33    var_dump($result);
34}
35$results->finalize();
36
37echo "Closing database\n";
38var_dump($db->close());
39echo "Done\n";
40?>
41--EXPECTF--
42Creating Table
43bool(true)
44INSERT into table
45bool(true)
46bool(true)
47SELECTING results
48array(2) {
49  [0]=>
50  int(%d)
51  [1]=>
52  string(1) "a"
53}
54array(2) {
55  [0]=>
56  int(%d)
57  [1]=>
58  string(1) "b"
59}
60DELETING a row
61bool(true)
62Checking results
63array(2) {
64  [0]=>
65  int(%d)
66  [1]=>
67  string(1) "b"
68}
69Closing database
70bool(true)
71Done
72