Skip to content

Commit c114698

Browse files
committed
Add a test for sqlite_array_query()
1 parent 25b7954 commit c114698

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

ext/sqlite/tests/sqlite_015.phpt

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
--TEST--
2+
sqlite: fetch all (array_query)
3+
--INI--
4+
sqlite.assoc_case=0
5+
--SKIPIF--
6+
<?php # vim:ft=php
7+
if (!extension_loaded("sqlite")) print "skip"; ?>
8+
--FILE--
9+
<?php
10+
include "blankdb.inc";
11+
12+
$data = array(
13+
"one",
14+
"two",
15+
"three"
16+
);
17+
18+
sqlite_query("CREATE TABLE strings(a VARCHAR)", $db);
19+
20+
foreach ($data as $str) {
21+
sqlite_query("INSERT INTO strings VALUES('$str')", $db);
22+
}
23+
24+
$res = sqlite_array_query("SELECT a from strings", $db, SQLITE_NUM);
25+
var_dump($res);
26+
27+
echo "DONE!\n";
28+
?>
29+
--EXPECTF--
30+
array(3) {
31+
[0]=>
32+
array(1) {
33+
[0]=>
34+
string(3) "one"
35+
}
36+
[1]=>
37+
array(1) {
38+
[0]=>
39+
string(3) "two"
40+
}
41+
[2]=>
42+
array(1) {
43+
[0]=>
44+
string(5) "three"
45+
}
46+
}
47+
DONE!

0 commit comments

Comments
 (0)