xref: /PHP-5.3/ext/sqlite/tests/sqlite_016.phpt (revision 610c7fbe)
1--TEST--
2sqlite: fetch single
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	array (0 => 'one', 1 => 'two'),
14	array (0 => 'three', 1 => 'four')
15	);
16
17sqlite_query("CREATE TABLE strings(a VARCHAR, b VARCHAR)", $db);
18
19foreach ($data as $str) {
20	sqlite_query("INSERT INTO strings VALUES('${str[0]}','${str[1]}')", $db);
21}
22
23echo "====BUFFERED====\n";
24$r = sqlite_query("SELECT a, b from strings", $db);
25while (sqlite_valid($r)) {
26	var_dump(sqlite_fetch_single($r));
27}
28echo "====UNBUFFERED====\n";
29$r = sqlite_unbuffered_query("SELECT a, b from strings", $db);
30while (sqlite_valid($r)) {
31	var_dump(sqlite_fetch_single($r));
32}
33
34sqlite_close($db);
35
36echo "DONE!\n";
37?>
38--EXPECT--
39====BUFFERED====
40string(3) "one"
41string(5) "three"
42====UNBUFFERED====
43string(3) "one"
44string(5) "three"
45DONE!
46