xref: /PHP-5.3/ext/sqlite/tests/sqlite_oo_026.phpt (revision 610c7fbe)
1--TEST--
2sqlite-oo: unbuffered
3--INI--
4sqlite.assoc_case=0
5--SKIPIF--
6<?php # vim:ft=php
7if (!extension_loaded("sqlite")) print "skip";
8?>
9--FILE--
10<?php
11include "blankdb_oo.inc";
12
13$data = array(
14	"one",
15	"two",
16	"three"
17	);
18
19$db->query("CREATE TABLE strings(a VARCHAR)");
20
21foreach ($data as $str) {
22	$db->query("INSERT INTO strings VALUES('$str')");
23}
24
25echo "====FOREACH====\n";
26$r = $db->unbufferedQuery("SELECT a from strings", SQLITE_NUM);
27foreach($r as $idx => $row) {
28	var_dump($row[0]);
29	var_dump($row[0]);
30}
31echo "====FOR====\n";
32$r = $db->unbufferedQuery("SELECT a from strings", SQLITE_NUM);
33for(;$r->valid(); $r->next()) {
34	$v = $r->column(0);
35	var_dump($v);
36	$c = $r->column(0);
37	var_dump(is_null($c) || $c==$v);
38}
39echo "===DONE===\n";
40?>
41--EXPECT--
42====FOREACH====
43string(3) "one"
44string(3) "one"
45string(3) "two"
46string(3) "two"
47string(5) "three"
48string(5) "three"
49====FOR====
50string(3) "one"
51bool(true)
52string(3) "two"
53bool(true)
54string(5) "three"
55bool(true)
56===DONE===
57