diff options
Diffstat (limited to 'ext/sqlite/tests')
-rw-r--r-- | ext/sqlite/tests/blankdb.inc | 11 | ||||
-rwxr-xr-x | ext/sqlite/tests/sqlite_001.phpt | 17 | ||||
-rwxr-xr-x | ext/sqlite/tests/sqlite_002.phpt | 31 | ||||
-rwxr-xr-x | ext/sqlite/tests/sqlite_003.phpt | 51 | ||||
-rw-r--r-- | ext/sqlite/tests/sqlite_004.phpt | 46 | ||||
-rw-r--r-- | ext/sqlite/tests/sqlite_005.phpt | 47 | ||||
-rw-r--r-- | ext/sqlite/tests/sqlite_006.phpt | 52 | ||||
-rwxr-xr-x | ext/sqlite/tests/sqlite_007.phpt | 51 | ||||
-rwxr-xr-x | ext/sqlite/tests/sqlite_008.phpt | 43 | ||||
-rwxr-xr-x | ext/sqlite/tests/sqlite_009.phpt | 43 | ||||
-rwxr-xr-x | ext/sqlite/tests/sqlite_010.phpt | 78 | ||||
-rwxr-xr-x | ext/sqlite/tests/sqlite_011.phpt | 27 | ||||
-rwxr-xr-x | ext/sqlite/tests/sqlite_012.phpt | 35 |
13 files changed, 0 insertions, 532 deletions
diff --git a/ext/sqlite/tests/blankdb.inc b/ext/sqlite/tests/blankdb.inc deleted file mode 100644 index 085d3b2b51..0000000000 --- a/ext/sqlite/tests/blankdb.inc +++ /dev/null @@ -1,11 +0,0 @@ -<?php #vim:ft=php -$dbname = tempnam(dirname(__FILE__), "phpsql"); -function cleanup() { - if ($GLOBALS['db']) { - sqlite_close($GLOBALS['db']); - } - unlink($GLOBALS['dbname']); -} -register_shutdown_function("cleanup"); -$db = sqlite_open($dbname); -?> diff --git a/ext/sqlite/tests/sqlite_001.phpt b/ext/sqlite/tests/sqlite_001.phpt deleted file mode 100755 index 70059a3e59..0000000000 --- a/ext/sqlite/tests/sqlite_001.phpt +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -sqlite: sqlite_open/close ---INI-- -sqlite.assoc_case=0 ---SKIPIF-- -<?php if (!extension_loaded("sqlite")) print "skip"; ?> ---FILE-- -<?php -require_once('blankdb.inc'); -echo "$db\n"; -sqlite_close($db); -$db = NULL; -echo "Done\n"; -?> ---EXPECTF-- -Resource id #%d -Done diff --git a/ext/sqlite/tests/sqlite_002.phpt b/ext/sqlite/tests/sqlite_002.phpt deleted file mode 100755 index d76b61687d..0000000000 --- a/ext/sqlite/tests/sqlite_002.phpt +++ /dev/null @@ -1,31 +0,0 @@ ---TEST-- -sqlite: Simple insert/select ---INI-- -sqlite.assoc_case=0 ---SKIPIF-- -<?php # vim:ft=php -if (!extension_loaded("sqlite")) print "skip"; ?> ---FILE-- -<?php -include "blankdb.inc"; - -sqlite_query("CREATE TABLE foo(c1 date, c2 time, c3 varchar(64))", $db); -sqlite_query("INSERT INTO foo VALUES ('2002-01-02', '12:49:00', NULL)", $db); -$r = sqlite_query("SELECT * from foo", $db); -var_dump(sqlite_fetch_array($r)); -?> ---EXPECT-- -array(6) { - [0]=> - string(10) "2002-01-02" - ["c1"]=> - string(10) "2002-01-02" - [1]=> - string(8) "12:49:00" - ["c2"]=> - string(8) "12:49:00" - [2]=> - NULL - ["c3"]=> - NULL -} diff --git a/ext/sqlite/tests/sqlite_003.phpt b/ext/sqlite/tests/sqlite_003.phpt deleted file mode 100755 index 3e6cb3f04e..0000000000 --- a/ext/sqlite/tests/sqlite_003.phpt +++ /dev/null @@ -1,51 +0,0 @@ ---TEST-- -sqlite: Simple insert/select, different result represenatation ---INI-- -sqlite.assoc_case=0 ---SKIPIF-- -<?php -if (!extension_loaded("sqlite")) print "skip"; ?> ---FILE-- -<?php -include "blankdb.inc"; - -sqlite_query("CREATE TABLE foo(c1 date, c2 time, c3 varchar(64))", $db); -sqlite_query("INSERT INTO foo VALUES ('2002-01-02', '12:49:00', NULL)", $db); -$r = sqlite_query("SELECT * from foo", $db); -var_dump(sqlite_fetch_array($r, SQLITE_BOTH)); -$r = sqlite_query("SELECT * from foo", $db); -var_dump(sqlite_fetch_array($r, SQLITE_NUM)); -$r = sqlite_query("SELECT * from foo", $db); -var_dump(sqlite_fetch_array($r, SQLITE_ASSOC)); -?> ---EXPECT-- -array(6) { - [0]=> - string(10) "2002-01-02" - ["c1"]=> - string(10) "2002-01-02" - [1]=> - string(8) "12:49:00" - ["c2"]=> - string(8) "12:49:00" - [2]=> - NULL - ["c3"]=> - NULL -} -array(3) { - [0]=> - string(10) "2002-01-02" - [1]=> - string(8) "12:49:00" - [2]=> - NULL -} -array(3) { - ["c1"]=> - string(10) "2002-01-02" - ["c2"]=> - string(8) "12:49:00" - ["c3"]=> - NULL -} diff --git a/ext/sqlite/tests/sqlite_004.phpt b/ext/sqlite/tests/sqlite_004.phpt deleted file mode 100644 index 4005fc9030..0000000000 --- a/ext/sqlite/tests/sqlite_004.phpt +++ /dev/null @@ -1,46 +0,0 @@ ---TEST-- -sqlite: binary encoding ---INI-- -sqlite.assoc_case=0 ---SKIPIF-- -<?php # vim:ft=php -if (!extension_loaded("sqlite")) print "skip"; ?> ---FILE-- -<?php -include "blankdb.inc"; - -$strings = array( - "hello", - "hello\x01o", - "\x01hello there", - "hello\x00there", - "" -); - -sqlite_query("CREATE TABLE strings(a)", $db); - -foreach ($strings as $str) { - sqlite_query("INSERT INTO strings VALUES('" . sqlite_escape_string($str) . "')", $db); -} - -$i = 0; -$r = sqlite_query("SELECT * from strings", $db); -while ($row = sqlite_fetch_array($r, SQLITE_NUM)) { - if ($row[0] !== $strings[$i]) { - echo "FAIL!\n"; - var_dump($row[0]); - var_dump($strings[$i]); - } else { - echo "OK!\n"; - } - $i++; -} -echo "DONE!\n"; -?> ---EXPECT-- -OK! -OK! -OK! -OK! -OK! -DONE! diff --git a/ext/sqlite/tests/sqlite_005.phpt b/ext/sqlite/tests/sqlite_005.phpt deleted file mode 100644 index 70a8232630..0000000000 --- a/ext/sqlite/tests/sqlite_005.phpt +++ /dev/null @@ -1,47 +0,0 @@ ---TEST-- -sqlite: aggregate functions ---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)", $db); - -foreach ($data as $str) { - sqlite_query("INSERT INTO strings VALUES('" . sqlite_escape_string($str) . "')", $db); -} - -function cat_step(&$context, $string) -{ - $context .= $string; -} - -function cat_fin(&$context) -{ - return $context; -} - -sqlite_create_aggregate($db, "cat", "cat_step", "cat_fin"); - -$r = sqlite_query("SELECT cat(a) from strings", $db); -while ($row = sqlite_fetch_array($r, SQLITE_NUM)) { - var_dump($row); -} -echo "DONE!\n"; -?> ---EXPECT-- -array(1) { - [0]=> - string(11) "onetwothree" -} -DONE! diff --git a/ext/sqlite/tests/sqlite_006.phpt b/ext/sqlite/tests/sqlite_006.phpt deleted file mode 100644 index b839a6e5c6..0000000000 --- a/ext/sqlite/tests/sqlite_006.phpt +++ /dev/null @@ -1,52 +0,0 @@ ---TEST-- -sqlite: regular functions ---INI-- -sqlite.assoc_case=0 ---SKIPIF-- -<?php # vim:ft=php -if (!extension_loaded("sqlite")) print "skip"; ?> ---FILE-- -<?php -include "blankdb.inc"; - -$data = array( - array("one", "uno"), - array("two", "dos"), - array("three", "tres"), - ); - -sqlite_query("CREATE TABLE strings(a,b)", $db); - -function implode_args() -{ - $args = func_get_args(); - $sep = array_shift($args); - return implode($sep, $args); -} - -foreach ($data as $row) { - sqlite_query("INSERT INTO strings VALUES('" . sqlite_escape_string($row[0]) . "','" . sqlite_escape_string($row[1]) . "')", $db); -} - -sqlite_create_function($db, "implode", "implode_args"); - -$r = sqlite_query("SELECT implode('-', a, b) from strings", $db); -while ($row = sqlite_fetch_array($r, SQLITE_NUM)) { - var_dump($row); -} -echo "DONE!\n"; -?> ---EXPECT-- -array(1) { - [0]=> - string(7) "one-uno" -} -array(1) { - [0]=> - string(7) "two-dos" -} -array(1) { - [0]=> - string(10) "three-tres" -} -DONE! diff --git a/ext/sqlite/tests/sqlite_007.phpt b/ext/sqlite/tests/sqlite_007.phpt deleted file mode 100755 index c68e165a0c..0000000000 --- a/ext/sqlite/tests/sqlite_007.phpt +++ /dev/null @@ -1,51 +0,0 @@ ---TEST-- -sqlite: Simple insert/select (unbuffered) ---INI-- -sqlite.assoc_case=0 ---SKIPIF-- -<?php -if (!extension_loaded("sqlite")) print "skip"; ?> ---FILE-- -<?php -include "blankdb.inc"; - -sqlite_query("CREATE TABLE foo(c1 date, c2 time, c3 varchar(64))", $db); -sqlite_query("INSERT INTO foo VALUES ('2002-01-02', '12:49:00', NULL)", $db); -$r = sqlite_unbuffered_query("SELECT * from foo", $db); -var_dump(sqlite_fetch_array($r, SQLITE_BOTH)); -$r = sqlite_unbuffered_query("SELECT * from foo", $db); -var_dump(sqlite_fetch_array($r, SQLITE_NUM)); -$r = sqlite_unbuffered_query("SELECT * from foo", $db); -var_dump(sqlite_fetch_array($r, SQLITE_ASSOC)); -?> ---EXPECT-- -array(6) { - [0]=> - string(10) "2002-01-02" - ["c1"]=> - string(10) "2002-01-02" - [1]=> - string(8) "12:49:00" - ["c2"]=> - string(8) "12:49:00" - [2]=> - NULL - ["c3"]=> - NULL -} -array(3) { - [0]=> - string(10) "2002-01-02" - [1]=> - string(8) "12:49:00" - [2]=> - NULL -} -array(3) { - ["c1"]=> - string(10) "2002-01-02" - ["c2"]=> - string(8) "12:49:00" - ["c3"]=> - NULL -} diff --git a/ext/sqlite/tests/sqlite_008.phpt b/ext/sqlite/tests/sqlite_008.phpt deleted file mode 100755 index 5886e8f73a..0000000000 --- a/ext/sqlite/tests/sqlite_008.phpt +++ /dev/null @@ -1,43 +0,0 @@ ---TEST-- -sqlite: fetch all (buffered) ---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); -} - -$r = sqlite_query("SELECT a from strings", $db); -while ($row = sqlite_fetch_array($r, SQLITE_NUM)) { - var_dump($row); -} -echo "DONE!\n"; -?> ---EXPECT-- -array(1) { - [0]=> - string(3) "one" -} -array(1) { - [0]=> - string(3) "two" -} -array(1) { - [0]=> - string(5) "three" -} -DONE! diff --git a/ext/sqlite/tests/sqlite_009.phpt b/ext/sqlite/tests/sqlite_009.phpt deleted file mode 100755 index 990b6c68f3..0000000000 --- a/ext/sqlite/tests/sqlite_009.phpt +++ /dev/null @@ -1,43 +0,0 @@ ---TEST-- -sqlite: fetch all (unbuffered) ---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); -} - -$r = sqlite_unbuffered_query("SELECT a from strings", $db); -while ($row = sqlite_fetch_array($r, SQLITE_NUM)) { - var_dump($row); -} -echo "DONE!\n"; -?> ---EXPECT-- -array(1) { - [0]=> - string(3) "one" -} -array(1) { - [0]=> - string(3) "two" -} -array(1) { - [0]=> - string(5) "three" -} -DONE! diff --git a/ext/sqlite/tests/sqlite_010.phpt b/ext/sqlite/tests/sqlite_010.phpt deleted file mode 100755 index 3715747072..0000000000 --- a/ext/sqlite/tests/sqlite_010.phpt +++ /dev/null @@ -1,78 +0,0 @@ ---TEST-- -sqlite: fetch all (iterator) ---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); -} - -$r = sqlite_unbuffered_query("SELECT a from strings", $db); -while (sqlite_has_more($r)) { - var_dump(sqlite_current($r, SQLITE_NUM)); - sqlite_next($r); -} -$r = sqlite_query("SELECT a from strings", $db); -while (sqlite_has_more($r)) { - var_dump(sqlite_current($r, SQLITE_NUM)); - sqlite_next($r); -} -sqlite_rewind($r); -while (sqlite_has_more($r)) { - var_dump(sqlite_current($r, SQLITE_NUM)); - sqlite_next($r); -} -echo "DONE!\n"; -?> ---EXPECT-- -array(1) { - [0]=> - string(3) "one" -} -array(1) { - [0]=> - string(3) "two" -} -array(1) { - [0]=> - string(5) "three" -} -array(1) { - [0]=> - string(3) "one" -} -array(1) { - [0]=> - string(3) "two" -} -array(1) { - [0]=> - string(5) "three" -} -array(1) { - [0]=> - string(3) "one" -} -array(1) { - [0]=> - string(3) "two" -} -array(1) { - [0]=> - string(5) "three" -} -DONE! diff --git a/ext/sqlite/tests/sqlite_011.phpt b/ext/sqlite/tests/sqlite_011.phpt deleted file mode 100755 index 1aa6704249..0000000000 --- a/ext/sqlite/tests/sqlite_011.phpt +++ /dev/null @@ -1,27 +0,0 @@ ---TEST-- -sqlite: returned associative column names ---INI-- -sqlite.assoc_case=0 ---SKIPIF-- -<?php -if (!extension_loaded("sqlite")) print "skip"; ?> ---FILE-- -<?php -include "blankdb.inc"; - -sqlite_query("CREATE TABLE foo (c1 char, c2 char, c3 char)", $db); -sqlite_query("CREATE TABLE bar (c1 char, c2 char, c3 char)", $db); -sqlite_query("INSERT INTO foo VALUES ('1', '2', '3')", $db); -sqlite_query("INSERT INTO bar VALUES ('4', '5', '6')", $db); -$r = sqlite_query("SELECT * from foo, bar", $db, SQLITE_ASSOC); -var_dump(sqlite_fetch_array($r)); -?> ---EXPECT-- -array(3) { - ["c1"]=> - string(1) "4" - ["c2"]=> - string(1) "5" - ["c3"]=> - string(1) "6" -} diff --git a/ext/sqlite/tests/sqlite_012.phpt b/ext/sqlite/tests/sqlite_012.phpt deleted file mode 100755 index 531bf8055b..0000000000 --- a/ext/sqlite/tests/sqlite_012.phpt +++ /dev/null @@ -1,35 +0,0 @@ ---TEST-- -sqlite: read field names ---INI-- -sqlite.assoc_case=0 ---SKIPIF-- -<?php # vim:ft=php -if (!extension_loaded("sqlite")) print "skip"; ?> ---FILE-- -<?php -include "blankdb.inc"; - -sqlite_query("CREATE TABLE strings(foo VARCHAR, bar VARCHAR, baz VARCHAR)", $db); - -echo "Buffered\n"; -$r = sqlite_query("SELECT * from strings", $db); -for($i=0; $i<sqlite_num_fields($r); $i++) { - var_dump(sqlite_field_name($r, $i)); -} -echo "Unbuffered\n"; -$r = sqlite_unbuffered_query("SELECT * from strings", $db); -for($i=0; $i<sqlite_num_fields($r); $i++) { - var_dump(sqlite_field_name($r, $i)); -} -echo "DONE!\n"; -?> ---EXPECT-- -Buffered -string(3) "foo" -string(3) "bar" -string(3) "baz" -Unbuffered -string(3) "foo" -string(3) "bar" -string(3) "baz" -DONE! |