summaryrefslogtreecommitdiff
path: root/ext/sqlite/tests/sqlite_oo_024.phpt
diff options
context:
space:
mode:
authorMarcus Boerger <helly@php.net>2003-08-28 23:19:51 +0000
committerMarcus Boerger <helly@php.net>2003-08-28 23:19:51 +0000
commit90561350f92cce92bf2deec323ed3812d1086733 (patch)
tree4062c6530c1d3e8b119a576ad913229fcac57970 /ext/sqlite/tests/sqlite_oo_024.phpt
parent07789ebd0e85632767c95df531b68f1d95533ceb (diff)
downloadphp-git-90561350f92cce92bf2deec323ed3812d1086733.tar.gz
Add sqlite_fetch_object()
Diffstat (limited to 'ext/sqlite/tests/sqlite_oo_024.phpt')
-rwxr-xr-xext/sqlite/tests/sqlite_oo_024.phpt74
1 files changed, 74 insertions, 0 deletions
diff --git a/ext/sqlite/tests/sqlite_oo_024.phpt b/ext/sqlite/tests/sqlite_oo_024.phpt
new file mode 100755
index 0000000000..8234c2d49a
--- /dev/null
+++ b/ext/sqlite/tests/sqlite_oo_024.phpt
@@ -0,0 +1,74 @@
+--TEST--
+sqlite-oo: sqlite::fetch_object
+--INI--
+sqlite.assoc_case=0
+--SKIPIF--
+<?php # vim:ft=php
+if (!extension_loaded("sqlite")) print "skip"; ?>
+--FILE--
+<?php
+include "blankdb_oo.inc";
+
+class class24 {
+ function __construct() {
+ echo __METHOD__ . "\n";
+ }
+}
+
+$data = array(
+ "one",
+ "two",
+ "three"
+ );
+
+$db->query("CREATE TABLE strings(a)");
+
+foreach ($data as $str) {
+ $db->query("INSERT INTO strings VALUES('$str')");
+}
+
+echo "====stdclass====\n";
+$res = $db->query("SELECT a FROM strings", SQLITE_ASSOC);
+while ($res->has_more()) {
+ var_dump($res->fetch_object('class24'));
+}
+
+echo "====class24!====\n";
+$res = $db->query("SELECT a FROM strings", SQLITE_ASSOC);
+while ($res->has_more()) {
+ var_dump($res->fetch_object());
+}
+
+echo "====DONE!====\n";
+?>
+--EXPECTF--
+====stdclass====
+class24::__construct
+object(class24)#%d (1) {
+ ["a"]=>
+ string(3) "one"
+}
+class24::__construct
+object(class24)#%d (1) {
+ ["a"]=>
+ string(3) "two"
+}
+class24::__construct
+object(class24)#%d (1) {
+ ["a"]=>
+ string(5) "three"
+}
+====class24!====
+object(stdClass)#%d (1) {
+ ["a"]=>
+ string(3) "one"
+}
+object(stdClass)#%d (1) {
+ ["a"]=>
+ string(3) "two"
+}
+object(stdClass)#%d (1) {
+ ["a"]=>
+ string(5) "three"
+}
+====DONE!====