1--TEST-- 2sqlite: fetch all (fetch_all) 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.inc"; 11 12$data = array( 13 "one", 14 "two", 15 "three" 16 ); 17 18sqlite_query("CREATE TABLE strings(a VARCHAR)", $db); 19 20foreach ($data as $str) { 21 sqlite_query("INSERT INTO strings VALUES('$str')", $db); 22} 23 24echo "unbuffered twice\n"; 25$r = sqlite_unbuffered_query("SELECT a from strings", $db, SQLITE_NUM); 26var_dump(sqlite_fetch_all($r)); 27var_dump(sqlite_fetch_all($r)); 28 29echo "unbuffered with fetch_array\n"; 30$r = sqlite_unbuffered_query("SELECT a from strings", $db, SQLITE_NUM); 31var_dump(sqlite_fetch_array($r)); 32var_dump(sqlite_fetch_all($r)); 33 34echo "buffered\n"; 35$r = sqlite_query("SELECT a from strings", $db, SQLITE_NUM); 36var_dump(sqlite_fetch_all($r)); 37var_dump(sqlite_fetch_array($r)); 38var_dump(sqlite_fetch_all($r)); 39 40sqlite_close($db); 41 42echo "DONE!\n"; 43?> 44--EXPECTF-- 45unbuffered twice 46array(3) { 47 [0]=> 48 array(1) { 49 [0]=> 50 string(3) "one" 51 } 52 [1]=> 53 array(1) { 54 [0]=> 55 string(3) "two" 56 } 57 [2]=> 58 array(1) { 59 [0]=> 60 string(5) "three" 61 } 62} 63 64Warning: sqlite_fetch_all(): One or more rowsets were already returned; returning NULL this time in %ssqlite_014.php on line %d 65array(0) { 66} 67unbuffered with fetch_array 68array(1) { 69 [0]=> 70 string(3) "one" 71} 72array(2) { 73 [0]=> 74 array(1) { 75 [0]=> 76 string(3) "two" 77 } 78 [1]=> 79 array(1) { 80 [0]=> 81 string(5) "three" 82 } 83} 84buffered 85array(3) { 86 [0]=> 87 array(1) { 88 [0]=> 89 string(3) "one" 90 } 91 [1]=> 92 array(1) { 93 [0]=> 94 string(3) "two" 95 } 96 [2]=> 97 array(1) { 98 [0]=> 99 string(5) "three" 100 } 101} 102bool(false) 103array(3) { 104 [0]=> 105 array(1) { 106 [0]=> 107 string(3) "one" 108 } 109 [1]=> 110 array(1) { 111 [0]=> 112 string(3) "two" 113 } 114 [2]=> 115 array(1) { 116 [0]=> 117 string(5) "three" 118 } 119} 120DONE! 121