]> granicus.if.org Git - php/commitdiff
Add another test
authorMarcus Boerger <helly@php.net>
Mon, 27 Oct 2003 08:43:52 +0000 (08:43 +0000)
committerMarcus Boerger <helly@php.net>
Mon, 27 Oct 2003 08:43:52 +0000 (08:43 +0000)
ext/sqlite/tests/sqlite_oo_026.phpt [new file with mode: 0755]

diff --git a/ext/sqlite/tests/sqlite_oo_026.phpt b/ext/sqlite/tests/sqlite_oo_026.phpt
new file mode 100755 (executable)
index 0000000..f9e2503
--- /dev/null
@@ -0,0 +1,56 @@
+--TEST--
+sqlite-oo: unbuffered
+--INI--
+sqlite.assoc_case=0
+--SKIPIF--
+<?php # vim:ft=php
+if (!extension_loaded("sqlite")) print "skip"; 
+?>
+--FILE--
+<?php 
+include "blankdb_oo.inc";
+
+$data = array(
+       "one",
+       "two",
+       "three"
+       );
+
+$db->query("CREATE TABLE strings(a VARCHAR)");
+
+foreach ($data as $str) {
+       $db->query("INSERT INTO strings VALUES('$str')");
+}
+
+echo "====FOREACH====\n";
+$r = $db->unbuffered_query("SELECT a from strings", SQLITE_NUM);
+foreach($r as $idx => $row) {
+       var_dump($row[0]);
+       var_dump($row[0]);
+}
+echo "====FOR====\n";
+$r = $db->unbuffered_query("SELECT a from strings", SQLITE_NUM);
+for(;$r->hasMore(); $r->next()) {
+       $v = $r->column(0);
+       var_dump($v);
+       $c = $r->column(0);
+       var_dump(is_null($c) || $c==$v);
+}
+echo "===DONE===\n";
+?>
+--EXPECT--
+====FOREACH====
+string(3) "one"
+string(3) "one"
+string(3) "two"
+string(3) "two"
+string(5) "three"
+string(5) "three"
+====FOR====
+string(3) "one"
+bool(true)
+string(3) "two"
+bool(true)
+string(5) "three"
+bool(true)
+===DONE===