xref: /PHP-5.3/ext/sqlite/tests/sqlite_oo_003.phpt (revision 610c7fbe)
1--TEST--
2sqlite-oo: Simple insert/select, different result representation
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_oo.inc";
11
12$db->query("CREATE TABLE foo(c1 date, c2 time, c3 varchar(64))");
13$db->query("INSERT INTO foo VALUES ('2002-01-02', '12:49:00', NULL)");
14$r = $db->query("SELECT * from foo");
15var_dump($r->fetch(SQLITE_BOTH));
16$r = $db->query("SELECT * from foo");
17var_dump($r->fetch(SQLITE_NUM));
18$r = $db->query("SELECT * from foo");
19var_dump($r->fetch(SQLITE_ASSOC));
20?>
21--EXPECT--
22array(6) {
23  [0]=>
24  string(10) "2002-01-02"
25  ["c1"]=>
26  string(10) "2002-01-02"
27  [1]=>
28  string(8) "12:49:00"
29  ["c2"]=>
30  string(8) "12:49:00"
31  [2]=>
32  NULL
33  ["c3"]=>
34  NULL
35}
36array(3) {
37  [0]=>
38  string(10) "2002-01-02"
39  [1]=>
40  string(8) "12:49:00"
41  [2]=>
42  NULL
43}
44array(3) {
45  ["c1"]=>
46  string(10) "2002-01-02"
47  ["c2"]=>
48  string(8) "12:49:00"
49  ["c3"]=>
50  NULL
51}
52