php-src/ext/sqlite/tests/sqlite_010.phpt

79 lines
1.1 KiB
Plaintext
Raw Normal View History

2003-04-27 20:02:35 +00:00
--TEST--
2003-05-02 22:09:54 +00:00
sqlite: fetch all (iterator)
2003-05-01 13:29:11 +00:00
--INI--
sqlite.assoc_case=0
2003-04-27 20:02:35 +00:00
--SKIPIF--
<?php # vim:ft=php
if (!extension_loaded("sqlite")) print "skip"; ?>
--FILE--
<?php
include "blankdb.inc";
2003-05-02 22:09:54 +00:00
$data = array(
"one",
"two",
"three"
);
2003-04-27 20:02:35 +00:00
2003-05-02 22:09:54 +00:00
sqlite_query("CREATE TABLE strings(a VARCHAR)", $db);
foreach ($data as $str) {
sqlite_query("INSERT INTO strings VALUES('$str')", $db);
}
$r = sqlite_unbuffered_query("SELECT a from strings", $db);
while (sqlite_has_more($r)) {
var_dump(sqlite_current($r, SQLITE_NUM));
sqlite_next($r);
}
$r = sqlite_query("SELECT a from strings", $db);
while (sqlite_has_more($r)) {
var_dump(sqlite_current($r, SQLITE_NUM));
sqlite_next($r);
2003-04-27 20:02:35 +00:00
}
2003-05-02 22:09:54 +00:00
sqlite_rewind($r);
while (sqlite_has_more($r)) {
var_dump(sqlite_current($r, SQLITE_NUM));
sqlite_next($r);
2003-04-27 20:02:35 +00:00
}
echo "DONE!\n";
?>
--EXPECT--
2003-05-02 22:09:54 +00:00
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"
}
array(1) {
[0]=>
string(3) "one"
}
array(1) {
[0]=>
string(3) "two"
}
array(1) {
[0]=>
string(5) "three"
}
2003-04-27 20:02:35 +00:00
DONE!