]> granicus.if.org Git - php/commitdiff
Add a test for sqlite_array_query()
authorMarcus Boerger <helly@php.net>
Mon, 9 Jun 2003 23:22:00 +0000 (23:22 +0000)
committerMarcus Boerger <helly@php.net>
Mon, 9 Jun 2003 23:22:00 +0000 (23:22 +0000)
ext/sqlite/tests/sqlite_015.phpt [new file with mode: 0755]

diff --git a/ext/sqlite/tests/sqlite_015.phpt b/ext/sqlite/tests/sqlite_015.phpt
new file mode 100755 (executable)
index 0000000..b5bd617
--- /dev/null
@@ -0,0 +1,47 @@
+--TEST--
+sqlite: fetch all (array_query)
+--INI--
+sqlite.assoc_case=0
+--SKIPIF--
+<?php # vim:ft=php
+if (!extension_loaded("sqlite")) print "skip"; ?>
+--FILE--
+<?php 
+include "blankdb.inc";
+
+$data = array(
+       "one",
+       "two",
+       "three"
+       );
+
+sqlite_query("CREATE TABLE strings(a VARCHAR)", $db);
+
+foreach ($data as $str) {
+       sqlite_query("INSERT INTO strings VALUES('$str')", $db);
+}
+
+$res = sqlite_array_query("SELECT a from strings", $db, SQLITE_NUM);
+var_dump($res);
+
+echo "DONE!\n";
+?>
+--EXPECTF--
+array(3) {
+  [0]=>
+  array(1) {
+    [0]=>
+    string(3) "one"
+  }
+  [1]=>
+  array(1) {
+    [0]=>
+    string(3) "two"
+  }
+  [2]=>
+  array(1) {
+    [0]=>
+    string(5) "three"
+  }
+}
+DONE!