1--TEST-- 2SQLite3::query Unfinalized statement tests 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$results = $db->query("SELECT * FROM test ORDER BY id ASC"); 20while ($result = $results->fetchArray(SQLITE3_NUM)) 21{ 22 var_dump($result); 23 /* Only read one row and break */ 24 break; 25} 26 27echo "Closing database\n"; 28var_dump($db->close()); 29echo "Check db was closed\n"; 30var_dump($results->numColumns()); 31echo "Done\n"; 32?> 33--EXPECTF-- 34Creating Table 35bool(true) 36INSERT into table 37bool(true) 38bool(true) 39SELECTING results 40array(2) { 41 [0]=> 42 int(%d) 43 [1]=> 44 string(1) "a" 45} 46Closing database 47bool(true) 48Check db was closed 49 50Warning: SQLite3Result::numColumns(): The SQLite3Result object has not been correctly initialised in %s on line %d 51bool(false) 52Done 53