diff options
Diffstat (limited to 'ext/sqlite/tests')
| -rwxr-xr-x | ext/sqlite/tests/sqlite_024.phpt | 74 | ||||
| -rwxr-xr-x | ext/sqlite/tests/sqlite_oo_024.phpt | 74 |
2 files changed, 148 insertions, 0 deletions
diff --git a/ext/sqlite/tests/sqlite_024.phpt b/ext/sqlite/tests/sqlite_024.phpt new file mode 100755 index 0000000000..531b50fead --- /dev/null +++ b/ext/sqlite/tests/sqlite_024.phpt @@ -0,0 +1,74 @@ +--TEST-- +sqlite: sqlite_fetch_object +--INI-- +sqlite.assoc_case=0 +--SKIPIF-- +<?php # vim:ft=php +if (!extension_loaded("sqlite")) print "skip"; ?> +--FILE-- +<?php +include "blankdb.inc"; + +class class24 { + function __construct() { + echo __METHOD__ . "\n"; + } +} + +$data = array( + "one", + "two", + "three" + ); + +sqlite_query($db, "CREATE TABLE strings(a)"); + +foreach ($data as $str) { + sqlite_query($db, "INSERT INTO strings VALUES('$str')"); +} + +echo "====stdclass====\n"; +$res = sqlite_query($db, "SELECT a FROM strings", SQLITE_ASSOC); +while (sqlite_has_more($res)) { + var_dump(sqlite_fetch_object($res, 'class24')); +} + +echo "====class24!====\n"; +$res = sqlite_query($db, "SELECT a FROM strings", SQLITE_ASSOC); +while (sqlite_has_more($res)) { + var_dump(sqlite_fetch_object($res)); +} + +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!==== 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!==== |
