1--TEST-- 2SQLite3::query UPDATE tests 3--SKIPIF-- 4<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?> 5--FILE-- 6<?php 7 8require_once(dirname(__FILE__) . '/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 "UPDATING results\n"; 27var_dump($db->exec("UPDATE test SET id = 'c' 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} 60UPDATING results 61bool(true) 62Checking results 63array(2) { 64 [0]=> 65 int(%d) 66 [1]=> 67 string(1) "b" 68} 69array(2) { 70 [0]=> 71 int(%d) 72 [1]=> 73 string(1) "c" 74} 75Closing database 76bool(true) 77Done 78