xref: /PHP-5.3/ext/sqlite/tests/sqlite_007.phpt (revision 610c7fbe)
1--TEST--
2sqlite: Simple insert/select (unbuffered)
3--INI--
4sqlite.assoc_case=0
5--SKIPIF--
6<?php
7if (!extension_loaded("sqlite")) print "skip"; ?>
8--FILE--
9<?php
10include "blankdb.inc";
11
12sqlite_query("CREATE TABLE foo(c1 date, c2 time, c3 varchar(64))", $db);
13sqlite_query("INSERT INTO foo VALUES ('2002-01-02', '12:49:00', NULL)", $db);
14$r = sqlite_unbuffered_query("SELECT * from foo", $db);
15var_dump(sqlite_fetch_array($r, SQLITE_BOTH));
16$r = sqlite_unbuffered_query("SELECT * from foo", $db);
17var_dump(sqlite_fetch_array($r, SQLITE_NUM));
18$r = sqlite_unbuffered_query("SELECT * from foo", $db);
19var_dump(sqlite_fetch_array($r, SQLITE_ASSOC));
20sqlite_close($db);
21?>
22--EXPECT--
23array(6) {
24  [0]=>
25  string(10) "2002-01-02"
26  ["c1"]=>
27  string(10) "2002-01-02"
28  [1]=>
29  string(8) "12:49:00"
30  ["c2"]=>
31  string(8) "12:49:00"
32  [2]=>
33  NULL
34  ["c3"]=>
35  NULL
36}
37array(3) {
38  [0]=>
39  string(10) "2002-01-02"
40  [1]=>
41  string(8) "12:49:00"
42  [2]=>
43  NULL
44}
45array(3) {
46  ["c1"]=>
47  string(10) "2002-01-02"
48  ["c2"]=>
49  string(8) "12:49:00"
50  ["c3"]=>
51  NULL
52}
53