1--TEST-- 2SQLite3::reset prepared statement results 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 var_dump($result); 27} 28$results->reset(); 29while ($result = $results->fetchArray(SQLITE3_NUM)) { 30 var_dump($result); 31} 32$results->finalize(); 33 34echo "Closing database\n"; 35var_dump($db->close()); 36echo "Done\n"; 37?> 38--EXPECTF-- 39Creating Table 40bool(true) 41INSERT into table 42bool(true) 43bool(true) 44SELECTING results 45BINDING Parameter 46bool(true) 47array(2) { 48 [0]=> 49 int(%d) 50 [1]=> 51 string(1) "a" 52} 53array(2) { 54 [0]=> 55 int(%d) 56 [1]=> 57 string(1) "a" 58} 59Closing database 60bool(true) 61Done 62