1--TEST-- 2sqlite-oo: sqlite::seek 3--INI-- 4sqlite.assoc_case=0 5--SKIPIF-- 6<?php # vim:ft=php 7if (!extension_loaded("sqlite")) print "skip"; ?> 8--FILE-- 9<?php 10include "blankdb_oo.inc"; 11 12$data = array( 13 "one", 14 "two", 15 "three" 16 ); 17 18$db->query("CREATE TABLE strings(a)"); 19 20foreach ($data as $str) { 21 $db->query("INSERT INTO strings VALUES('$str')"); 22} 23 24$res = $db->query("SELECT a FROM strings", SQLITE_NUM); 25for ($idx = -1; $idx < 4; $idx++) { 26 echo "====SEEK:$idx====\n"; 27 $res->seek($idx); 28 var_dump($res->current()); 29} 30echo "====AGAIN====\n"; 31for ($idx = -1; $idx < 4; $idx++) { 32 echo "====SEEK:$idx====\n"; 33 $res->seek($idx); 34 var_dump($res->current()); 35} 36echo "====DONE!====\n"; 37?> 38--EXPECTF-- 39====SEEK:-1==== 40 41Warning: SQLiteResult::seek(): row -1 out of range in %ssqlite_oo_022.php on line %d 42array(1) { 43 [0]=> 44 string(3) "one" 45} 46====SEEK:0==== 47array(1) { 48 [0]=> 49 string(3) "one" 50} 51====SEEK:1==== 52array(1) { 53 [0]=> 54 string(3) "two" 55} 56====SEEK:2==== 57array(1) { 58 [0]=> 59 string(5) "three" 60} 61====SEEK:3==== 62 63Warning: SQLiteResult::seek(): row 3 out of range in %ssqlite_oo_022.php on line %d 64array(1) { 65 [0]=> 66 string(5) "three" 67} 68====AGAIN==== 69====SEEK:-1==== 70 71Warning: SQLiteResult::seek(): row -1 out of range in %ssqlite_oo_022.php on line %d 72array(1) { 73 [0]=> 74 string(5) "three" 75} 76====SEEK:0==== 77array(1) { 78 [0]=> 79 string(3) "one" 80} 81====SEEK:1==== 82array(1) { 83 [0]=> 84 string(3) "two" 85} 86====SEEK:2==== 87array(1) { 88 [0]=> 89 string(5) "three" 90} 91====SEEK:3==== 92 93Warning: SQLiteResult::seek(): row 3 out of range in %ssqlite_oo_022.php on line %d 94array(1) { 95 [0]=> 96 string(5) "three" 97} 98====DONE!==== 99