summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntony Dovgal <tony2001@php.net>2006-12-22 13:30:10 +0000
committerAntony Dovgal <tony2001@php.net>2006-12-22 13:30:10 +0000
commita7faaa1b144fe1aa0fb349f184dc5532b87e5d6a (patch)
tree1250ed0456d9b6854e7dd19d64bdf64e1d908c02
parentfb18a8e7602a9a7277246e753f2ee0b423a9cb2f (diff)
downloadphp-git-a7faaa1b144fe1aa0fb349f184dc5532b87e5d6a.tar.gz
new tests
-rw-r--r--ext/oci8/tests/coll_018.phpt93
-rw-r--r--ext/oci8/tests/error2.phpt24
-rw-r--r--ext/oci8/tests/lob_036.phpt40
-rw-r--r--ext/oci8/tests/statement_type.phpt32
4 files changed, 173 insertions, 16 deletions
diff --git a/ext/oci8/tests/coll_018.phpt b/ext/oci8/tests/coll_018.phpt
new file mode 100644
index 0000000000..f97cc49e7c
--- /dev/null
+++ b/ext/oci8/tests/coll_018.phpt
@@ -0,0 +1,93 @@
+--TEST--
+Collection trim tests
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+require dirname(__FILE__)."/create_type.inc";
+
+$coll1 = oci_new_collection($c, $type_name);
+
+echo "Test 1.\n";
+var_dump($coll1->trim());
+
+echo "\nTest 2.\n";
+var_dump($coll1->trim(0));
+
+echo "\nTest 3.\n";
+var_dump($coll1->append(1));
+var_dump($coll1->append(2));
+var_dump($coll1->append(3));
+var_dump($coll1->append(4));
+
+var_dump($coll1->getElem(-1)); // check before the beginning
+var_dump($coll1->getElem(0));
+var_dump($coll1->getElem(1));
+var_dump($coll1->getElem(2));
+var_dump($coll1->getElem(3));
+var_dump($coll1->getElem(4)); // check past the end
+
+echo "\nTest 4.\n";
+var_dump($coll1->trim(1));
+var_dump($coll1->getElem(2)); // this should be the last element
+var_dump($coll1->getElem(3)); // this element should have gone
+
+echo "\nTest 5.\n";
+var_dump($coll1->trim(2));
+var_dump($coll1->getElem(0)); // this should be the last element
+var_dump($coll1->getElem(1)); // this element should have gone
+
+echo "\nTest 6.\n";
+var_dump($coll1->trim(0));
+var_dump($coll1->getElem(0)); // this should still be the last element
+
+echo "\nTest 7.\n";
+var_dump($coll1->trim(1));
+var_dump($coll1->getElem(0)); // this should have gone
+
+echo "Done\n";
+
+require dirname(__FILE__)."/drop_type.inc";
+
+?>
+--EXPECTF--
+Test 1.
+
+Warning: OCI-Collection::trim() expects exactly 1 parameter, 0 given in %s on line 9
+NULL
+
+Test 2.
+bool(true)
+
+Test 3.
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(false)
+float(1)
+float(2)
+float(3)
+float(4)
+bool(false)
+
+Test 4.
+bool(true)
+float(3)
+bool(false)
+
+Test 5.
+bool(true)
+float(1)
+bool(false)
+
+Test 6.
+bool(true)
+float(1)
+
+Test 7.
+bool(true)
+bool(false)
+Done
diff --git a/ext/oci8/tests/error2.phpt b/ext/oci8/tests/error2.phpt
new file mode 100644
index 0000000000..13ea6cebe2
--- /dev/null
+++ b/ext/oci8/tests/error2.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Exercise error code for SUCCESS_WITH_INFO
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+
+ini_set('error_reporting', E_ALL);
+
+$s = oci_parse($c, "create or replace procedure myproc as begin bogus end;");
+$e = @oci_execute($s);
+if (!$e) {
+ $es = oci_error($s);
+ echo $es['message']."\n";
+}
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+ORA-24344: success with compilation error
+Done
diff --git a/ext/oci8/tests/lob_036.phpt b/ext/oci8/tests/lob_036.phpt
new file mode 100644
index 0000000000..e72c1cf081
--- /dev/null
+++ b/ext/oci8/tests/lob_036.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Exercise cleanup code when LOB buffering is on
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+require dirname(__FILE__).'/create_table.inc';
+
+$ora_sql = "INSERT INTO
+ ".$schema.$table_name." (blob)
+ VALUES (empty_blob())
+ RETURNING
+ blob
+ INTO :v_blob ";
+
+$s = oci_parse($c,$ora_sql);
+$blob = oci_new_descriptor($c,OCI_DTYPE_LOB);
+
+
+oci_bind_by_name($s,":v_blob", $blob,-1,OCI_B_BLOB);
+oci_execute($s, OCI_DEFAULT);
+
+var_dump($blob->write("test"));
+var_dump($blob->setBuffering(true));
+var_dump($blob->write("test"));
+
+$blob = null;
+
+require dirname(__FILE__).'/drop_table.inc';
+
+echo "Done\n";
+
+?>
+--EXPECT--
+int(4)
+bool(true)
+int(4)
+Done
diff --git a/ext/oci8/tests/statement_type.phpt b/ext/oci8/tests/statement_type.phpt
index 45221a6c77..eedd2c4385 100644
--- a/ext/oci8/tests/statement_type.phpt
+++ b/ext/oci8/tests/statement_type.phpt
@@ -7,22 +7,19 @@ oci_statement_type()
require dirname(__FILE__)."/connect.inc";
-if (!empty($dbase)) {
- var_dump($c = oci_connect($user, $password, $dbase));
-}
-else {
- var_dump($c = oci_connect($user, $password));
-}
-
$sqls = Array(
- "SELECT * FROM table",
- "DELETE FROM table WHERE id = 1",
- "INSERT INTO table VALUES(1)",
- "UPDATE table SET id = 1",
- "DROP TABLE table",
- "CREATE TABLE table (id NUMBER)",
- "WRONG SYNTAX",
- ""
+ "SELECT * FROM table",
+ "DELETE FROM table WHERE id = 1",
+ "INSERT INTO table VALUES(1)",
+ "UPDATE table SET id = 1",
+ "DROP TABLE table",
+ "CREATE TABLE table (id NUMBER)",
+ "ALTER TABLE table ADD (col1 NUMBER)",
+ "BEGIN NULL; END;",
+ "DECLARE myn NUMBER BEGIN myn := 1; END;",
+ "CALL myproc(1)",
+ "WRONG SYNTAX",
+ ""
);
foreach ($sqls as $sql) {
@@ -34,13 +31,16 @@ echo "Done\n";
?>
--EXPECTF--
-resource(%d) of type (oci8 connection)
string(6) "SELECT"
string(6) "DELETE"
string(6) "INSERT"
string(6) "UPDATE"
string(4) "DROP"
string(6) "CREATE"
+string(5) "ALTER"
+string(5) "BEGIN"
+string(7) "DECLARE"
+string(4) "CALL"
string(7) "UNKNOWN"
string(7) "UNKNOWN"
Done