1--TEST-- 2SQLite3_stmt::clear 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$stmt->reset(); 29$stmt->clear(); 30var_dump($stmt->bindValue(1, 'b', SQLITE3_TEXT)); 31$results = $stmt->execute(); 32while ($result = $results->fetchArray(SQLITE3_NUM)) { 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 48BINDING Parameter 49bool(true) 50array(2) { 51 [0]=> 52 int(%d) 53 [1]=> 54 string(1) "a" 55} 56bool(true) 57array(2) { 58 [0]=> 59 int(%d) 60 [1]=> 61 string(1) "b" 62} 63Closing database 64bool(true) 65Done 66