2003-10-17 17:21:56 +00:00
|
|
|
--TEST--
|
2003-10-27 08:43:25 +00:00
|
|
|
sqlite-oo: sqlite / foreach
|
2003-10-17 17:21:56 +00:00
|
|
|
--INI--
|
|
|
|
sqlite.assoc_case=0
|
|
|
|
--SKIPIF--
|
|
|
|
<?php # vim:ft=php
|
|
|
|
if (!extension_loaded("sqlite")) print "skip";
|
|
|
|
?>
|
|
|
|
--FILE--
|
|
|
|
<?php
|
|
|
|
include "blankdb_oo.inc";
|
|
|
|
|
|
|
|
$data = array(
|
|
|
|
"one",
|
|
|
|
"two",
|
|
|
|
"three"
|
|
|
|
);
|
|
|
|
|
|
|
|
$db->query("CREATE TABLE strings(a VARCHAR)");
|
|
|
|
|
|
|
|
foreach ($data as $str) {
|
|
|
|
$db->query("INSERT INTO strings VALUES('$str')");
|
|
|
|
}
|
|
|
|
|
|
|
|
echo "====UNBUFFERED====\n";
|
2004-03-26 21:16:50 +00:00
|
|
|
$r = $db->unbufferedQuery("SELECT a from strings", SQLITE_NUM);
|
2003-10-17 17:21:56 +00:00
|
|
|
//var_dump(class_implements($r));
|
|
|
|
foreach($r as $row) {
|
|
|
|
var_dump($row);
|
|
|
|
}
|
|
|
|
echo "====NO-MORE====\n";
|
|
|
|
foreach($r as $row) {
|
|
|
|
var_dump($row);
|
|
|
|
}
|
|
|
|
echo "====DIRECT====\n";
|
2004-03-26 21:16:50 +00:00
|
|
|
foreach($db->unbufferedQuery("SELECT a from strings", SQLITE_NUM) as $row) {
|
2003-10-17 17:21:56 +00:00
|
|
|
var_dump($row);
|
|
|
|
}
|
|
|
|
echo "====BUFFERED====\n";
|
|
|
|
$r = $db->query("SELECT a from strings", SQLITE_NUM);
|
|
|
|
//var_dump(class_implements($r));
|
|
|
|
foreach($r as $row) {
|
|
|
|
var_dump($row);
|
|
|
|
}
|
|
|
|
foreach($r as $row) {
|
|
|
|
var_dump($row);
|
|
|
|
}
|
|
|
|
echo "DONE!\n";
|
|
|
|
?>
|
|
|
|
--EXPECT--
|
|
|
|
====UNBUFFERED====
|
|
|
|
array(1) {
|
|
|
|
[0]=>
|
|
|
|
string(3) "one"
|
|
|
|
}
|
|
|
|
array(1) {
|
|
|
|
[0]=>
|
|
|
|
string(3) "two"
|
|
|
|
}
|
|
|
|
array(1) {
|
|
|
|
[0]=>
|
|
|
|
string(5) "three"
|
|
|
|
}
|
|
|
|
====NO-MORE====
|
|
|
|
====DIRECT====
|
|
|
|
array(1) {
|
|
|
|
[0]=>
|
|
|
|
string(3) "one"
|
|
|
|
}
|
|
|
|
array(1) {
|
|
|
|
[0]=>
|
|
|
|
string(3) "two"
|
|
|
|
}
|
|
|
|
array(1) {
|
|
|
|
[0]=>
|
|
|
|
string(5) "three"
|
|
|
|
}
|
|
|
|
====BUFFERED====
|
|
|
|
array(1) {
|
|
|
|
[0]=>
|
|
|
|
string(3) "one"
|
|
|
|
}
|
|
|
|
array(1) {
|
|
|
|
[0]=>
|
|
|
|
string(3) "two"
|
|
|
|
}
|
|
|
|
array(1) {
|
|
|
|
[0]=>
|
|
|
|
string(5) "three"
|
|
|
|
}
|
|
|
|
array(1) {
|
|
|
|
[0]=>
|
|
|
|
string(3) "one"
|
|
|
|
}
|
|
|
|
array(1) {
|
|
|
|
[0]=>
|
|
|
|
string(3) "two"
|
|
|
|
}
|
|
|
|
array(1) {
|
|
|
|
[0]=>
|
|
|
|
string(5) "three"
|
|
|
|
}
|
|
|
|
DONE!
|
2005-08-16 15:09:51 +00:00
|
|
|
--UEXPECT--
|
|
|
|
====UNBUFFERED====
|
|
|
|
array(1) {
|
|
|
|
[0]=>
|
|
|
|
unicode(3) "one"
|
|
|
|
}
|
|
|
|
array(1) {
|
|
|
|
[0]=>
|
|
|
|
unicode(3) "two"
|
|
|
|
}
|
|
|
|
array(1) {
|
|
|
|
[0]=>
|
|
|
|
unicode(5) "three"
|
|
|
|
}
|
|
|
|
====NO-MORE====
|
|
|
|
====DIRECT====
|
|
|
|
array(1) {
|
|
|
|
[0]=>
|
|
|
|
unicode(3) "one"
|
|
|
|
}
|
|
|
|
array(1) {
|
|
|
|
[0]=>
|
|
|
|
unicode(3) "two"
|
|
|
|
}
|
|
|
|
array(1) {
|
|
|
|
[0]=>
|
|
|
|
unicode(5) "three"
|
|
|
|
}
|
|
|
|
====BUFFERED====
|
|
|
|
array(1) {
|
|
|
|
[0]=>
|
|
|
|
unicode(3) "one"
|
|
|
|
}
|
|
|
|
array(1) {
|
|
|
|
[0]=>
|
|
|
|
unicode(3) "two"
|
|
|
|
}
|
|
|
|
array(1) {
|
|
|
|
[0]=>
|
|
|
|
unicode(5) "three"
|
|
|
|
}
|
|
|
|
array(1) {
|
|
|
|
[0]=>
|
|
|
|
unicode(3) "one"
|
|
|
|
}
|
|
|
|
array(1) {
|
|
|
|
[0]=>
|
|
|
|
unicode(3) "two"
|
|
|
|
}
|
|
|
|
array(1) {
|
|
|
|
[0]=>
|
|
|
|
unicode(5) "three"
|
|
|
|
}
|
|
|
|
DONE!
|