]> granicus.if.org Git - php/commitdiff
more test improvements by Chris Jones
authorAntony Dovgal <tony2001@php.net>
Wed, 27 Dec 2006 09:48:05 +0000 (09:48 +0000)
committerAntony Dovgal <tony2001@php.net>
Wed, 27 Dec 2006 09:48:05 +0000 (09:48 +0000)
ext/oci8/tests/details.inc
ext/oci8/tests/function_aliases.phpt [new file with mode: 0644]
ext/oci8/tests/lob_aliases.phpt [new file with mode: 0644]
ext/oci8/tests/num.phpt
ext/oci8/tests/statement_type.phpt
ext/oci8/tests/statement_type_old.phpt

index 6cf13ac72c56ffa758fa68eb2dbed42c337e84fd..80f5bf8e4de66fcb358a5d76c3ac362a6136ad36 100644 (file)
@@ -7,7 +7,7 @@
 
 $user       = "system";
 $password   = "system";
-$dbase      = "oracle";
+$dbase      = "HP";
 
 /* Set this variable to TRUE if Oracle is installed @ localhost */
 
diff --git a/ext/oci8/tests/function_aliases.phpt b/ext/oci8/tests/function_aliases.phpt
new file mode 100644 (file)
index 0000000..4c6ce83
--- /dev/null
@@ -0,0 +1,198 @@
+--TEST--
+Existence of old function aliases
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+var_dump(oci_free_cursor());
+var_dump(ocifreecursor());
+var_dump(ocibindbyname());
+var_dump(ocidefinebyname());
+var_dump(ocicolumnisnull());
+var_dump(ocicolumnname());
+var_dump(ocicolumnsize());
+var_dump(ocicolumnscale());
+var_dump(ocicolumnprecision());
+var_dump(ocicolumntype());
+var_dump(ocicolumntyperaw());
+var_dump(ociexecute());
+var_dump(ocicancel());
+var_dump(ocifetch());
+var_dump(ocifetchstatement());
+var_dump(ocifreestatement());
+var_dump(ociinternaldebug());
+var_dump(ocinumcols());
+var_dump(ociparse());
+var_dump(ocinewcursor());
+var_dump(ociresult());
+var_dump(ociserverversion());
+var_dump(ocistatementtype());
+var_dump(ocirowcount());
+var_dump(ocilogoff());
+var_dump(ocilogon());
+var_dump(ocinlogon());
+var_dump(ociplogon());
+var_dump(ocierror());
+var_dump(ocifreedesc());
+var_dump(ocisavelob());
+var_dump(ocisavelobfile());
+var_dump(ociwritelobtofile());
+var_dump(ociloadlob());
+var_dump(ocicommit());
+var_dump(ocirollback());
+var_dump(ocinewdescriptor());
+var_dump(ocisetprefetch());
+var_dump(ocipasswordchange());
+var_dump(ocifreecollection());
+var_dump(ocinewcollection());
+var_dump(ocicollappend());
+var_dump(ocicollgetelem());
+var_dump(ocicollassignelem());
+var_dump(ocicollsize());
+var_dump(ocicollmax());
+var_dump(ocicolltrim());
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+Warning: oci_free_cursor() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: ocifreecursor() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: ocibindbyname() expects at least 3 parameters, 0 given in %s on line %d
+NULL
+
+Warning: ocidefinebyname() expects at least 3 parameters, 0 given in %s on line %d
+NULL
+
+Warning: ocicolumnisnull() expects exactly 2 parameters, 0 given in %s on line %d
+bool(false)
+
+Warning: ocicolumnname() expects exactly 2 parameters, 0 given in %s on line %d
+bool(false)
+
+Warning: ocicolumnsize() expects exactly 2 parameters, 0 given in %s on line %d
+bool(false)
+
+Warning: ocicolumnscale() expects exactly 2 parameters, 0 given in %s on line %d
+bool(false)
+
+Warning: ocicolumnprecision() expects exactly 2 parameters, 0 given in %s on line %d
+bool(false)
+
+Warning: ocicolumntype() expects exactly 2 parameters, 0 given in %s on line %d
+bool(false)
+
+Warning: ocicolumntyperaw() expects exactly 2 parameters, 0 given in %s on line %d
+bool(false)
+
+Warning: ociexecute() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: ocicancel() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: ocifetch() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: ocifetchstatement() expects at least 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: ocifreestatement() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: ociinternaldebug() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: ocinumcols() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: ociparse() expects exactly 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: ocinewcursor() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: ociresult() expects exactly 2 parameters, 0 given in %s on line %d
+bool(false)
+
+Warning: ociserverversion() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: ocistatementtype() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: ocirowcount() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: ocilogoff() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: ocilogon() expects at least 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: ocinlogon() expects at least 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: ociplogon() expects at least 2 parameters, 0 given in %s on line %d
+NULL
+bool(false)
+
+Warning: ocifreedesc() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: ocisavelob() expects at least 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: ocisavelobfile() expects exactly 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: ociwritelobtofile() expects at least 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: ociloadlob() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: ocicommit() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: ocirollback() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: ocinewdescriptor() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: ocisetprefetch() expects exactly 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: Wrong parameter count for ocipasswordchange() in %s on line %d
+NULL
+
+Warning: ocifreecollection() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: ocinewcollection() expects at least 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: ocicollappend() expects exactly 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: ocicollgetelem() expects exactly 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: ocicollassignelem() expects exactly 3 parameters, 0 given in %s on line %d
+NULL
+
+Warning: ocicollsize() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: ocicollmax() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: ocicolltrim() expects exactly 2 parameters, 0 given in %s on line %d
+NULL
+Done
diff --git a/ext/oci8/tests/lob_aliases.phpt b/ext/oci8/tests/lob_aliases.phpt
new file mode 100644 (file)
index 0000000..faa59bf
--- /dev/null
@@ -0,0 +1,99 @@
+--TEST--
+LOB method aliases
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+// Function existence
+echo "Test 1\n";
+var_dump(oci_lob_load());
+var_dump(oci_lob_tell());
+var_dump(oci_lob_truncate());
+var_dump(oci_lob_erase());
+var_dump(oci_lob_flush());
+var_dump(ocisetbufferinglob());
+var_dump(ocigetbufferinglob());
+var_dump(oci_lob_rewind());
+var_dump(oci_lob_read());
+var_dump(oci_lob_eof());
+var_dump(oci_lob_seek());
+var_dump(oci_lob_write());
+var_dump(oci_lob_append());
+var_dump(oci_lob_size());
+var_dump(oci_lob_export());
+var_dump(oci_lob_export());
+var_dump(oci_lob_import());
+// No PHP_FE for oci_lob_write_temporary() or oci_lob_close()
+//var_dump(oci_lob_write_temporary());
+//var_dump(oci_lob_close());
+var_dump(oci_lob_save());
+var_dump(oci_lob_import());
+var_dump(oci_free_descriptor());
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+Test 1
+
+Warning: oci_lob_load() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: oci_lob_tell() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: oci_lob_truncate() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: oci_lob_erase() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: oci_lob_flush() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: ocisetbufferinglob() expects exactly 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: ocigetbufferinglob() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: oci_lob_rewind() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: oci_lob_read() expects exactly 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: oci_lob_eof() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: oci_lob_seek() expects at least 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: oci_lob_write() expects at least 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: oci_lob_append() expects exactly 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: oci_lob_size() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: oci_lob_export() expects at least 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: oci_lob_export() expects at least 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: oci_lob_import() expects exactly 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: oci_lob_save() expects at least 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: oci_lob_import() expects exactly 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: oci_free_descriptor() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+Done
index 3c333b4e3aaed202d78b59cdca8f3f0dde6af605..458e3774f5da2402c8cc1157bc8a1f5d3de22ae4 100644 (file)
@@ -8,32 +8,117 @@ oci_num_*() family
 require dirname(__FILE__)."/connect.inc";
 require dirname(__FILE__).'/create_table.inc';
 
+echo "Test 1\n";
+var_dump(ocirowcount());
+var_dump(oci_num_rows());
+var_dump(ocinumcols());
+var_dump(oci_num_fields());
+
 $insert_sql = "INSERT INTO ".$schema.$table_name." (id, value) VALUES (1,1)";
 
 if (!($s = oci_parse($c, $insert_sql))) {
-       die("oci_parse(insert) failed!\n");
+  die("oci_parse(insert) failed!\n");
 }
 
+echo "Test 2\n";
+var_dump(ocirowcount($s));
+var_dump(oci_num_rows($s));
+var_dump(ocinumcols($s));
+var_dump(oci_num_fields($s));
+
 for ($i = 0; $i<3; $i++) {
-       if (!oci_execute($s)) {
-               die("oci_execute(insert) failed!\n");
-       }
+  if (!oci_execute($s)) {
+    die("oci_execute(insert) failed!\n");
+  }
 }
 
+echo "Test 3\n";
+var_dump(ocirowcount($s));
+var_dump(oci_num_rows($s));
+var_dump(ocinumcols($s));
+var_dump(oci_num_fields($s));
+
 if (!oci_commit($c)) {
-       die("oci_commit() failed!\n");
+  die("oci_commit() failed!\n");
 }
 
+echo "Test 4\n";
+var_dump(ocirowcount($s));
+var_dump(oci_num_rows($s));
+var_dump(ocinumcols($s));
+var_dump(oci_num_fields($s));
+
+// All rows
 $select_sql = "SELECT * FROM ".$schema.$table_name."";
 
 if (!($s = oci_parse($c, $select_sql))) {
-       die("oci_parse(select) failed!\n");
+  die("oci_parse(select) failed!\n");
+}
+
+echo "Test 5a\n";
+var_dump(ocirowcount($s));
+var_dump(oci_num_rows($s));
+var_dump(ocinumcols($s));
+var_dump(oci_num_fields($s));
+
+if (!oci_execute($s)) {
+  die("oci_execute(select) failed!\n");
+}
+
+echo "Test 5b\n";
+var_dump(ocirowcount($s));
+var_dump(oci_num_rows($s));
+var_dump(ocinumcols($s));
+var_dump(oci_num_fields($s));
+
+
+if (oci_fetch_all($s,$r) === false) {
+  die("oci_fetch_all(select) failed!\n");
+}
+
+echo "Test 5c\n";
+var_dump(ocirowcount($s));
+var_dump(oci_num_rows($s));
+var_dump(ocinumcols($s));
+var_dump(oci_num_fields($s));
+
+// One row
+$select_sql = "SELECT id, value FROM ".$schema.$table_name." WHERE ROWNUM < 2";
+
+if (!($s = oci_parse($c, $select_sql))) {
+  die("oci_parse(select) failed!\n");
+}
+
+if (!oci_execute($s)) {
+  die("oci_execute(select) failed!\n");
+}
+
+if (oci_fetch_all($s,$r) === false) {
+  die("oci_fetch_all(select) failed!\n");
+}
+
+echo "Test 6\n";
+var_dump(ocirowcount($s));
+var_dump(oci_num_rows($s));
+var_dump(ocinumcols($s));
+var_dump(oci_num_fields($s));
+
+// No rows
+$select_sql = "SELECT id FROM ".$schema.$table_name." WHERE 1=0";
+
+if (!($s = oci_parse($c, $select_sql))) {
+  die("oci_parse(select) failed!\n");
 }
 
 if (!oci_execute($s)) {
-       die("oci_execute(select) failed!\n");
+  die("oci_execute(select) failed!\n");
+}
+
+if (oci_fetch_all($s,$r) === false) {
+  die("oci_fetch_all(select) failed!\n");
 }
 
+echo "Test 7\n";
 var_dump(ocirowcount($s));
 var_dump(oci_num_rows($s));
 var_dump(ocinumcols($s));
@@ -48,19 +133,89 @@ if (!($s = oci_parse($c, $delete_sql))) {
 if (!oci_execute($s)) {
     die("oci_execute(delete) failed!\n");
 }
+
+echo "Test 8a\n";
+var_dump(ocirowcount($s));
+var_dump(oci_num_rows($s));
+var_dump(ocinumcols($s));
+var_dump(oci_num_fields($s));
+
+
 oci_commit($c);
 
+echo "Test 8b\n";
+var_dump(ocirowcount($s));
 var_dump(oci_num_rows($s));
+var_dump(ocinumcols($s));
+var_dump(oci_num_fields($s));
 
 require dirname(__FILE__).'/drop_table.inc';
 
 echo "Done\n";
 
 ?>
---EXPECT--
+--EXPECTF--
+Test 1
+
+Warning: ocirowcount() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: oci_num_rows() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: ocinumcols() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: oci_num_fields() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+Test 2
+int(0)
 int(0)
 int(0)
+int(0)
+Test 3
+int(1)
+int(1)
+int(0)
+int(0)
+Test 4
+int(1)
+int(1)
+int(0)
+int(0)
+Test 5a
+int(0)
+int(0)
+int(0)
+int(0)
+Test 5b
+int(0)
+int(0)
+int(5)
+int(5)
+Test 5c
+int(3)
+int(3)
 int(5)
 int(5)
+Test 6
+int(1)
+int(1)
+int(2)
+int(2)
+Test 7
+int(0)
+int(0)
+int(1)
+int(1)
+Test 8a
+int(3)
 int(3)
+int(0)
+int(0)
+Test 8b
+int(3)
+int(3)
+int(0)
+int(0)
 Done
index 78e6570dc9abd2c0ef2098928a244aa917b81466..5964ac8cd877324d60e44e97b18aaa055aaba253 100644 (file)
@@ -12,7 +12,8 @@ $sqls = Array(
     "DELETE FROM table WHERE id = 1",
     "INSERT INTO table VALUES(1)",
     "UPDATE table SET id = 1",
-    "DROP TABLE table",
+       "DROP TABLE table",
+       "CREATE OR REPLACE PROCEDURE myproc(v1 NUMBER) as BEGIN DBMS_OUTPUT.PUT_LINE(v1); END;",
     "CREATE TABLE table (id NUMBER)",
     "ALTER TABLE table ADD (col1 NUMBER)",
     "BEGIN NULL; END;",
@@ -37,6 +38,7 @@ string(6) "INSERT"
 string(6) "UPDATE"
 string(4) "DROP"
 string(6) "CREATE"
+string(6) "CREATE"
 string(5) "ALTER"
 string(5) "BEGIN"
 string(7) "DECLARE"
@@ -51,6 +53,7 @@ unicode(6) "INSERT"
 unicode(6) "UPDATE"
 unicode(4) "DROP"
 unicode(6) "CREATE"
+unicode(6) "CREATE"
 unicode(5) "ALTER"
 unicode(5) "BEGIN"
 unicode(7) "DECLARE"
index b594d3543e10b74feaacaefafcff797d3def3364..03edc97f829bbe1e830265ec16126bc11f115aae 100644 (file)
@@ -15,14 +15,19 @@ else {
 }
 
 $sqls = Array(
-       "SELECT * FROM table",
-       "DELETE FROM table WHERE id = 1",
-       "INSERT INTO table VALUES(1)",
-       "UPDATE table SET id = 1",
+    "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",
-       ""
+       "CREATE OR REPLACE PROCEDURE myproc(v1 NUMBER) as BEGIN DBMS_OUTPUT.PUT_LINE(v1); END;",
+    "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) {
@@ -41,6 +46,11 @@ string(6) "INSERT"
 string(6) "UPDATE"
 string(4) "DROP"
 string(6) "CREATE"
+string(6) "CREATE"
+string(5) "ALTER"
+string(5) "BEGIN"
+string(7) "DECLARE"
+string(4) "CALL"
 string(7) "UNKNOWN"
 string(7) "UNKNOWN"
 Done
@@ -52,6 +62,11 @@ unicode(6) "INSERT"
 unicode(6) "UPDATE"
 unicode(4) "DROP"
 unicode(6) "CREATE"
+unicode(6) "CREATE"
+unicode(5) "ALTER"
+unicode(5) "BEGIN"
+unicode(7) "DECLARE"
+unicode(4) "CALL"
 unicode(7) "UNKNOWN"
 unicode(7) "UNKNOWN"
 Done