]> granicus.if.org Git - php/commitdiff
Add new OCI8 tests. Refactor skipifs. Sync 5.3/5.4/trunk branches
authorChristopher Jones <sixd@php.net>
Fri, 10 Jun 2011 19:16:35 +0000 (19:16 +0000)
committerChristopher Jones <sixd@php.net>
Fri, 10 Jun 2011 19:16:35 +0000 (19:16 +0000)
266 files changed:
ext/oci8/tests/array_bind_001.phpt
ext/oci8/tests/array_bind_002.phpt
ext/oci8/tests/array_bind_003.phpt
ext/oci8/tests/array_bind_004.phpt
ext/oci8/tests/array_bind_005.phpt
ext/oci8/tests/array_bind_006.phpt
ext/oci8/tests/array_bind_007.phpt
ext/oci8/tests/array_bind_008.phpt
ext/oci8/tests/array_bind_010.phpt
ext/oci8/tests/array_bind_011.phpt
ext/oci8/tests/array_bind_012.phpt
ext/oci8/tests/array_bind_014.phpt
ext/oci8/tests/array_bind_date.phpt
ext/oci8/tests/array_bind_date1.phpt
ext/oci8/tests/array_bind_float.phpt
ext/oci8/tests/array_bind_float1.phpt
ext/oci8/tests/array_bind_int.phpt
ext/oci8/tests/array_bind_int1.phpt
ext/oci8/tests/array_bind_str.phpt
ext/oci8/tests/array_bind_str1.phpt
ext/oci8/tests/b47243_1.phpt
ext/oci8/tests/b47243_2.phpt
ext/oci8/tests/b47243_3.phpt
ext/oci8/tests/bind_char_1.phpt
ext/oci8/tests/bind_char_1_11gR1.phpt
ext/oci8/tests/bind_char_2.phpt
ext/oci8/tests/bind_char_2_11gR1.phpt
ext/oci8/tests/bind_char_3.phpt
ext/oci8/tests/bind_char_3_11gR1.phpt
ext/oci8/tests/bind_char_4.phpt
ext/oci8/tests/bind_char_4_11gR1.phpt
ext/oci8/tests/bind_long.phpt
ext/oci8/tests/bind_long_raw.phpt
ext/oci8/tests/bind_misccoltypes.phpt [new file with mode: 0644]
ext/oci8/tests/bind_misccoltypes_errs.phpt [new file with mode: 0644]
ext/oci8/tests/bind_number.phpt [new file with mode: 0644]
ext/oci8/tests/bind_query.phpt [new file with mode: 0644]
ext/oci8/tests/bind_raw.phpt
ext/oci8/tests/bind_rowid.phpt
ext/oci8/tests/bind_sqltafc.phpt [new file with mode: 0644]
ext/oci8/tests/bind_sqltchr_1.phpt [new file with mode: 0644]
ext/oci8/tests/bind_sqltchr_2.phpt [new file with mode: 0644]
ext/oci8/tests/bind_sqltint.phpt [new file with mode: 0644]
ext/oci8/tests/bind_sqltnum.phpt [new file with mode: 0644]
ext/oci8/tests/bind_unsupported_1.phpt [new file with mode: 0644]
ext/oci8/tests/bind_unsupported_2.phpt [new file with mode: 0644]
ext/oci8/tests/bind_unsupported_3.phpt [new file with mode: 0644]
ext/oci8/tests/bug26133.phpt
ext/oci8/tests/bug27303_1.phpt
ext/oci8/tests/bug27303_1_11gR1.phpt
ext/oci8/tests/bug27303_2.phpt
ext/oci8/tests/bug27303_2_11gR1.phpt
ext/oci8/tests/bug27303_4.phpt
ext/oci8/tests/bug32325.phpt
ext/oci8/tests/bug35973.phpt
ext/oci8/tests/bug36010.phpt
ext/oci8/tests/bug36096.phpt
ext/oci8/tests/bug36403.phpt
ext/oci8/tests/bug37220.phpt
ext/oci8/tests/bug37581.phpt
ext/oci8/tests/bug38173.phpt
ext/oci8/tests/bug40078.phpt
ext/oci8/tests/bug40415.phpt
ext/oci8/tests/bug41069.phpt
ext/oci8/tests/bug42134.phpt
ext/oci8/tests/bug42173.phpt
ext/oci8/tests/bug42496_1.phpt
ext/oci8/tests/bug42496_2.phpt
ext/oci8/tests/bug42841.phpt
ext/oci8/tests/bug43492.phpt
ext/oci8/tests/bug43492_2.phpt
ext/oci8/tests/bug43497.phpt
ext/oci8/tests/bug43497_92.phpt
ext/oci8/tests/bug44008.phpt
ext/oci8/tests/bug44113.phpt
ext/oci8/tests/bug44206.phpt
ext/oci8/tests/bug45458.phpt
ext/oci8/tests/bug46994.phpt
ext/oci8/tests/bug47189.phpt
ext/oci8/tests/bug47281.phpt
ext/oci8/tests/bug47281_tt.phpt [new file with mode: 0644]
ext/oci8/tests/bug51253.phpt
ext/oci8/tests/bug51291_1.phpt [new file with mode: 0644]
ext/oci8/tests/bug51291_2.phpt [new file with mode: 0644]
ext/oci8/tests/coll_001.phpt
ext/oci8/tests/coll_002.phpt
ext/oci8/tests/coll_002_func.phpt
ext/oci8/tests/coll_003.phpt
ext/oci8/tests/coll_003_func.phpt
ext/oci8/tests/coll_004.phpt
ext/oci8/tests/coll_004_func.phpt
ext/oci8/tests/coll_005.phpt
ext/oci8/tests/coll_006.phpt
ext/oci8/tests/coll_006_func.phpt
ext/oci8/tests/coll_007.phpt
ext/oci8/tests/coll_008.phpt
ext/oci8/tests/coll_009.phpt
ext/oci8/tests/coll_009_func.phpt
ext/oci8/tests/coll_010.phpt
ext/oci8/tests/coll_010_func.phpt
ext/oci8/tests/coll_011.phpt
ext/oci8/tests/coll_011_func.phpt
ext/oci8/tests/coll_012.phpt
ext/oci8/tests/coll_012_func.phpt
ext/oci8/tests/coll_013.phpt
ext/oci8/tests/coll_013_func.phpt
ext/oci8/tests/coll_014.phpt
ext/oci8/tests/coll_014_func.phpt
ext/oci8/tests/coll_015.phpt
ext/oci8/tests/coll_015_func.phpt
ext/oci8/tests/coll_016.phpt
ext/oci8/tests/coll_016_func.phpt
ext/oci8/tests/coll_017.phpt
ext/oci8/tests/coll_017_func.phpt
ext/oci8/tests/coll_018.phpt
ext/oci8/tests/coll_019.phpt
ext/oci8/tests/commit_001.phpt
ext/oci8/tests/commit_002.phpt
ext/oci8/tests/commit_old.phpt
ext/oci8/tests/conn_attr_1.phpt
ext/oci8/tests/conn_attr_2.phpt
ext/oci8/tests/conn_attr_3.phpt
ext/oci8/tests/conn_attr_4.phpt
ext/oci8/tests/conn_attr_5.phpt
ext/oci8/tests/connect.inc
ext/oci8/tests/connect_scope1.phpt
ext/oci8/tests/connect_scope2.phpt
ext/oci8/tests/connect_scope_try1.phpt
ext/oci8/tests/connect_scope_try2.phpt
ext/oci8/tests/connect_scope_try3.phpt
ext/oci8/tests/connect_scope_try4.phpt
ext/oci8/tests/connect_scope_try5.phpt
ext/oci8/tests/connect_scope_try6.phpt
ext/oci8/tests/connect_without_oracle_home_11.phpt
ext/oci8/tests/connect_without_oracle_home_old.phpt
ext/oci8/tests/connect_without_oracle_home_old_11.phpt
ext/oci8/tests/create_table.inc
ext/oci8/tests/cursor_bind.phpt
ext/oci8/tests/cursor_bind_err.phpt
ext/oci8/tests/cursors.phpt
ext/oci8/tests/cursors_old.phpt
ext/oci8/tests/dbmsoutput.phpt [new file with mode: 0644]
ext/oci8/tests/default_prefetch.phpt
ext/oci8/tests/default_prefetch0.phpt [new file with mode: 0644]
ext/oci8/tests/default_prefetch1.phpt
ext/oci8/tests/default_prefetch2.phpt
ext/oci8/tests/define.phpt
ext/oci8/tests/define0.phpt [new file with mode: 0644]
ext/oci8/tests/define1.phpt
ext/oci8/tests/define2.phpt
ext/oci8/tests/define3.phpt
ext/oci8/tests/define4.phpt
ext/oci8/tests/define5.phpt
ext/oci8/tests/define6.phpt [new file with mode: 0644]
ext/oci8/tests/define_old.phpt
ext/oci8/tests/descriptors.phpt
ext/oci8/tests/details.inc
ext/oci8/tests/drcp_connect1.phpt
ext/oci8/tests/drcp_functions.inc
ext/oci8/tests/drcp_privileged.phpt
ext/oci8/tests/driver_name.phpt
ext/oci8/tests/dupcolnames.phpt [new file with mode: 0644]
ext/oci8/tests/edition_1.phpt
ext/oci8/tests/edition_2.phpt
ext/oci8/tests/error.phpt
ext/oci8/tests/error1.phpt
ext/oci8/tests/error2.phpt
ext/oci8/tests/error_bind.phpt
ext/oci8/tests/error_old.phpt
ext/oci8/tests/error_parse.phpt
ext/oci8/tests/exec_fetch.phpt
ext/oci8/tests/fetch.phpt
ext/oci8/tests/fetch_all.phpt
ext/oci8/tests/fetch_all1.phpt [new file with mode: 0644]
ext/oci8/tests/fetch_all2.phpt
ext/oci8/tests/fetch_all3.phpt
ext/oci8/tests/fetch_all4.phpt
ext/oci8/tests/fetch_all5.phpt
ext/oci8/tests/fetch_array.phpt
ext/oci8/tests/fetch_assoc.phpt
ext/oci8/tests/fetch_into.phpt
ext/oci8/tests/fetch_into1.phpt
ext/oci8/tests/fetch_into2.phpt
ext/oci8/tests/fetch_object.phpt
ext/oci8/tests/fetch_object_1.phpt [new file with mode: 0644]
ext/oci8/tests/fetch_object_2.phpt
ext/oci8/tests/fetch_row.phpt
ext/oci8/tests/field_funcs.phpt
ext/oci8/tests/field_funcs0.phpt [new file with mode: 0644]
ext/oci8/tests/field_funcs1.phpt
ext/oci8/tests/field_funcs3.phpt [new file with mode: 0644]
ext/oci8/tests/field_funcs_old.phpt
ext/oci8/tests/lob_001.phpt
ext/oci8/tests/lob_002.phpt
ext/oci8/tests/lob_003.phpt
ext/oci8/tests/lob_004.phpt
ext/oci8/tests/lob_005.phpt
ext/oci8/tests/lob_006.phpt
ext/oci8/tests/lob_007.phpt
ext/oci8/tests/lob_008.phpt
ext/oci8/tests/lob_009.phpt
ext/oci8/tests/lob_010.phpt
ext/oci8/tests/lob_011.phpt
ext/oci8/tests/lob_012.phpt
ext/oci8/tests/lob_013.phpt
ext/oci8/tests/lob_014.phpt
ext/oci8/tests/lob_015.phpt
ext/oci8/tests/lob_016.phpt
ext/oci8/tests/lob_017.phpt
ext/oci8/tests/lob_018.phpt
ext/oci8/tests/lob_019.phpt
ext/oci8/tests/lob_020.phpt
ext/oci8/tests/lob_021.phpt
ext/oci8/tests/lob_022.phpt
ext/oci8/tests/lob_023.phpt
ext/oci8/tests/lob_024.phpt
ext/oci8/tests/lob_025.phpt
ext/oci8/tests/lob_026.phpt
ext/oci8/tests/lob_027.phpt
ext/oci8/tests/lob_028.phpt
ext/oci8/tests/lob_029.phpt
ext/oci8/tests/lob_030.phpt
ext/oci8/tests/lob_031.phpt
ext/oci8/tests/lob_032.phpt
ext/oci8/tests/lob_033.phpt
ext/oci8/tests/lob_034.phpt
ext/oci8/tests/lob_035.phpt
ext/oci8/tests/lob_036.phpt
ext/oci8/tests/lob_037.phpt
ext/oci8/tests/lob_038.phpt
ext/oci8/tests/lob_039.phpt
ext/oci8/tests/lob_040.phpt
ext/oci8/tests/lob_041.phpt
ext/oci8/tests/lob_042.phpt
ext/oci8/tests/lob_043.phpt
ext/oci8/tests/lob_044.phpt [new file with mode: 0644]
ext/oci8/tests/lob_aliases.phpt
ext/oci8/tests/lob_null.phpt
ext/oci8/tests/lob_temp.phpt
ext/oci8/tests/lob_temp1.phpt
ext/oci8/tests/null_byte_2.phpt
ext/oci8/tests/null_byte_3.phpt [new file with mode: 0644]
ext/oci8/tests/num.phpt
ext/oci8/tests/oci_execute_segfault.phpt
ext/oci8/tests/password.phpt
ext/oci8/tests/password_2.phpt
ext/oci8/tests/password_new.phpt
ext/oci8/tests/password_old.phpt
ext/oci8/tests/pecl_bug10194.phpt
ext/oci8/tests/pecl_bug10194_blob.phpt
ext/oci8/tests/pecl_bug10194_blob_64.phpt
ext/oci8/tests/pecl_bug16035.phpt
ext/oci8/tests/pecl_bug16842.phpt
ext/oci8/tests/pecl_bug8816.phpt
ext/oci8/tests/prefetch.phpt
ext/oci8/tests/prefetch_old.phpt
ext/oci8/tests/refcur_prefetch_1.phpt
ext/oci8/tests/refcur_prefetch_2.phpt
ext/oci8/tests/refcur_prefetch_3.phpt
ext/oci8/tests/refcur_prefetch_4.phpt [new file with mode: 0644]
ext/oci8/tests/select_null.phpt
ext/oci8/tests/serverversion.phpt
ext/oci8/tests/skipif.inc
ext/oci8/tests/statement_cache.phpt
ext/oci8/tests/xmltype_01.phpt
ext/oci8/tests/xmltype_02.phpt

index 1310325ad44b795844c51dcad4063e142ebcb09e..6a3746c2d53cf2813a8d6f51f0f2d89e26f547d3 100644 (file)
@@ -61,7 +61,7 @@ echo "Done\n";
 --EXPECTF--    
 Warning: oci_bind_array_by_name(): OCI-21560: argument 3 is null, invalid, or out of range in %s on line %d
 
-Warning: oci_execute(): ORA-01008: not all variables bound in %s on line %d
+Warning: oci_execute(): ORA-%r(01008|57000)%r: %s in %s on line %d
 array(1) {
   [0]=>
   string(0) ""
index 4c76df42f92d5289cbc01e6d26f78e26391b9cc9..82b57dc73113335ced9eb929665fe4e0544f41e5 100644 (file)
@@ -61,7 +61,7 @@ echo "Done\n";
 --EXPECTF--    
 Warning: oci_bind_array_by_name(): Maximum array length must be greater than zero in %s on line %d
 
-Warning: oci_execute(): ORA-01008: not all variables bound in %s on line %d
+Warning: oci_execute(): ORA-%r(01008|57000)%r: %s in %s on line %d
 array(5) {
   [0]=>
   string(9) "06-DEC-05"
index 497e46e49600c90a997b817287a4857da33deb38..94bce02e31deefdf1beb61c71cfe3b3b70dda3d7 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 oci_bind_array_by_name() and invalid values 3
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index 1ddf85149b555ce9f09091d50613ba5961d87199..1eb1fc7faca76d54a60ef753e7f0b31ddca20b01 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 oci_bind_array_by_name() and invalid values 4
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index 58dadc20ca690f8ad1030a5f7fe84fa9943ddbc4..eaa3c4ea2eb5dc04f08bd7bfba0a6ca872ee1456 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 oci_bind_array_by_name() and invalid values 5
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index e229dd8722db8bc58a06a3e4e779c9ea36f53513..f13aca3997d3c3c1e50de2becf85214956b6fd47 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 oci_bind_array_by_name(), SQLT_CHR and default max_length
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index 10c92a8e7dab2b43c315472268e04c744d9fbb86..c926bc0abd6f6228dd49ca42e6506b3283bf798b 100644 (file)
@@ -61,7 +61,7 @@ echo "Done\n";
 --EXPECTF--    
 Warning: oci_bind_array_by_name(): Unknown or unsupported datatype given: -1 in %s on line %d
 
-Warning: oci_execute(): ORA-01008: not all variables bound in %s on line %d
+Warning: oci_execute(): ORA-%r(01008|57000)%r: %s in %s on line %d
 array(5) {
   [0]=>
   int(1)
index c44304c11cf957ecebb282a01c75ef14705b8b50..df2c35ccb298d1204efb40468c494e6a55514ec5 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 oci_bind_array_by_name() and invalid values 8
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
@@ -60,9 +63,9 @@ echo "Done\n";
 ?>
 --EXPECTF--    
 Warning: oci_execute(): ORA-06550: line %d, column %d:
-PLS-00418: array bind type must match PL/SQL table row type
-ORA-06550: line %d, column %d:
-PL/SQL: Statement ignored in %s on line %d
+PLS-00418: %s
+ORA-06550: %s
+PL/SQL: %s
 array(5) {
   [0]=>
   string(1) "1"
index a77ed913ea6784e7d0797ff979ff6aad572fdf9f..ede82c97fce9bf5e6dcffd9250051c848a3f5326 100644 (file)
@@ -7,7 +7,7 @@ oci_bind_array_by_name() and invalid values 8
 
 require dirname(__FILE__).'/connect.inc';
 
-$statement = oci_parse($c, 'SELECT user FROM v$session');
+$statement = oci_parse($c, 'SELECT user FROM all_objects');
 
 $array = Array(1,2,3,4,5);
 
index e8e00a8091aa4adb04b30bdb39d5d44c259ef504..9f43d1ac9c341d551080690c16d784f930ae04e5 100644 (file)
@@ -61,7 +61,7 @@ echo "Done\n";
 --EXPECTF--    
 Warning: oci_bind_array_by_name(): You must provide max length value for empty arrays in %s on line %d
 
-Warning: oci_execute(): ORA-01008: not all variables bound in %s on line %d
+Warning: oci_execute(): ORA-%r(01008|57000)%r: %s in %s on line %d
 array(0) {
 }
 Done
index 2208f0b3b94eeb704de80694f0c1f55e59435813..38e1701a4b86cce1e44232b4cd2ab121b73befc5 100644 (file)
@@ -7,7 +7,7 @@ oci_bind_array_by_name(), SQLT_CHR, default max_length and empty array
 
 require dirname(__FILE__).'/connect.inc';
 
-$statement = oci_parse($c, 'SELECT user FROM v$session');
+$statement = oci_parse($c, 'SELECT user FROM all_objects');
 
 $array = array();
 
index bd9fdf13356574c172e5056339ebcacbfaa6524b..9ab023635944d0b0263d5a4058727c7e8d1e027f 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 oci_bind_array_by_name() and NUMBERs
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index 63da558f91d0b95f35e9194284602da752afcd39..926d7cfaba4a979807b1963f193a9300299d350d 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 oci_bind_array_by_name() and SQLT_ODT
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index ebf767570b695c5d3b8d7126565c08f387da9dae..c8c1f1a5e984448392d6f92da30b04dacbc9d005 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 oci_bind_array_by_name() and SQLT_ODT
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index 1aafb243174cb2b216fe6522a018e3ae6703ba48..5246f63805335c0bc50e472daa6687857f8c8b59 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 oci_bind_array_by_name() and SQLT_FLT
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index ead85890faa2f44b6c1c8fd4ab5b45bede066fd9..53b551f1c121f6cb43dd057d64da10fc0e3b4a04 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 oci_bind_array_by_name() and SQLT_FLT
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index 3c8bfd4f575a3ed0d045b0d23c51de9b649b5f2f..2f34979f233c5d7787f504da6e9097f4c57cea82 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 oci_bind_array_by_name() and SQLT_INT
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index 5e06de876bbc475506c24e760286d1a6acccc270..49fea2aa03011f92abf3274827da4c1e6bedd66a 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 oci_bind_array_by_name() and SQLT_INT
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index c8e1e0cdb57bc22ca41fdf4202dac5726df5a452..87291bd172552e44867586e7bfb82caa869f37a6 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
-oci_bind_array_by_name() and SQLT_AVC
+oci_bind_array_by_name() and SQLT_CHR
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index af4dbfe2204de33a68d1cbf7eb6a929a7960ba4f..3f60ee8c28fd2ef72ea5b95b19425d1bf5cbe4c5 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
-oci_bind_array_by_name() and SQLT_AVC
+oci_bind_array_by_name() and SQLT_CHR
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index 9f04f302cb605f9da20761931c29e6d3560d567e..2911229175beba41279cfdce45c81ad5374cb1e2 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 Bug #47243 (Crash on exit with ZTS mode)
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index 08f5f528c3884efd7f6b61e7dec2f02dcf777011..ae96953d7bf9796d026b99259b789d903cd2ea80 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 Bug #47243 (Crash on exit with ZTS mode)
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index 0decb3487290fd7b4b6e54936a02b229bd7a4ea7..cc57c20d631329bbc5ac9d28ed80a20d0c65b88a 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 Bug #47243 (Crash on exit with ZTS mode)
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index 24ab1fc8251c1fdc2aa18398b1f3a7092d61748f..a5b059ed1de4361ead9d1548c14f8bff3c63e8e1 100644 (file)
@@ -4,18 +4,10 @@ SELECT oci_bind_by_name with SQLT_AFC aka CHAR
 <?php
 if (!extension_loaded('oci8')) die ("skip no oci8 extension");
 require(dirname(__FILE__)."/connect.inc");
-$sv = oci_server_version($c);
-$sv = preg_match('/Release 1[01]\.2\./', $sv, $matches);
-if ($sv !== 1) {
-       die ("skip expected output only valid when using Oracle 10gR2 or 11gR2 databases");
-} else {
-    ob_start();
-    phpinfo(INFO_MODULES);
-    $phpinfo = ob_get_clean();
-    $iv = preg_match('/Oracle .*Version => 1[1]\./', $phpinfo);
-    if ($iv != 1) {
-        die ("skip test expected to work only with Oracle 11g or greater version of client");
-    }
+if (preg_match('/Release 1[01]\.2\./', oci_server_version($c), $matches) !== 1) {
+       die("skip expected output only valid when using Oracle 10gR2 or 11gR2 databases");
+} else if (preg_match('/^11\./', oci_client_version()) != 1) {
+    die("skip test expected to work only with Oracle 11g or greater version of client");
 }
 ?>
 --FILE--
@@ -33,10 +25,7 @@ $stmtarray = array(
        "insert into bind_char_tab values (3, NULL, 'abc       ')"
 );
                                                 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 // Run Test
 
@@ -206,12 +195,7 @@ $stmtarray = array(
        "drop table bind_char_tab"
 );
                                                 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       oci_execute($s);
-}
-
-oci_close($c);
+oci8_test_sql_execute($c, $stmtarray);
 
 echo "Done\n";
 
index 60b7142ff12cc10f52882e316e569c8f60b54e44..55973a61b681c318049acd9f7918b2b48eb09d16 100644 (file)
@@ -27,10 +27,7 @@ $stmtarray = array(
        "insert into bind_char_tab values (3, NULL, 'abc       ')"
 );
                                                 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 // Run Test
 
@@ -200,12 +197,7 @@ $stmtarray = array(
        "drop table bind_char_tab"
 );
                                                 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       oci_execute($s);
-}
-
-oci_close($c);
+oci8_test_sql_execute($c, $stmtarray);
 
 echo "Done\n";
 
index fa2e547dbe30033dfc706296eb3fb5aa5f7e4f56..da34230dc77e4675d5e836f795cf62e4256ecc0e 100644 (file)
@@ -4,18 +4,10 @@ SELECT oci_bind_by_name with SQLT_AFC aka CHAR and dates
 <?php
 if (!extension_loaded('oci8')) die ("skip no oci8 extension");
 require(dirname(__FILE__)."/connect.inc");
-$sv = oci_server_version($c);
-$sv = preg_match('/Release 1[01]\.2\./', $sv, $matches);
-if ($sv !== 1) {
-       die ("skip expected output only valid when using Oracle 10gR2 or 11gR2 databases");
-} else {
-    ob_start();
-    phpinfo(INFO_MODULES);
-    $phpinfo = ob_get_clean();
-    $iv = preg_match('/Oracle .*Version => 1[1]\./', $phpinfo);
-    if ($iv != 1) {
-        die ("skip test expected to work only with Oracle 11g or greater version of client");
-    }
+if (preg_match('/Release 1[01]\.2\./', oci_server_version($c), $matches) !== 1) {
+       die("skip expected output only valid when using Oracle 10gR2 or 11gR2 databases");
+} else if (preg_match('/^11\./', oci_client_version()) != 1) {
+    die("skip test expected to work only with Oracle 11g or greater version of client");
 }
 ?>
 --FILE--
@@ -32,10 +24,7 @@ $stmtarray = array(
        "insert into bind_char_tab values (1, '2008-04-20')",
 );
                                                 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 // Run Test
 
@@ -95,12 +84,7 @@ $stmtarray = array(
        "drop table bind_char_tab"
 );
                                                 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       oci_execute($s);
-}
-
-oci_close($c);
+oci8_test_sql_execute($c, $stmtarray);
 
 echo "Done\n";
 
index 68a872fc46d8fa1faeaf0177834be4d78a4f8fea..357a716e6dc2bfabf394a7507b9c94c45375ff4d 100644 (file)
@@ -24,10 +24,7 @@ $stmtarray = array(
        "insert into bind_char_tab values (1, '2008-04-20')",
 );
                                                 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 // Run Test
 
@@ -87,12 +84,7 @@ $stmtarray = array(
        "drop table bind_char_tab"
 );
                                                 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       oci_execute($s);
-}
-
-oci_close($c);
+oci8_test_sql_execute($c, $stmtarray);
 
 echo "Done\n";
 
index 052981aceae21a81014139b5d8bacea695663e79..8ae5096273a4df2d0bdb1dcf44773fefb0cb8f75 100644 (file)
@@ -4,18 +4,10 @@ PL/SQL oci_bind_by_name with SQLT_AFC aka CHAR to CHAR parameter
 <?php
 if (!extension_loaded('oci8')) die ("skip no oci8 extension");
 require(dirname(__FILE__)."/connect.inc");
-$sv = oci_server_version($c);
-$sv = preg_match('/Release 1[01]\.2\./', $sv, $matches);
-if ($sv !== 1) {
-       die ("skip expected output only valid when using Oracle 10gR2 11gR2 databases");
-} else {
-    ob_start();
-    phpinfo(INFO_MODULES);
-    $phpinfo = ob_get_clean();
-    $iv = preg_match('/Oracle .*Version => 1[1]\./', $phpinfo);
-    if ($iv != 1) {
-        die ("skip test expected to work only with Oracle 11g or greater version of client");
-    }
+if (preg_match('/Release 1[01]\.2\./', oci_server_version($c), $matches) !== 1) {
+       die("skip expected output only valid when using Oracle 10gR2 or 11gR2 databases");
+} else if (preg_match('/^11\./', oci_client_version()) != 1) {
+    die("skip test expected to work only with Oracle 11g or greater version of client");
 }
 ?>
 --FILE--
@@ -28,11 +20,8 @@ require(dirname(__FILE__).'/connect.inc');
 $stmtarray = array(
        "create or replace function bind_char_3_fn(p1 char) return char as begin return p1; end;",
 );
-                                                
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       @oci_execute($s);
-}
+
+oci8_test_sql_execute($c, $stmtarray);
 
 // Run Test
 
@@ -243,18 +232,11 @@ function do_e($s)
 
 // Cleanup
 
-//require(dirname(__FILE__).'/drop_table.inc');
-
 $stmtarray = array(
        "drop function bind_char_3_fn"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       oci_execute($s);
-}
-
-oci_close($c);
+oci8_test_sql_execute($c, $stmtarray);
 
 echo "Done\n";
 
index aaa5371195da84ed04fc302361bffd78df266771..1e7da47edcc09de3eb0fdaa547cf9c2637d72df9 100644 (file)
@@ -21,10 +21,7 @@ $stmtarray = array(
        "create or replace function bind_char_3_fn(p1 char) return char as begin return p1; end;",
 );
                                                 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 // Run Test
 
@@ -235,18 +232,11 @@ function do_e($s)
 
 // Cleanup
 
-//require(dirname(__FILE__).'/drop_table.inc');
-
 $stmtarray = array(
        "drop function bind_char_3_fn"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       oci_execute($s);
-}
-
-oci_close($c);
+oci8_test_sql_execute($c, $stmtarray);
 
 echo "Done\n";
 
index fd38d902cc84b01a77e1a330945040c950a2833e..30e4c3be608e5b3a6bc081b803f1725804ae9879 100644 (file)
@@ -4,18 +4,10 @@ PL/SQL oci_bind_by_name with SQLT_AFC aka CHAR to VARCHAR2 parameter
 <?php
 if (!extension_loaded('oci8')) die ("skip no oci8 extension");
 require(dirname(__FILE__)."/connect.inc");
-$sv = oci_server_version($c);
-$sv = preg_match('/Release 1[01]\.2\./', $sv, $matches);
-if ($sv !== 1) {
-       die ("skip expected output only valid when using Oracle 10gR2 or 11gR2 databases");
-} else {
-    ob_start();
-    phpinfo(INFO_MODULES);
-    $phpinfo = ob_get_clean();
-    $iv = preg_match('/Oracle .*Version => 1[1]\./', $phpinfo);
-    if ($iv != 1) {
-        die ("skip test expected to work only with Oracle 11g or greater version of client");
-    }
+if (preg_match('/Release 1[01]\.2\./', oci_server_version($c), $matches) !== 1) {
+       die("skip expected output only valid when using Oracle 10gR2 or 11gR2 databases");
+} else if (preg_match('/^11\./', oci_client_version()) != 1) {
+    die("skip test expected to work only with Oracle 11g or greater version of client");
 }
 ?>
 --FILE--
@@ -31,10 +23,7 @@ $stmtarray = array(
        "create or replace function bind_char_3_fn(p1 varchar2) return varchar2 as begin return p1; end;",
 );
                                                 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 // Run Test
 
@@ -245,18 +234,11 @@ function do_e($s)
 
 // Cleanup
 
-//require(dirname(__FILE__).'/drop_table.inc');
-
 $stmtarray = array(
        "drop function bind_char_3_fn"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       oci_execute($s);
-}
-
-oci_close($c);
+oci8_test_sql_execute($c, $stmtarray);
 
 echo "Done\n";
 
index c4f7968e14963a2d6c0ed7b8dbf768ad9ffbd841..87b7daba8889632e6725401532ce33ba3246f9cf 100644 (file)
@@ -23,10 +23,7 @@ $stmtarray = array(
        "create or replace function bind_char_3_fn(p1 varchar2) return varchar2 as begin return p1; end;",
 );
                                                 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 // Run Test
 
@@ -237,18 +234,11 @@ function do_e($s)
 
 // Cleanup
 
-//require(dirname(__FILE__).'/drop_table.inc');
-
 $stmtarray = array(
        "drop function bind_char_3_fn"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       oci_execute($s);
-}
-
-oci_close($c);
+oci8_test_sql_execute($c, $stmtarray);
 
 echo "Done\n";
 
index ba6bd4d044375f1e01d1605c2e17bb933f356c30..40c579992d690b071ded7b6398285eb4fcb0f3b9 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 bind LONG field
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
@@ -13,16 +16,37 @@ $stmt = oci_parse($c, "drop table phptestlng");
 $stmt = oci_parse($c, "create table phptestlng( id number(10), filetxt long)");
 oci_execute($stmt);
 
+echo "Test 1\n";
+
 $stmt = oci_parse ($c, "insert into phptestlng (id, filetxt) values (:id, :filetxt)");
 $i=1;
 $filetxt = file_get_contents( dirname(__FILE__)."/test.txt");
 
+
+oci_bind_by_name( $stmt, ":id", $i, -1);
+oci_bind_by_name( $stmt, ":filetxt", $filetxt, -1, SQLT_LNG);
+oci_execute($stmt, OCI_DEFAULT);
+oci_commit($c);
+
+$stmt = oci_parse($c, "SELECT filetxt FROM phptestlng where id = 1");
+oci_execute($stmt);
+
+$row = oci_fetch_row($stmt);
+var_dump(md5($row[0]));
+var_dump(strlen($row[0]));
+
+echo "Test 2 - test multi chunk fetch\n";
+
+$stmt = oci_parse ($c, "insert into phptestlng (id, filetxt) values (:id, :filetxt)");
+$i=2;
+$filetxt = str_repeat($filetxt, 600);
+
 oci_bind_by_name( $stmt, ":id", $i, -1);
 oci_bind_by_name( $stmt, ":filetxt", $filetxt, -1, SQLT_LNG);
 oci_execute($stmt, OCI_DEFAULT);
 oci_commit($c);
 
-$stmt = oci_parse($c, "SELECT filetxt FROM phptestlng");
+$stmt = oci_parse($c, "SELECT filetxt FROM phptestlng where id = 2");
 oci_execute($stmt);
 
 $row = oci_fetch_row($stmt);
@@ -36,6 +60,10 @@ echo "Done\n";
 
 ?>
 --EXPECT--
+Test 1
 string(32) "5c7c34abf7ea51936785062dbfcaeddc"
 int(394)
+Test 2 - test multi chunk fetch
+string(32) "ee2e98b977341cfb8e037066e5fcb909"
+int(236400)
 Done
index 2a9962eace9c1ac2f337525961817fb58e474cae..e48bbd33eebd3db2c796a65bf328112b7a8c51f9 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 bind LONG RAW field
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
diff --git a/ext/oci8/tests/bind_misccoltypes.phpt b/ext/oci8/tests/bind_misccoltypes.phpt
new file mode 100644 (file)
index 0000000..0da8c8b
--- /dev/null
@@ -0,0 +1,369 @@
+--TEST--
+Bind miscellaneous column types using default types
+--SKIPIF--
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+if (preg_match('/^1[012]\./', oci_client_version()) != 1) {
+    die("skip test expected to work only with Oracle 10g or greater version of client");
+}
+?> 
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+
+    "alter session set nls_date_format = 'DD-MON-YY'",
+
+       "drop table bind_misccoltypes_tab",
+
+       "create table bind_misccoltypes_tab (
+        id                number,
+        char_t            char(1),
+        char_t10          char(10),
+        varchar2_t10      varchar2(10),
+        number_t          number,
+        number_t92        number(9,2),
+        number_t6         number(6),
+        date_t            date,
+        timestamp_t       timestamp,
+        float_t           float,
+        binary_float_t    binary_float,
+        binary_double_t   binary_double,
+        decimal_t         decimal,
+        integer_t         integer,
+        nchar_t           nchar(10),
+        nvarchar2_t10     nvarchar2(10),
+        varchar_t10       varchar(10) )",
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+function check_col($c, $colname, $id)
+{
+    $s = oci_parse($c, "select $colname from bind_misccoltypes_tab where id = :id");
+    oci_bind_by_name($s, ":id", $id);
+    oci_execute($s);
+    oci_fetch_all($s, $r);
+    var_dump($r);
+}
+
+// Tests
+
+echo "\nTEST86 insert all ORATYPE values\n";
+
+$insert_sql = "INSERT INTO bind_misccoltypes_tab ( id, "
+    . "   char_t, "
+    . "   char_t10, "
+    . "   varchar2_t10, "
+    . "   number_t, "
+    . "   number_t92, "
+    . "   number_t6, "
+    . "   date_t, "
+    . "   timestamp_t, "
+    . "   float_t, "
+    . "   binary_float_t, "
+    . "   binary_double_t, "
+    . "   decimal_t, "
+    . "   integer_t, "
+    . "   nchar_t, "
+    . "   nvarchar2_t10, "
+    . "   varchar_t10) "
+    . " VALUES (:n1, "
+    .         " :c1, "
+    .         " :c2, "
+    .         " :c3, "
+    .         " :n2, "
+    .         " :n3, "
+    .         " :n4, "
+    .         " to_date(:d1, 'YYYY-MM-DD HH24:MI:SS'), "
+    .         " to_timestamp(:d1, 'YYYY-MM-DD HH24:MI:SS'), "
+    .         " :n5, "
+    .         " :n5, "
+    .         " :n5, "
+    .         " :n1, "
+    .         " :n1, "
+    .         " :c4, "
+    .         " :c5, "
+    .         " :c6) ";
+
+
+$n1 = "86";
+$c1 = "C";
+$c2 = "char10";
+$c3 = "varchar210";
+$n2 = "-123.456";
+$n3 = "789.346";
+$n4 = "123456.023";
+$n5 = "12345678901234567890123456789012345678.723";
+$d1 = "2010-03-29 13:09:15";
+$c4 = "nchar10";
+$c5 = "nvarchar2x";
+$c6 = "varchar";
+
+$s = oci_parse($c, $insert_sql);
+oci_bind_by_name($s, ":n1", $n1);
+oci_bind_by_name($s, ":c1", $c1);
+oci_bind_by_name($s, ":c2", $c2);
+oci_bind_by_name($s, ":c3", $c3);
+oci_bind_by_name($s, ":n2", $n2);
+oci_bind_by_name($s, ":n3", $n3);
+oci_bind_by_name($s, ":n4", $n4);
+oci_bind_by_name($s, ":d1", $d1);
+oci_bind_by_name($s, ":n5", $n5);
+oci_bind_by_name($s, ":c4", $c4);
+oci_bind_by_name($s, ":c5", $c5);
+oci_bind_by_name($s, ":c6", $c6);
+
+oci_execute($s);
+
+echo "\nTEST87 SELECT all values using DEFINEs\n";
+$select_sql = "select "
+    . "id, "
+    . "char_t, "
+    . "char_t10, "
+    . "varchar2_t10, "
+    . "number_t, "
+    . "number_t92, "
+    . "number_t6, "
+    . "date_t, "
+    . "timestamp_t, "
+    . "float_t, "
+    . "binary_float_t, "
+    . "binary_double_t, "
+    . "decimal_t, "
+    . "integer_t, "
+    . "nchar_t, "
+    . "nvarchar2_t10, "
+    . "varchar_t10 "
+    . "from bind_misccoltypes_tab where id = 86";
+
+$s = oci_parse($c, $select_sql);
+
+oci_define_by_name($s, "ID", $ID);
+oci_define_by_name($s, "CHAR_T", $CHAR_T);
+oci_define_by_name($s, "CHAR_T10", $CHAR_T10);
+oci_define_by_name($s, "VARCHAR2_T10", $VARCHAR2_T10);
+oci_define_by_name($s, "NUMBER_T", $NUMBER_T);
+oci_define_by_name($s, "NUMBER_T92", $NUMBER_T92);
+oci_define_by_name($s, "NUMBER_T6", $NUMBER_T6);
+oci_define_by_name($s, "DATE_T", $DATE_T);
+oci_define_by_name($s, "TIMESTAMP_T", $TIMESTAMP_T);
+oci_define_by_name($s, "FLOAT_T", $FLOAT_T);
+oci_define_by_name($s, "BINARY_FLOAT_T", $BINARY_FLOAT_T);
+oci_define_by_name($s, "BINARY_DOUBLE_T", $BINARY_DOUBLE_T);
+oci_define_by_name($s, "DECIMAL_T", $DECIMAL_T);
+oci_define_by_name($s, "INTEGER_T", $INTEGER_T);
+oci_define_by_name($s, "NCHAR_T", $NCHAR_T);
+oci_define_by_name($s, "NVARCHAR2_T10", $NVARCHAR2_T10);
+oci_define_by_name($s, "VARCHAR_T10", $VARCHAR_T10);
+
+oci_execute($s);
+
+while (oci_fetch($s)) {
+    echo "ID is "              . "$ID\n";
+    echo "CHAR_T is "          . "$CHAR_T\n";
+    echo "CHAR_T10 is "        . "$CHAR_T10\n";
+    echo "VARCHAR2_T10 is "    . "$VARCHAR2_T10\n";
+    echo "NUMBER_T is "        . "$NUMBER_T\n";
+    echo "NUMBER_T92 is "      . "$NUMBER_T92\n";
+    echo "NUMBER_T6 is "       . "$NUMBER_T6\n";
+    echo "DATE_T is "          . "$DATE_T\n";
+    echo "TIMESTAMP_T is "     . "$TIMESTAMP_T\n";
+    echo "FLOAT_T is "         . "$FLOAT_T\n";
+    echo "BINARY_FLOAT_T is "  . "$BINARY_FLOAT_T\n";
+    echo "BINARY_DOUBLE_T is " . "$BINARY_DOUBLE_T\n";
+    echo "DECIMAL_T is "       . "$DECIMAL_T\n";
+    echo "INTEGER_T is "       . "$INTEGER_T\n";
+    echo "NCHAR_T is "         . "$NCHAR_T\n";
+    echo "NVARCHAR2_T10 is "   . "$NVARCHAR2_T10\n";
+    echo "VARCHAR_T10 is "     . "$VARCHAR_T10\n";
+}
+
+echo "\nTEST52 insert numbers\n";
+
+$s = oci_parse($c, "INSERT INTO bind_misccoltypes_tab (id, number_t92) VALUES (52, :n1)");
+$n1 = 3;
+oci_bind_by_name($s, ":n1", $n1);
+oci_execute($s);
+
+check_col($c, 'number_t92', 52);
+
+
+echo "\nTEST53 insert numbers \n";
+
+$s = oci_parse($c, "INSERT INTO bind_misccoltypes_tab (id, number_t92) VALUES (53, :n1)");
+$n1 = 8.67;
+oci_bind_by_name($s, ":n1", $n1);
+oci_execute($s);
+
+check_col($c, 'number_t92', 53);
+
+
+echo "\nTEST54 insert numbers \n";
+
+$s = oci_parse($c, "INSERT INTO bind_misccoltypes_tab (id, number_t) VALUES (54, :n1)");
+$n1 = 4.67;
+oci_bind_by_name($s, ":n1", $n1);
+oci_execute($s);
+
+check_col($c, 'number_t', 54);
+
+echo "\nTEST55 insert numbers \n";
+
+$s = oci_parse($c, "INSERT INTO bind_misccoltypes_tab (id, number_t) VALUES (55, :n1)");
+$n1 = "7.67";
+oci_bind_by_name($s, ":n1", $n1);
+oci_execute($s);
+
+check_col($c, 'number_t', 55);
+
+echo "\nTEST56 insert numbers \n";
+
+$n1 = -5.67;
+
+$s = oci_parse($c, "INSERT INTO bind_misccoltypes_tab (id, number_t) VALUES (56, :n1)");
+oci_bind_by_name($s, ":n1", $n1);
+oci_execute($s);
+
+check_col($c, 'number_t', 56);
+
+echo "\nTEST58 insert a VARCHAR2\n";
+
+$s = oci_parse($c, "INSERT INTO bind_misccoltypes_tab (id, varchar2_t10) VALUES (58, :c2)");
+$c2 = "Hood";
+oci_bind_by_name($s, ":c2", $c2);
+oci_execute($s);
+
+check_col($c, 'varchar2_t10', 58);
+
+echo "\nTEST59 insert a VARCHAR2\n";
+
+$s = oci_parse($c, "INSERT INTO bind_misccoltypes_tab (id, char_t10) VALUES (59, :c2)");
+$c2 = "Hood";
+oci_bind_by_name($s, ":c2", $c2);
+oci_execute($s);
+
+check_col($c, 'char_t10', 59);
+
+echo "\nTEST60 insert a date\n";
+
+$s = oci_parse($c, "INSERT INTO bind_misccoltypes_tab (id, date_t) VALUES (60, to_date(:c2, 'YYYY-MM-DD'))");
+$c2 = '2010-04-09';
+oci_bind_by_name($s, ":c2", $c2);
+oci_execute($s);
+
+check_col($c, 'date_t', 60);
+
+
+// Clean up
+
+$stmtarray = array(
+       "drop table bind_misccoltypes_tab"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+oci_close($c);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+TEST86 insert all ORATYPE values
+
+TEST87 SELECT all values using DEFINEs
+ID is 86
+CHAR_T is C
+CHAR_T10 is char10    
+VARCHAR2_T10 is varchar210
+NUMBER_T is -123.456
+NUMBER_T92 is 789.35
+NUMBER_T6 is 123456
+DATE_T is 29-MAR-10
+TIMESTAMP_T is 29-MAR-10 01.09.15.000000 PM
+FLOAT_T is 12345678901234567890123456789012345679
+BINARY_FLOAT_T is 1.23456784E+037
+BINARY_DOUBLE_T is 1.2345678901234568E+037
+DECIMAL_T is 86
+INTEGER_T is 86
+NCHAR_T is nchar10   
+NVARCHAR2_T10 is nvarchar2x
+VARCHAR_T10 is varchar
+
+TEST52 insert numbers
+array(1) {
+  ["NUMBER_T92"]=>
+  array(1) {
+    [0]=>
+    string(1) "3"
+  }
+}
+
+TEST53 insert numbers 
+array(1) {
+  ["NUMBER_T92"]=>
+  array(1) {
+    [0]=>
+    string(4) "8.67"
+  }
+}
+
+TEST54 insert numbers 
+array(1) {
+  ["NUMBER_T"]=>
+  array(1) {
+    [0]=>
+    string(4) "4.67"
+  }
+}
+
+TEST55 insert numbers 
+array(1) {
+  ["NUMBER_T"]=>
+  array(1) {
+    [0]=>
+    string(4) "7.67"
+  }
+}
+
+TEST56 insert numbers 
+array(1) {
+  ["NUMBER_T"]=>
+  array(1) {
+    [0]=>
+    string(5) "-5.67"
+  }
+}
+
+TEST58 insert a VARCHAR2
+array(1) {
+  ["VARCHAR2_T10"]=>
+  array(1) {
+    [0]=>
+    string(4) "Hood"
+  }
+}
+
+TEST59 insert a VARCHAR2
+array(1) {
+  ["CHAR_T10"]=>
+  array(1) {
+    [0]=>
+    string(10) "Hood      "
+  }
+}
+
+TEST60 insert a date
+array(1) {
+  ["DATE_T"]=>
+  array(1) {
+    [0]=>
+    string(9) "09-APR-10"
+  }
+}
+===DONE===
diff --git a/ext/oci8/tests/bind_misccoltypes_errs.phpt b/ext/oci8/tests/bind_misccoltypes_errs.phpt
new file mode 100644 (file)
index 0000000..20401fb
--- /dev/null
@@ -0,0 +1,169 @@
+--TEST--
+Bind miscellaneous column types and generating errors
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+       "drop table bind_misccoltypes_errs_tab",
+
+       "create table bind_misccoltypes_errs_tab (
+        id                number,
+        char_t            char(1),
+        char_t10          char(10),
+        varchar2_t10      varchar2(10),
+        number_t          number,
+        number_t92        number(9,2),
+        number_t6         number(6),
+        date_t            date,
+        timestamp_t       timestamp,
+        float_t           float,
+        binary_float_t    binary_float,
+        binary_double_t   binary_double,
+        decimal_t         decimal,
+        integer_t         integer,
+        nchar_t           nchar(10),
+        nvarchar2_t10     nvarchar2(10),
+        varchar_t10       varchar(10) )",
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+function check_col($c, $colname, $id)
+{
+    $s = oci_parse($c, "select $colname from bind_misccoltypes_errs_tab where id = :id");
+    oci_bind_by_name($s, ":id", $id);
+    oci_execute($s);
+    oci_fetch_all($s, $r);
+    var_dump($r);
+}
+
+// Tests
+
+echo "\nTest 1 insert numbers \n";
+
+$n1 = -23253245.3432467;
+
+$s = oci_parse($c, "INSERT INTO bind_misccoltypes_errs_tab (id, number_t6) VALUES (1, :n1)");
+oci_bind_by_name($s, ":n1", $n1);
+oci_execute($s);
+
+check_col($c, 'number_t6', 57);
+
+echo "\nTest 2 insert numbers \n";
+
+$n1 = "Hello";
+
+$s = oci_parse($c, "INSERT INTO bind_misccoltypes_errs_tab (id, number_t6) VALUES (2, :n1)");
+oci_bind_by_name($s, ":n1", $n1);
+oci_execute($s);
+
+check_col($c, 'number_t6', 57);
+
+echo "\nTest 3 - too long CHAR\n";
+
+$s = oci_parse($c, "INSERT INTO bind_misccoltypes_errs_tab (id, char_t) VALUES (3, :c2)");
+$c2 = "AB";
+oci_bind_by_name($s, ":c2", $c2, -1, SQLT_AFC);
+oci_execute($s);
+
+echo "\nTest 4 - too long VARCHAR2\n";
+
+$s = oci_parse($c, "INSERT INTO bind_misccoltypes_errs_tab (id, varchar2_t10) VALUES (4, :c2)");
+$c2 = "AAAAAAAAAAB";
+oci_bind_by_name($s, ":c2", $c2, -1, SQLT_AFC);
+oci_execute($s);
+
+echo "\nTest 5 - invalid number\n";
+
+$s = oci_parse($c, "INSERT INTO bind_misccoltypes_errs_tab (id, number_t) VALUES (5, :c2)");
+$c2 = "ABC";
+oci_bind_by_name($s, ":c2", $c2, -1, SQLT_AFC);
+oci_execute($s);
+
+echo "\nTest 6 - insert a VARCHAR2 with SQLT_BIN\n";
+
+$s = oci_parse($c, "INSERT INTO bind_misccoltypes_errs_tab (id, varchar2_t10) VALUES (6, :c2)");
+$c2 = "Hood 6";
+oci_bind_by_name($s, ":c2", $c2, -1, SQLT_BIN);
+oci_execute($s);
+
+check_col($c, 'varchar2_t10', 6);
+
+echo "\nTest 7 - insert a VARCHAR2 with SQLT_LBI\n";
+
+$s = oci_parse($c, "INSERT INTO bind_misccoltypes_errs_tab (id, varchar2_t10) VALUES (7, :c2)");
+$c2 = "Hood 7";
+oci_bind_by_name($s, ":c2", $c2, -1, SQLT_LBI);
+oci_execute($s);
+
+check_col($c, 'varchar2_t10', 7);
+
+
+// Clean up
+
+$stmtarray = array(
+       "drop table bind_misccoltypes_errs_tab"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+oci_close($c);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1 insert numbers 
+
+Warning: oci_execute(): ORA-01438: %s in %sbind_misccoltypes_errs.php on line %d
+array(1) {
+  ["NUMBER_T6"]=>
+  array(0) {
+  }
+}
+
+Test 2 insert numbers 
+
+Warning: oci_execute(): ORA-01722: %s in %sbind_misccoltypes_errs.php on line %d
+array(1) {
+  ["NUMBER_T6"]=>
+  array(0) {
+  }
+}
+
+Test 3 - too long CHAR
+
+Warning: oci_execute(): ORA-12899: %r(%s "%s"."BIND_MISCCOLTYPES_ERRS_TAB"."CHAR_T" \(%s: 2, %s: 1\)|String data right truncation)%r in %sbind_misccoltypes_errs.php on line %d
+
+Test 4 - too long VARCHAR2
+
+Warning: oci_execute(): ORA-12899: %r(%s "%s"."BIND_MISCCOLTYPES_ERRS_TAB"."VARCHAR2_T10" \(%s: 11, %s: 10\)|%s data right truncation)%r in %sbind_misccoltypes_errs.php on line %d
+
+Test 5 - invalid number
+
+Warning: oci_execute(): ORA-01722: %s in %sbind_misccoltypes_errs.php on line %d
+
+Test 6 - insert a VARCHAR2 with SQLT_BIN
+
+Warning: oci_execute(): ORA-12899: %r(%s "%s"."BIND_MISCCOLTYPES_ERRS_TAB"."VARCHAR2_T10" \(%s: 12, %s: 10\)|String data right truncation)%r in %sbind_misccoltypes_errs.php on line %d
+array(1) {
+  ["VARCHAR2_T10"]=>
+  array(0) {
+  }
+}
+
+Test 7 - insert a VARCHAR2 with SQLT_LBI
+
+Warning: oci_execute(): ORA-12899: %r(%s "%s"."BIND_MISCCOLTYPES_ERRS_TAB"."VARCHAR2_T10" \(%s: 12, %s: 10\)|String data right truncation)%r in %sbind_misccoltypes_errs.php on line %d
+array(1) {
+  ["VARCHAR2_T10"]=>
+  array(0) {
+  }
+}
+===DONE===
diff --git a/ext/oci8/tests/bind_number.phpt b/ext/oci8/tests/bind_number.phpt
new file mode 100644 (file)
index 0000000..6412b5f
--- /dev/null
@@ -0,0 +1,220 @@
+--TEST--
+Bind with NUMBER column variants
+--SKIPIF--
+<?php
+if (!extension_loaded('oci8')) die("skip no oci8 extension");
+if (preg_match('/^1[012]\./', oci_client_version()) != 1) {
+    die("skip test expected to work only with Oracle 10g or greater version of client");
+}
+?>
+--INI--
+precision = 14
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+       "drop table bind_number_tab",
+       "create table bind_number_tab (
+                                       id                                number,
+                                       number_t6                 number(6),
+                                       float_t                   float,
+                                       binary_float_t    binary_float,
+                                       binary_double_t   binary_double,
+                                       decimal_t                 decimal,
+                                       integer_t                 integer)"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+function check_col($c, $colname, $id)
+{
+       $s = oci_parse($c, "select $colname from bind_number_tab where id = :id");
+       oci_bind_by_name($s, ":id", $id);
+       oci_execute($s);
+       oci_fetch_all($s, $r);
+       var_dump($r);
+}
+
+// Run Test
+
+echo "Test 1 - invalid number\n";
+
+$s = oci_parse($c, "INSERT INTO bind_number_tab (id, number_t6) VALUES (1, :n1)");
+$n1 = "Hello";
+oci_bind_by_name($s, ":n1", $n1);
+oci_execute($s);
+
+check_col($c, "number_t6", 1);
+
+echo "\nTEST66 insert a float\n";
+
+$s = oci_parse($c, "INSERT INTO bind_number_tab (id, float_t) VALUES (66, :f1)");
+$f1 = 123.456;
+oci_bind_by_name($s, ":f1", $f1);
+oci_execute($s);
+
+check_col($c, 'float_t', 66);
+
+echo "\nTEST67 insert a binary float\n";
+
+$s = oci_parse($c, "INSERT INTO bind_number_tab (id, binary_float_t) VALUES (67, :f1)");
+$f1 = 567.456;
+oci_bind_by_name($s, ":f1", $f1);
+oci_execute($s);
+
+check_col($c, 'binary_float_t', 67);
+
+echo "\nTEST69 insert a binary double\n";
+
+$s = oci_parse($c, "INSERT INTO bind_number_tab (id, binary_double_t) VALUES (69, :f1)");
+$f1 = 567.456;
+oci_bind_by_name($s, ":f1", $f1);
+oci_execute($s);
+
+check_col($c, 'binary_double_t', 69);
+
+echo "\nTEST71 insert a decimal\n";
+
+$s = oci_parse($c, "INSERT INTO bind_number_tab (id, decimal_t) VALUES (71, :f1)");
+$f1 = 123.789;
+oci_bind_by_name($s, ":f1", $f1);
+oci_execute($s);
+
+check_col($c, 'decimal_t', 71);
+
+echo "\nTEST72 insert a decimal\n";
+
+$s = oci_parse($c, "INSERT INTO bind_number_tab (id, decimal_t) VALUES (72, :f1)");
+$f1 = 123.789;
+oci_bind_by_name($s, ":f1", $f1, -1, SQLT_NUM);
+oci_execute($s);
+
+check_col($c, 'decimal_t', 72);
+
+echo "\nTEST73 insert a double\n";
+
+$s = oci_parse($c, "INSERT INTO bind_number_tab (id, binary_double_t) VALUES (73, :f1)");
+$f1 = 483.589;
+oci_bind_by_name($s, ":f1", $f1);
+oci_execute($s);
+
+check_col($c, 'binary_double_t', 73);
+
+echo "\nTEST75 insert a INTEGER\n";
+
+$s = oci_parse($c, "INSERT INTO bind_number_tab (id, integer_t) VALUES (75, :f1)");
+$f1 = 589;
+oci_bind_by_name($s, ":f1", $f1);
+oci_execute($s);
+
+check_col($c, 'integer_t', 75);
+
+echo "\nTEST76 insert a INTEGER\n";
+
+$s = oci_parse($c, "INSERT INTO bind_number_tab (id, integer_t) VALUES (76, :f1)");
+$f1 = 42;
+oci_bind_by_name($s, ":f1", $f1, -1, SQLT_INT);
+oci_execute($s);
+
+check_col($c, 'integer_t', 76);
+
+
+// Clean up
+
+$stmtarray = array(
+       "drop table bind_number_tab"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1 - invalid number
+
+Warning: oci_execute(): ORA-01722: %s in %sbind_number.php on line %d
+array(1) {
+  ["NUMBER_T6"]=>
+  array(0) {
+  }
+}
+
+TEST66 insert a float
+array(1) {
+  ["FLOAT_T"]=>
+  array(1) {
+    [0]=>
+    string(7) "123.456"
+  }
+}
+
+TEST67 insert a binary float
+array(1) {
+  ["BINARY_FLOAT_T"]=>
+  array(1) {
+    [0]=>
+    string(%r15|8%r) "%r(5.67455994E\+002|567.4560)%r"
+  }
+}
+
+TEST69 insert a binary double
+array(1) {
+  ["BINARY_DOUBLE_T"]=>
+  array(1) {
+    [0]=>
+    string(%r23|16%r) "%r(5.6745600000000002E\+002|567.456000000000)%r"
+  }
+}
+
+TEST71 insert a decimal
+array(1) {
+  ["DECIMAL_T"]=>
+  array(1) {
+    [0]=>
+    string(3) "124"
+  }
+}
+
+TEST72 insert a decimal
+array(1) {
+  ["DECIMAL_T"]=>
+  array(1) {
+    [0]=>
+    string(1) "0"
+  }
+}
+
+TEST73 insert a double
+array(1) {
+  ["BINARY_DOUBLE_T"]=>
+  array(1) {
+    [0]=>
+    string(%r12|16%r) "%r(4.83589E\+002|483.589000000000)%r"
+  }
+}
+
+TEST75 insert a INTEGER
+array(1) {
+  ["INTEGER_T"]=>
+  array(1) {
+    [0]=>
+    string(3) "589"
+  }
+}
+
+TEST76 insert a INTEGER
+array(1) {
+  ["INTEGER_T"]=>
+  array(1) {
+    [0]=>
+    string(2) "42"
+  }
+}
+===DONE===
+
+
diff --git a/ext/oci8/tests/bind_query.phpt b/ext/oci8/tests/bind_query.phpt
new file mode 100644 (file)
index 0000000..e4edc93
--- /dev/null
@@ -0,0 +1,78 @@
+--TEST--
+Bind with various WHERE conditions
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+       "drop table bind_query_tab",
+       "create table bind_query_tab (empno number(4), ename varchar2(10), sal number(7,2))",
+       "insert into bind_query_tab values (7934, 'MILLER', 1300)",
+       "insert into bind_query_tab values (7902, 'FORD', 3000)"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+// Run Test
+
+echo "Test 1\n";
+
+$e = 7934;
+
+$s = oci_parse($c, "select ename from bind_query_tab where empno = :eno");
+oci_bind_by_name( $s, ":eno", $e, -1, SQLT_INT);
+oci_execute($s);
+var_dump(oci_fetch_row($s));
+
+echo "Test 2\n";
+
+$v = 1000;
+$s = oci_parse($c, 'select ename from bind_query_tab where sal > :v order by ename');
+oci_bind_by_name( $s, ":v", $v);
+oci_define_by_name($s, "ENAME", $ename, 20);
+oci_execute($s);
+while (oci_fetch($s)) {
+    var_dump($ename);
+}
+
+
+echo "Test 3\n";
+
+$s = oci_parse($c, 'select ename from bind_query_tab where sal > :v order by ename');
+oci_bind_by_name( $s, ":v", $v);
+$v = 2000;
+oci_define_by_name($s, "ENAME", $ename, 20);
+oci_execute($s);
+while (oci_fetch($s)) {
+    var_dump($ename);
+}
+
+
+// Clean up
+
+$stmtarray = array(
+       "drop table bind_query_tab"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1
+array(1) {
+  [0]=>
+  string(6) "MILLER"
+}
+Test 2
+string(4) "FORD"
+string(6) "MILLER"
+Test 3
+string(4) "FORD"
+===DONE===
index c9087e552b62efbbdf5ddea7dd9fc21791274761..c2e8e08768a50ecd9797ac512bbfcdd5605f2274 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 bind RAW field
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index f15d8f8bbb1784d0464a30c892037f65dbe98a71..122ad5e18e422d0077dbd94b651177c389d97c9b 100644 (file)
@@ -17,17 +17,14 @@ function do_query($c)
        }
 }
 
-$stmts = array(
+$stmtarray = array(
        "drop table rid_tab",
        "create table rid_tab (id number, address varchar2(40))",
        "insert into rid_tab (id, address) values (1, 'original text #1')",
        "insert into rid_tab (id, address) values (2, 'original text #2')"
 );
 
-foreach ($stmts as $q) {
-       $s = oci_parse($c, $q);
-       @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 echo "Initial Data\n";
 do_query($c);
@@ -54,12 +51,11 @@ do_query($c);
 
 // Cleanup
 
-$stmts = array("drop table rid_tab");
+$stmtarray = array(
+    "drop table rid_tab"
+);
 
-foreach ($stmts as $q) {
-       $s = oci_parse($c, $q);
-       @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 echo "Done\n";
 
diff --git a/ext/oci8/tests/bind_sqltafc.phpt b/ext/oci8/tests/bind_sqltafc.phpt
new file mode 100644 (file)
index 0000000..8d2ce2a
--- /dev/null
@@ -0,0 +1,208 @@
+--TEST--
+Bind tests with SQLT_AFC
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+       "drop table bind_sqltafc_tab",
+       "create table bind_sqltafc_tab (id number, char_t char(1), char_t10 char(10), varchar2_t10 varchar2(10), number_t number)",
+       "insert into bind_sqltafc_tab values (0, 'a', 'abcd', 'efghij', 1.1)"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+// Run Test
+
+function q($c, $id)
+{
+    $s = oci_parse($c, "select * from bind_sqltafc_tab where id = $id");
+    oci_execute($s);
+    oci_fetch_all($s, $r);
+    var_dump($r);
+}
+
+echo "Test 0 - base table creation without binds\n";
+
+q($c, 0);
+
+echo "\nTest 1 - successful insert\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltafc_tab (id, char_t, char_t10, varchar2_t10, number_t) VALUES (1, :c2, :c3, :c4, :c5)");
+$c2 = "H";
+$c3 = "AAAAAAAAAA";  // max length allowed in column
+$c4 = "BBBBBBBBBB";  // max length allowed in column
+$c5 = "123.45";
+oci_bind_by_name($s, ":c2", $c2, -1, SQLT_AFC);
+oci_bind_by_name($s, ":c3", $c3, -1, SQLT_AFC);
+oci_bind_by_name($s, ":c4", $c4, -1, SQLT_AFC);
+oci_bind_by_name($s, ":c5", $c5, -1, SQLT_AFC);
+oci_execute($s);
+
+q($c, 1);
+
+echo "\nTest 2 - Empty Strings\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltafc_tab (id, char_t, char_t10, varchar2_t10, number_t) VALUES (5, :c2, :c3, :c4, :c5)");
+$c2 = "";
+$c3 = "";
+$c4 = "";
+$c5 = "";
+oci_bind_by_name($s, ":c2", $c2, -1, SQLT_AFC);
+oci_bind_by_name($s, ":c3", $c3, -1, SQLT_AFC);
+oci_bind_by_name($s, ":c4", $c4, -1, SQLT_AFC);
+oci_bind_by_name($s, ":c5", $c5, -1, SQLT_AFC);
+oci_execute($s);
+
+q($c, 5);
+
+echo "\nTest 3 - NULLs\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltafc_tab (id, char_t, char_t10, varchar2_t10, number_t) VALUES (6, :c2, :c3, :c4, :c5)");
+$c2 = null;
+$c3 = null;
+$c4 = null;
+$c5 = null;
+oci_bind_by_name($s, ":c2", $c2, -1, SQLT_AFC);
+oci_bind_by_name($s, ":c3", $c3, -1, SQLT_AFC);
+oci_bind_by_name($s, ":c4", $c4, -1, SQLT_AFC);
+oci_bind_by_name($s, ":c5", $c5, -1, SQLT_AFC);
+oci_execute($s);
+
+q($c, 6);
+
+// Clean up
+
+$stmtarray = array(
+       "drop table bind_sqltafc_tab"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+oci_close($c);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 0 - base table creation without binds
+array(5) {
+  ["ID"]=>
+  array(1) {
+    [0]=>
+    string(1) "0"
+  }
+  ["CHAR_T"]=>
+  array(1) {
+    [0]=>
+    string(1) "a"
+  }
+  ["CHAR_T10"]=>
+  array(1) {
+    [0]=>
+    string(10) "abcd      "
+  }
+  ["VARCHAR2_T10"]=>
+  array(1) {
+    [0]=>
+    string(6) "efghij"
+  }
+  ["NUMBER_T"]=>
+  array(1) {
+    [0]=>
+    string(3) "1.1"
+  }
+}
+
+Test 1 - successful insert
+array(5) {
+  ["ID"]=>
+  array(1) {
+    [0]=>
+    string(1) "1"
+  }
+  ["CHAR_T"]=>
+  array(1) {
+    [0]=>
+    string(1) "H"
+  }
+  ["CHAR_T10"]=>
+  array(1) {
+    [0]=>
+    string(10) "AAAAAAAAAA"
+  }
+  ["VARCHAR2_T10"]=>
+  array(1) {
+    [0]=>
+    string(10) "BBBBBBBBBB"
+  }
+  ["NUMBER_T"]=>
+  array(1) {
+    [0]=>
+    string(6) "123.45"
+  }
+}
+
+Test 2 - Empty Strings
+array(5) {
+  ["ID"]=>
+  array(1) {
+    [0]=>
+    string(1) "5"
+  }
+  ["CHAR_T"]=>
+  array(1) {
+    [0]=>
+    NULL
+  }
+  ["CHAR_T10"]=>
+  array(1) {
+    [0]=>
+    NULL
+  }
+  ["VARCHAR2_T10"]=>
+  array(1) {
+    [0]=>
+    NULL
+  }
+  ["NUMBER_T"]=>
+  array(1) {
+    [0]=>
+    NULL
+  }
+}
+
+Test 3 - NULLs
+array(5) {
+  ["ID"]=>
+  array(1) {
+    [0]=>
+    string(1) "6"
+  }
+  ["CHAR_T"]=>
+  array(1) {
+    [0]=>
+    NULL
+  }
+  ["CHAR_T10"]=>
+  array(1) {
+    [0]=>
+    NULL
+  }
+  ["VARCHAR2_T10"]=>
+  array(1) {
+    [0]=>
+    NULL
+  }
+  ["NUMBER_T"]=>
+  array(1) {
+    [0]=>
+    NULL
+  }
+}
+===DONE===
diff --git a/ext/oci8/tests/bind_sqltchr_1.phpt b/ext/oci8/tests/bind_sqltchr_1.phpt
new file mode 100644 (file)
index 0000000..aabf9bd
--- /dev/null
@@ -0,0 +1,228 @@
+--TEST--
+Bind with SQLT_CHR
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+    "drop table bind_sqltchr_tab",
+
+    "create table bind_sqltchr_tab (
+        id                number,
+        varchar2_t10      varchar2(10),
+        number_t          number,
+        number_t92        number(9,2))"
+
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+function check_col($c, $colname, $id)
+{
+    $s = oci_parse($c, "select $colname from bind_sqltchr_tab where id = :id");
+    oci_bind_by_name($s, ":id", $id);
+    oci_execute($s);
+    oci_fetch_all($s, $r);
+    var_dump($r);
+}
+
+// Run Test
+
+echo "\nTEST241 bind SQLT_CHR\n";
+
+$c2 = "Hood241";
+$s = oci_parse($c, "INSERT INTO bind_sqltchr_tab (id, varchar2_t10) VALUES (241, :c2)");
+oci_bind_by_name($s, ":c2", $c2, -1, SQLT_CHR);
+oci_execute($s);
+
+check_col($c, 'varchar2_t10', 241);
+
+
+echo "\nTEST242 insert numbers SQLT_CHR\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltchr_tab (id, number_t) VALUES (242, :n1)");
+$n1 = 42;
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_CHR);
+oci_execute($s);
+
+check_col($c, 'number_t', 242);
+
+echo "\nTEST243 insert numbers, SQLT_CHR\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltchr_tab (id, number_t) VALUES (243, :n1)");
+$n1 = 42.69;
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_CHR);
+oci_execute($s);
+
+check_col($c, 'number_t', 243);
+
+echo "\nTEST244 insert numbers with SQLT_CHR\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltchr_tab (id, number_t) VALUES (244, :n1)");
+$n1 = 0;
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_CHR);
+oci_execute($s);
+
+check_col($c, 'number_t', 244);
+
+echo "\nTEST245 insert numbers with SQLT_CHR\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltchr_tab (id, number_t) VALUES (245, :n1)");
+$n1 = -23;
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_CHR);
+oci_execute($s);
+
+check_col($c, 'number_t', 245);
+
+echo "\nTEST246 insert numbers\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltchr_tab (id, number_t) VALUES (246, :n1)");
+$n1 = "-23";
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_CHR);
+oci_execute($s);
+
+check_col($c, 'number_t', 246);
+
+echo "\nTEST247 insert numbers with SQLT_CHR\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltchr_tab (id, number_t) VALUES (247, :n1)");
+$n1 = "23";
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_CHR);
+oci_execute($s);
+
+check_col($c, 'number_t', 247);
+
+echo "\nTEST248 insert numbers with SQLT_CHR\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltchr_tab (id, number_t92) VALUES (248, :n1)");
+$n1 = 123.56;
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_CHR);
+oci_execute($s);
+
+check_col($c, 'number_t92', 248);
+
+echo "\nTEST249 insert numbers with SQLT_CHR\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltchr_tab (id, number_t92) VALUES (249, :n1)");
+$n1 = "123.56";
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_CHR);
+oci_execute($s);
+
+check_col($c, 'number_t92', 249);
+
+echo "\nTEST250 insert numbers with SQLT_CHR\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltchr_tab (id, number_t92) VALUES (250, :n1)");
+$n1 = "";
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_CHR);
+oci_execute($s);
+
+check_col($c, 'number_t92', 250);
+
+// Clean up
+
+$stmtarray = array(
+    "drop table bind_sqltchr_tab"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+TEST241 bind SQLT_CHR
+array(1) {
+  ["VARCHAR2_T10"]=>
+  array(1) {
+    [0]=>
+    string(7) "Hood241"
+  }
+}
+
+TEST242 insert numbers SQLT_CHR
+array(1) {
+  ["NUMBER_T"]=>
+  array(1) {
+    [0]=>
+    string(2) "42"
+  }
+}
+
+TEST243 insert numbers, SQLT_CHR
+array(1) {
+  ["NUMBER_T"]=>
+  array(1) {
+    [0]=>
+    string(5) "42.69"
+  }
+}
+
+TEST244 insert numbers with SQLT_CHR
+array(1) {
+  ["NUMBER_T"]=>
+  array(1) {
+    [0]=>
+    string(1) "0"
+  }
+}
+
+TEST245 insert numbers with SQLT_CHR
+array(1) {
+  ["NUMBER_T"]=>
+  array(1) {
+    [0]=>
+    string(3) "-23"
+  }
+}
+
+TEST246 insert numbers
+array(1) {
+  ["NUMBER_T"]=>
+  array(1) {
+    [0]=>
+    string(3) "-23"
+  }
+}
+
+TEST247 insert numbers with SQLT_CHR
+array(1) {
+  ["NUMBER_T"]=>
+  array(1) {
+    [0]=>
+    string(2) "23"
+  }
+}
+
+TEST248 insert numbers with SQLT_CHR
+array(1) {
+  ["NUMBER_T92"]=>
+  array(1) {
+    [0]=>
+    string(6) "123.56"
+  }
+}
+
+TEST249 insert numbers with SQLT_CHR
+array(1) {
+  ["NUMBER_T92"]=>
+  array(1) {
+    [0]=>
+    string(6) "123.56"
+  }
+}
+
+TEST250 insert numbers with SQLT_CHR
+array(1) {
+  ["NUMBER_T92"]=>
+  array(1) {
+    [0]=>
+    NULL
+  }
+}
+===DONE===
diff --git a/ext/oci8/tests/bind_sqltchr_2.phpt b/ext/oci8/tests/bind_sqltchr_2.phpt
new file mode 100644 (file)
index 0000000..47d08d2
--- /dev/null
@@ -0,0 +1,50 @@
+--TEST--
+PL/SQL bind with SQLT_CHR
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+    "create or replace procedure bind_sqltchr_proc (msg_in in varchar2, msg_out out varchar2)
+    as
+    begin
+      msg_out := upper(msg_in);
+    end;"    
+
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+// Run Test
+
+echo "Test 1 - PL/SQL IN and OUT variables\n";
+$stmt = oci_parse($c, "BEGIN bind_sqltchr_proc(:a, :b); END;");
+$msg_in = "Cat got your keyboard?";
+oci_bind_by_name($stmt, ":a", $msg_in, -1, SQLT_CHR);
+oci_bind_by_name($stmt, ":b", $msg_out, 800, SQLT_CHR);
+oci_execute($stmt);
+var_dump($msg_in);
+var_dump($msg_out);
+
+// Clean up
+
+$stmtarray = array(
+    "drop procedure bind_sqltchr_proc"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1 - PL/SQL IN and OUT variables
+string(22) "Cat got your keyboard?"
+string(22) "CAT GOT YOUR KEYBOARD?"
+===DONE===
diff --git a/ext/oci8/tests/bind_sqltint.phpt b/ext/oci8/tests/bind_sqltint.phpt
new file mode 100644 (file)
index 0000000..f01791d
--- /dev/null
@@ -0,0 +1,227 @@
+--TEST--
+Bind with SQLT_INT
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+       "drop table bind_sqltint_tab",
+
+    "create table bind_sqltint_tab (
+        id                number,
+        varchar2_t10      varchar2(10),
+        number_t          number,
+        number_t92        number(9,2))",
+
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+function check_col($c, $colname, $id)
+{
+    $s = oci_parse($c, "select $colname from bind_sqltint_tab where id = :id");
+    oci_bind_by_name($s, ":id", $id);
+    oci_execute($s);
+    oci_fetch_all($s, $r);
+    var_dump($r);
+}
+
+// Run Test
+
+echo "\nTEST141 wrong bind type SQLT_INT\n";
+
+$c2 = "Hood141";
+$s = oci_parse($c, "INSERT INTO bind_sqltint_tab (id, varchar2_t10) VALUES (141, :c2)");
+oci_bind_by_name($s, ":c2", $c2, -1, SQLT_INT);
+oci_execute($s);
+
+check_col($c, 'varchar2_t10', 141);
+
+echo "\nTEST142 insert numbers SQLT_INT\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltint_tab (id, number_t) VALUES (142, :n1)");
+$n1 = 42;
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_INT);
+oci_execute($s);
+
+check_col($c, 'number_t', 142);
+
+echo "\nTEST143 insert numbers, SQLT_INT\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltint_tab (id, number_t) VALUES (143, :n1)");
+$n1 = 42.69;
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_INT);
+oci_execute($s);
+
+check_col($c, 'number_t', 143);
+
+echo "\nTEST144 insert numbers with SQLT_INT\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltint_tab (id, number_t) VALUES (144, :n1)");
+$n1 = 0;
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_INT);
+oci_execute($s);
+
+check_col($c, 'number_t', 144);
+
+echo "\nTEST145 insert numbers with SQLT_INT\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltint_tab (id, number_t) VALUES (145, :n1)");
+$n1 = -23;
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_INT);
+oci_execute($s);
+
+check_col($c, 'number_t', 145);
+
+echo "\nTEST146 insert numbers\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltint_tab (id, number_t) VALUES (146, :n1)");
+$n1 = "-23";
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_INT);
+oci_execute($s);
+
+check_col($c, 'number_t', 146);
+
+echo "\nTEST147 insert numbers with SQLT_INT\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltint_tab (id, number_t) VALUES (147, :n1)");
+$n1 = "23";
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_INT);
+oci_execute($s);
+
+check_col($c, 'number_t', 147);
+
+echo "\nTEST148 insert numbers with SQLT_INT\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltint_tab (id, number_t92) VALUES (148, :n1)");
+$n1 = 123.56;
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_INT);
+oci_execute($s);
+
+check_col($c, 'number_t92', 148);
+
+echo "\nTEST149 insert numbers with SQLT_INT\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltint_tab (id, number_t92) VALUES (149, :n1)");
+$n1 = "123.56";
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_INT);
+oci_execute($s);
+
+check_col($c, 'number_t92', 149);
+
+echo "\nTEST150 insert numbers with SQLT_INT\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltint_tab (id, number_t92) VALUES (150, :n1)");
+$n1 = "";
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_INT);
+oci_execute($s);
+
+check_col($c, 'number_t92', 150);
+
+// Clean up
+
+$stmtarray = array(
+       "drop table bind_sqltint_tab"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+TEST141 wrong bind type SQLT_INT
+array(1) {
+  ["VARCHAR2_T10"]=>
+  array(1) {
+    [0]=>
+    string(1) "0"
+  }
+}
+
+TEST142 insert numbers SQLT_INT
+array(1) {
+  ["NUMBER_T"]=>
+  array(1) {
+    [0]=>
+    string(2) "42"
+  }
+}
+
+TEST143 insert numbers, SQLT_INT
+array(1) {
+  ["NUMBER_T"]=>
+  array(1) {
+    [0]=>
+    string(2) "42"
+  }
+}
+
+TEST144 insert numbers with SQLT_INT
+array(1) {
+  ["NUMBER_T"]=>
+  array(1) {
+    [0]=>
+    string(1) "0"
+  }
+}
+
+TEST145 insert numbers with SQLT_INT
+array(1) {
+  ["NUMBER_T"]=>
+  array(1) {
+    [0]=>
+    string(3) "-23"
+  }
+}
+
+TEST146 insert numbers
+array(1) {
+  ["NUMBER_T"]=>
+  array(1) {
+    [0]=>
+    string(3) "-23"
+  }
+}
+
+TEST147 insert numbers with SQLT_INT
+array(1) {
+  ["NUMBER_T"]=>
+  array(1) {
+    [0]=>
+    string(2) "23"
+  }
+}
+
+TEST148 insert numbers with SQLT_INT
+array(1) {
+  ["NUMBER_T92"]=>
+  array(1) {
+    [0]=>
+    string(3) "123"
+  }
+}
+
+TEST149 insert numbers with SQLT_INT
+array(1) {
+  ["NUMBER_T92"]=>
+  array(1) {
+    [0]=>
+    string(3) "123"
+  }
+}
+
+TEST150 insert numbers with SQLT_INT
+array(1) {
+  ["NUMBER_T92"]=>
+  array(1) {
+    [0]=>
+    string(1) "0"
+  }
+}
+===DONE===
diff --git a/ext/oci8/tests/bind_sqltnum.phpt b/ext/oci8/tests/bind_sqltnum.phpt
new file mode 100644 (file)
index 0000000..d3828b7
--- /dev/null
@@ -0,0 +1,278 @@
+--TEST--
+Bind with SQLT_NUM
+--SKIPIF--
+<?php
+if (!extension_loaded('oci8')) die("skip no oci8 extension");
+if (preg_match('/^1[012]\./', oci_client_version()) != 1) {
+    die("skip test expected to work only with Oracle 10g or greater version of client");
+}
+?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+       "drop table bind_sqltnum_tab",
+
+    "create table bind_sqltnum_tab (
+        id                number,
+        varchar2_t10      varchar2(10),
+        number_t          number,
+        number_t92        number(9,2))"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+function check_col($c, $colname, $id)
+{
+    $s = oci_parse($c, "select $colname from bind_sqltnum_tab where id = :id");
+    oci_bind_by_name($s, ":id", $id);
+    oci_execute($s);
+    oci_fetch_all($s, $r);
+    var_dump($r);
+}
+
+
+// Run Test
+
+echo "Test 1 - baseline test\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltnum_tab (id, varchar2_t10) VALUES (100, :c2)");
+$c2 = "Hood";
+$r = oci_bind_by_name($s, ":c2", $c2, -1);
+if (!$r) {
+    $e = oci_error($s);
+    var_dump($e);
+}
+$r = oci_execute($s, OCI_DEFAULT);
+if (!$r) {
+    $e = oci_error($s);
+    var_dump($e);
+}
+
+$s = oci_parse($c, "select id, varchar2_t10 from bind_sqltnum_tab");
+oci_execute($s);
+oci_fetch_all($s, $data);
+var_dump($data);
+
+echo "Test 2 - SQLT_NUM to a VARCHAR2 column\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltnum_tab (id, varchar2_t10) VALUES (100, :c2)");
+$c2 = "Hood";
+$r = oci_bind_by_name($s, ":c2", $c2, -1, SQLT_NUM);
+if (!$r) {
+    $e = oci_error($s);
+    var_dump($e['message']);
+}
+$r = oci_execute($s, OCI_DEFAULT);
+if (!$r) {
+    $e = oci_error($s);
+    var_dump($e['message']);
+}
+
+echo "\nTEST41 wrong bind type SQLT_NUM\n";
+
+$c2 = "Hood41";
+$s = oci_parse($c, "INSERT INTO bind_sqltnum_tab (id, varchar2_t10) VALUES (41, :c2)");
+oci_bind_by_name($s, ":c2", $c2, -1, SQLT_NUM);
+oci_execute($s);
+
+echo "\nTEST42 insert numbers SQLT_NUM\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltnum_tab (id, number_t) VALUES (42, :n1)");
+$n1 = 42;
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_NUM);
+oci_execute($s);
+
+check_col($c, 'number_t', 42);
+
+echo "\nTEST43 insert numbers SQLT_NUM\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltnum_tab (id, number_t) VALUES (43, :n1)");
+$n1 = 42.69;
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_NUM);
+oci_execute($s);
+
+check_col($c, 'number_t', 43);
+
+echo "\nTEST44\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltnum_tab (id, number_t) VALUES (44, :n1)");
+$n1 = 0;
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_NUM);
+oci_execute($s);
+
+check_col($c, 'number_t', 44);
+
+echo "\nTEST45\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltnum_tab (id, number_t) VALUES (45, :n1)");
+$n1 = -23;
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_NUM);
+oci_execute($s);
+
+check_col($c, 'number_t', 45);
+
+echo "\nTEST46 insert numbers\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltnum_tab (id, number_t) VALUES (46, :n1)");
+$n1 = "-23";
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_NUM);
+oci_execute($s);
+
+check_col($c, 'number_t', 46);
+
+echo "\nTEST47\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltnum_tab (id, number_t) VALUES (47, :n1)");
+$n1 = "23";
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_NUM);
+oci_execute($s);
+
+check_col($c, 'number_t', 47);
+
+echo "\nTEST48\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltnum_tab (id, number_t92) VALUES (48, :n1)");
+$n1 = 123.56;
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_NUM);
+oci_execute($s);
+
+check_col($c, 'number_t92', 48);
+
+echo "\nTEST49\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltnum_tab (id, number_t92) VALUES (49, :n1)");
+$n1 = "123.56";
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_NUM);
+oci_execute($s);
+
+check_col($c, 'number_t92', 49);
+
+echo "\nTEST50\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltnum_tab (id, number_t92) VALUES (50, :n1)");
+$n1 = "";
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_NUM);
+oci_execute($s);
+
+check_col($c, 'number_t92', 50);
+
+// Clean up
+
+$stmtarray = array(
+       "drop table bind_sqltnum_tab"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1 - baseline test
+array(2) {
+  ["ID"]=>
+  array(1) {
+    [0]=>
+    string(3) "100"
+  }
+  ["VARCHAR2_T10"]=>
+  array(1) {
+    [0]=>
+    string(4) "Hood"
+  }
+}
+Test 2 - SQLT_NUM to a VARCHAR2 column
+
+Warning: oci_execute(): ORA-12899: %s (%s: 40, %s: 10) in %sbind_sqltnum.php on line %d
+string(%d) "ORA-12899: %s"
+
+TEST41 wrong bind type SQLT_NUM
+
+Warning: oci_execute(): ORA-12899: %s "%s"."BIND_SQLTNUM_TAB"."VARCHAR2_T10" (%s: 40, %s: 10) in %sbind_sqltnum.php on line %d
+
+TEST42 insert numbers SQLT_NUM
+array(1) {
+  ["NUMBER_T"]=>
+  array(1) {
+    [0]=>
+    NULL
+  }
+}
+
+TEST43 insert numbers SQLT_NUM
+array(1) {
+  ["NUMBER_T"]=>
+  array(1) {
+    [0]=>
+    NULL
+  }
+}
+
+TEST44
+array(1) {
+  ["NUMBER_T"]=>
+  array(1) {
+    [0]=>
+    string(127) "-000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
+  }
+}
+
+TEST45
+array(1) {
+  ["NUMBER_T"]=>
+  array(1) {
+    [0]=>
+    NULL
+  }
+}
+
+TEST46 insert numbers
+array(1) {
+  ["NUMBER_T"]=>
+  array(1) {
+    [0]=>
+    NULL
+  }
+}
+
+TEST47
+array(1) {
+  ["NUMBER_T"]=>
+  array(1) {
+    [0]=>
+    NULL
+  }
+}
+
+TEST48
+array(1) {
+  ["NUMBER_T92"]=>
+  array(1) {
+    [0]=>
+    string(1) "0"
+  }
+}
+
+TEST49
+array(1) {
+  ["NUMBER_T92"]=>
+  array(1) {
+    [0]=>
+    string(1) "0"
+  }
+}
+
+TEST50
+
+Warning: oci_execute(): ORA-01438: %s in %sbind_sqltnum.php on line %d
+array(1) {
+  ["NUMBER_T92"]=>
+  array(0) {
+  }
+}
+===DONE===
diff --git a/ext/oci8/tests/bind_unsupported_1.phpt b/ext/oci8/tests/bind_unsupported_1.phpt
new file mode 100644 (file)
index 0000000..544b446
--- /dev/null
@@ -0,0 +1,58 @@
+--TEST--
+Bind with various unsupported bind types
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// These types are defined in oci8.c
+
+$types = array(
+    "SQLT_AVC" => SQLT_AVC,
+    "SQLT_STR" => SQLT_STR,
+    "SQLT_VCS" => SQLT_VCS,
+    "SQLT_AVC" => SQLT_AVC,
+    "SQLT_STR" => SQLT_STR,
+    "SQLT_LVC" => SQLT_LVC,
+    "SQLT_FLT" => SQLT_FLT,
+    "SQLT_UIN" => SQLT_UIN,
+    "SQLT_ODT" => SQLT_ODT,
+);
+
+foreach ($types as $t => $v) {
+
+    echo "Test - $t\n";
+
+    $s = oci_parse($c, "select * from dual where dummy = :c1");
+    $c1 = "Doug";
+    oci_bind_by_name($s, ":c1", $c1, -1, $v);    
+}
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test - SQLT_AVC
+
+Warning: oci_bind_by_name(): Unknown or unsupported datatype given: 97 in %sbind_unsupported_1.php on line %d
+Test - SQLT_STR
+
+Warning: oci_bind_by_name(): Unknown or unsupported datatype given: 5 in %sbind_unsupported_1.php on line %d
+Test - SQLT_VCS
+
+Warning: oci_bind_by_name(): Unknown or unsupported datatype given: 9 in %sbind_unsupported_1.php on line %d
+Test - SQLT_LVC
+
+Warning: oci_bind_by_name(): Unknown or unsupported datatype given: 94 in %sbind_unsupported_1.php on line %d
+Test - SQLT_FLT
+
+Warning: oci_bind_by_name(): Unknown or unsupported datatype given: 4 in %sbind_unsupported_1.php on line %d
+Test - SQLT_UIN
+
+Warning: oci_bind_by_name(): Unknown or unsupported datatype given: 68 in %sbind_unsupported_1.php on line %d
+Test - SQLT_ODT
+
+Warning: oci_bind_by_name(): Unknown or unsupported datatype given: 156 in %sbind_unsupported_1.php on line %d
+===DONE===
diff --git a/ext/oci8/tests/bind_unsupported_2.phpt b/ext/oci8/tests/bind_unsupported_2.phpt
new file mode 100644 (file)
index 0000000..d3e5375
--- /dev/null
@@ -0,0 +1,39 @@
+--TEST--
+Bind with various unsupported 10g+ bind types
+--SKIPIF--
+<?php 
+if (!extension_loaded('oci8')) die("skip no oci8 extension"); 
+if (preg_match('/^1[01]\./', oci_client_version()) !== 1) {
+       die ("skip expected output only valid for Oracle 10g+ clients");
+}
+?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+$types = array(
+    "SQLT_BDOUBLE" => SQLT_BDOUBLE,
+    "SQLT_BFLOAT" => SQLT_BFLOAT,
+);
+
+foreach ($types as $t => $v) {
+
+    echo "Test - $t\n";
+
+    $s = oci_parse($c, "select * from dual where dummy = :c1");
+    $c1 = "Doug";
+    oci_bind_by_name($s, ":c1", $c1, -1, $v);    
+}
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test - SQLT_BDOUBLE
+
+Warning: oci_bind_by_name(): Unknown or unsupported datatype given: 22 in %sbind_unsupported_2.php on line %d
+Test - SQLT_BFLOAT
+
+Warning: oci_bind_by_name(): Unknown or unsupported datatype given: 21 in %sbind_unsupported_2.php on line %d
+===DONE===
diff --git a/ext/oci8/tests/bind_unsupported_3.phpt b/ext/oci8/tests/bind_unsupported_3.phpt
new file mode 100644 (file)
index 0000000..5c9dec3
--- /dev/null
@@ -0,0 +1,45 @@
+--TEST--
+Bind with various bind types not supported by TimesTen 
+--SKIPIF--
+<?php
+$target_dbs = array('oracledb' => false, 'timesten' => true);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+$types = array(
+    "SQLT_CLOB" => SQLT_CLOB,
+    "SQLT_BLOB" => SQLT_BLOB,
+    "OCI_B_CLOB" => OCI_B_CLOB,
+    "OCI_B_BLOB" => OCI_B_BLOB,
+);
+
+foreach ($types as $t => $v) {
+
+    echo "Test - $t\n";
+
+    $s = oci_parse($c, "select * from dual where dummy = :c1");
+    $c1 = "Doug";
+    oci_bind_by_name($s, ":c1", $c1, -1, $v);    
+}
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test - SQLT_CLOB
+
+Warning: oci_bind_by_name(): Unable to find descriptor property in %sbind_unsupported_3.php on line %d
+Test - SQLT_BLOB
+
+Warning: oci_bind_by_name(): Unable to find descriptor property in %sbind_unsupported_3.php on line %d
+Test - OCI_B_CLOB
+
+Warning: oci_bind_by_name(): Unable to find descriptor property in %sbind_unsupported_3.php on line %d
+Test - OCI_B_BLOB
+
+Warning: oci_bind_by_name(): Unable to find descriptor property in %sbind_unsupported_3.php on line %d
+===DONE===
index 2463e70c767aacc4646a3ee5cf37c66d19c6b86e..59f8a17f38d56641e7630a60664d3c3fbc6b42f4 100644 (file)
@@ -14,27 +14,11 @@ $stmtarray = array(
     "create table bug26133_tab (id number, value number)",
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       $r = @oci_execute($s);
-       if (!$r) {
-               $m = oci_error($s);
-               if (!in_array($m['code'], array(   // ignore expected errors
-                    942 // table or view does not exist
-                ))) {
-                       echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
-               }
-       }
-}
-
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 // Run Test
 
-$ora_sql = "INSERT INTO bug26133_tab (id, value) VALUES ('1','1') RETURNING ROWID INTO :v_rowid ";
+$ora_sql = "INSERT INTO bug26133_tab (id, value) VALUES (1,'1') RETURNING ROWID INTO :v_rowid ";
 
 $statement = OCIParse($c,$ora_sql);
 $rowid = OCINewDescriptor($c,OCI_D_ROWID);
@@ -51,10 +35,7 @@ $stmtarray = array(
     "drop table bug26133_tab"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
                          
 echo "Done\n";
 ?>
index 6d491966a7ab9aee48d07d296f6a6779231bcb7c..c4550244aa1a2b4fdabbd34a867d3121e338b41f 100644 (file)
@@ -4,35 +4,25 @@ Bug #27303 (OCIBindByName binds numeric PHP values as characters)
 <?php
 if (!extension_loaded('oci8')) die ("skip no oci8 extension");
 require(dirname(__FILE__)."/connect.inc");
-$sv = oci_server_version($c);
-$sv = preg_match('/Release 1[01]\.2\./', $sv, $matches);
-if ($sv !== 1) {
-       die ("skip expected output only valid when using Oracle 19gR2 or 11gR2 databases");
-} else {
-    ob_start();
-    phpinfo(INFO_MODULES);
-    $phpinfo = ob_get_clean();
-    $iv = preg_match('/Oracle .*Version => 1[1]\./', $phpinfo);
-    if ($iv != 1) {
-        die ("skip test expected to work only with Oracle 11g or greater version of client");
-    }
+if (preg_match('/Release 1[01]\.2\./', oci_server_version($c), $matches) !== 1) {
+       die("skip expected output only valid when using Oracle 10gR2 or 11gR2 databases");
+} else if (preg_match('/^11\./', oci_client_version()) != 1) {
+    die("skip test expected to work only with Oracle 11g or greater version of client");
 }
 ?>
 --FILE--
 <?php
 
-require dirname(__FILE__).'/connect.inc';
+require(dirname(__FILE__).'/connect.inc');
        
-$create_st = array();
-$create_st[] = "drop sequence myseq";
-$create_st[] = "drop table mytab";
-$create_st[] = "create sequence myseq";
-$create_st[] = "create table mytab (mydata varchar2(20), seqcol number)";
+$stmtarray = array(
+    "drop sequence myseq",
+    "drop table mytab",
+    "create sequence myseq",
+    "create table mytab (mydata varchar2(20), seqcol number)"
+);
 
-foreach ($create_st as $statement) {
-       $stmt = oci_parse($c, $statement);
-       @oci_execute($stmt);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 define('MYLIMIT', 200);
 
@@ -52,14 +42,12 @@ for ($i = 1; $i < MYLIMIT; $i++) {
 
 OCICommit($c);
 
-$drop_st = array();
-$drop_st[] = "drop sequence myseq";
-$drop_st[] = "drop table mytab";
+$stmtarray = array(
+    "drop sequence myseq",
+    "drop table mytab"
+);
 
-foreach ($create_st as $statement) {
-       $stmt = oci_parse($c, $statement);
-       oci_execute($stmt);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 echo "Done\n";
 ?>
index fe5c17c3ee43d2df5fc41c75fedb17af5ed35002..20097613f4a4e675916b1fef550119a9ab04dc3b 100644 (file)
@@ -13,18 +13,16 @@ if ($sv !== 1) {
 --FILE--
 <?php
 
-require dirname(__FILE__).'/connect.inc';
-       
-$create_st = array();
-$create_st[] = "drop sequence myseq";
-$create_st[] = "drop table mytab";
-$create_st[] = "create sequence myseq";
-$create_st[] = "create table mytab (mydata varchar2(20), seqcol number)";
+require(dirname(__FILE__).'/connect.inc');
 
-foreach ($create_st as $statement) {
-       $stmt = oci_parse($c, $statement);
-       @oci_execute($stmt);
-}
+$stmtarray = array(
+    "drop sequence myseq",
+    "drop table mytab",
+    "create sequence myseq",
+    "create table mytab (mydata varchar2(20), seqcol number)"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
 
 define('MYLIMIT', 200);
 
@@ -44,14 +42,12 @@ for ($i = 1; $i < MYLIMIT; $i++) {
 
 OCICommit($c);
 
-$drop_st = array();
-$drop_st[] = "drop sequence myseq";
-$drop_st[] = "drop table mytab";
+$stmtarray = array(
+    "drop sequence myseq",
+    "drop table mytab"
+);
 
-foreach ($create_st as $statement) {
-       $stmt = oci_parse($c, $statement);
-       oci_execute($stmt);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 echo "Done\n";
 ?>
index 3d0c0877036b920c631580d383e7e8fca35b4078..d7df23ba24ab99bbcf88037ea3efceaabf99f891 100644 (file)
@@ -4,18 +4,10 @@ Bug #27303 (OCIBindByName binds numeric PHP values as characters)
 <?php
 if (!extension_loaded('oci8')) die ("skip no oci8 extension");
 require(dirname(__FILE__)."/connect.inc");
-$sv = oci_server_version($c);
-$sv = preg_match('/Release 1[01]\.2\./', $sv, $matches);
-if ($sv !== 1) {
-       die ("skip expected output only valid when using Oracle 10gR2 or 11gR2 database");
-} else {
-    ob_start();
-    phpinfo(INFO_MODULES);
-    $phpinfo = ob_get_clean();
-    $iv = preg_match('/Oracle .*Version => 1[1]\./', $phpinfo);
-    if ($iv != 1) {
-        die ("skip test expected to work only with Oracle 11g or greater version of client");
-    }
+if (preg_match('/Release 1[01]\.2\./', oci_server_version($c), $matches) !== 1) {
+       die("skip expected output only valid when using Oracle 10gR2 or 11gR2 databases");
+} else if (preg_match('/^11\./', oci_client_version()) != 1) {
+    die("skip test expected to work only with Oracle 11g or greater version of client");
 }
 ?>
 --FILE--
@@ -23,16 +15,14 @@ if ($sv !== 1) {
 
 require dirname(__FILE__).'/connect.inc';
        
-$create_st = array();
-$create_st[] = "drop sequence myseq";
-$create_st[] = "drop table mytab";
-$create_st[] = "create sequence myseq";
-$create_st[] = "create table mytab (mydata varchar2(20), seqcol number)";
+$stmtarray = array(
+    "drop sequence myseq",
+    "drop table mytab",
+    "create sequence myseq",
+    "create table mytab (mydata varchar2(20), seqcol number)"
+);
 
-foreach ($create_st as $statement) {
-       $stmt = oci_parse($c, $statement);
-       oci_execute($stmt);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 define('MYLIMIT', 200);
 define('INITMYBV', 11);
@@ -54,14 +44,12 @@ for ($i = 1; $i < MYLIMIT; $i++) {
 
 OCICommit($c);
 
-$drop_st = array();
-$drop_st[] = "drop sequence myseq";
-$drop_st[] = "drop table mytab";
+$stmtarray = array(
+    "drop sequence myseq",
+    "drop table mytab"
+);
 
-foreach ($create_st as $statement) {
-       $stmt = oci_parse($c, $statement);
-       oci_execute($stmt);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 echo "Done\n";
 ?>
index e1daef0537e8cf21fa4a6e941810bc13ec0066fb..c2b5c433c450125ebfe4a2b1b0a95921c526e328 100644 (file)
@@ -15,16 +15,14 @@ if ($sv !== 1) {
 
 require dirname(__FILE__).'/connect.inc';
        
-$create_st = array();
-$create_st[] = "drop sequence myseq";
-$create_st[] = "drop table mytab";
-$create_st[] = "create sequence myseq";
-$create_st[] = "create table mytab (mydata varchar2(20), seqcol number)";
+$stmtarray = array(
+    "drop sequence myseq",
+    "drop table mytab",
+    "create sequence myseq",
+    "create table mytab (mydata varchar2(20), seqcol number)"
+);
 
-foreach ($create_st as $statement) {
-       $stmt = oci_parse($c, $statement);
-       oci_execute($stmt);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 define('MYLIMIT', 200);
 define('INITMYBV', 11);
@@ -46,14 +44,12 @@ for ($i = 1; $i < MYLIMIT; $i++) {
 
 OCICommit($c);
 
-$drop_st = array();
-$drop_st[] = "drop sequence myseq";
-$drop_st[] = "drop table mytab";
+$stmtarray = array(
+    "drop sequence myseq",
+    "drop table mytab"
+);
 
-foreach ($create_st as $statement) {
-       $stmt = oci_parse($c, $statement);
-       oci_execute($stmt);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 echo "Done\n";
 ?>
index 20dec54dacf889728aa684ad2ee945d5ad606c0d..86b1a8ba5edea7470fa5f0888bc82ee06412417e 100644 (file)
@@ -4,18 +4,10 @@ Bug #27303 (OCIBindByName binds numeric PHP values as characters)
 <?php
 if (!extension_loaded('oci8')) die ("skip no oci8 extension");
 require(dirname(__FILE__)."/connect.inc");
-$sv = oci_server_version($c);
-$sv = preg_match('/Release 1[01]\.2\./', $sv, $matches);
-if ($sv !== 1) {
-       die ("skip expected output only valid when using Oracle 10gR2 or 11gR2 databases");
-} else {
-    ob_start();
-    phpinfo(INFO_MODULES);
-    $phpinfo = ob_get_clean();
-    $iv = preg_match('/Oracle .*Version => 1[1]\./', $phpinfo);
-    if ($iv != 1) {
-        die ("skip test expected to work only with Oracle 11g or greater version of client");
-    }
+if (preg_match('/Release 1[01]\.2\./', oci_server_version($c), $matches) !== 1) {
+       die("skip expected output only valid when using Oracle 10gR2 or 11gR2 databases");
+} else if (preg_match('/^11\./', oci_client_version()) != 1) {
+    die("skip test expected to work only with Oracle 11g or greater version of client");
 }
 ?>
 --FILE--
index 257c6977b8e63af597411f7b509f639e2227e1b1..854e5c15909ae7eba9e34a1a759af12f7e4c4b91 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 Bug #32325 (Cannot retrieve collection using OCI8)
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
@@ -13,18 +16,7 @@ $stmtarray = array(
     "create or replace type bug32325_t as table of number"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       $r = @oci_execute($s);
-       if (!$r) {
-               $m = oci_error($s);
-               if (!in_array($m['code'], array(   // ignore expected errors
-                    942 // table or view does not exist
-                               ))) {
-                       echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
-               }
-       }
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 // Run test
        
@@ -49,10 +41,7 @@ $stmtarray = array(
     "drop type bug32325_t"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 echo "Done\n";
 ?>
index 81e1e58ba25d76f5bbcd80642f0d12fb49889864..3f4299ea29e2baee671e632ea1ee99db41c8a079 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 Bug #35973 (Error ORA-24806 occurs when trying to fetch a NCLOB field)
 --SKIPIF--
-<?php if (!extension_loaded("oci8")) print "skip"; ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index d451f3f2f411455763df034431e1603833c65c03..d181046871191432f100c3c1510a4a9fc659b687 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 Bug #36010 (Crash when executing SQL statment with lob parameter twice)
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
        
index 44b3a6ddca3b45ef0f6d737c0ea5f2ec8ddd43ad..2ec366b46a6bcde4d2c2a9086a984bb03ad842d5 100644 (file)
@@ -20,9 +20,9 @@ if(oci_execute($stmt, OCI_COMMIT_ON_SUCCESS)){
 echo "Done\n";
 
 ?>
---EXPECT--
+--EXPECTF--
 bool(false)
 bool(false)
-string(5) "'ABC'"
+string(%r[53]%r) "%r('ABC'|EXP)%r"
 string(4) "CHAR"
 Done
index 68c5f7b0a1756cd34108b04c5ee2c151df835b56..53dae694ec8bf74f0fbd64f8c744e0efd4dbafcd 100644 (file)
@@ -1,7 +1,12 @@
 --TEST--
 Bug #36403 (oci_execute no longer supports OCI_DESCRIBE_ONLY)
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+<?php
+if (!extension_loaded('oci8')) die ("skip no oci8 extension"); 
+if (preg_match('/^1[01]\./', oci_client_version()) != 1) {
+    die("skip expected output only valid with Oracle 10g or greater version of client");
+}
+?>
 --FILE--
 <?php
 
@@ -14,21 +19,7 @@ $stmtarray = array(
        "create table bug36403_tab (c1 number, col2 number, column3 number, col4 number)"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       $r = @oci_execute($s);
-       if (!$r) {
-               $m = oci_error($s);
-               if (!in_array($m['code'], array(   // ignore expected errors
-                               942 // table or view does not exist
-                       ,  2289 // sequence does not exist
-                       ,  4080 // trigger does not exist
-                       , 38802 // edition does not exist
-                               ))) {
-                       echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
-               }
-       }
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 // Run Test
 
@@ -48,18 +39,11 @@ $row = oci_fetch_array($s);
 
 // Clean up
 
-//require(dirname(__FILE__).'/drop_table.inc');
-
 $stmtarray = array(
        "drop table bug36403_tab"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       oci_execute($s);
-}
-
-oci_close($c);
+oci8_test_sql_execute($c, $stmtarray);
 
 ?>
 ===DONE===
@@ -72,5 +56,5 @@ COL2
 C1
 Test 2
 
-Warning: oci_fetch_array(): ORA-24338: %sbug36403.php on line %d
+Warning: oci_fetch_array(): ORA-%r(24338|01002)%r: %sbug36403.php on line %d
 ===DONE===
index 6743165b709b581f8530ba7a9a52284043cd62d3..8d59644b8eadab0cc516fae035144ad554ce1314 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 Bug #37220 (LOB Type mismatch when using windows & oci8.dll)
 --SKIPIF--
-<?php if (!extension_loaded("oci8")) print "skip"; ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
@@ -14,10 +17,7 @@ $stmtarray = array(
        "insert into bug37220_tab values(xmltype('<THETAG myID=\"1234\"></THETAG>'))"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 // Now let's update the row where myId = 1234 and change the tag
 // 'THETAG' to 'MYTAG' (mycolumn is an XMLTYPE datatype and
@@ -54,10 +54,7 @@ $stmtarray = array(
        "drop table bug37220_tab"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 echo "Done\n";
 
index ec86c51959524f80a96ae89c232f9e483576b722..1c00f68d31a9ad579935b7fe51a893e4f6fad92d 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 Bug #37581 (oci_bind_array_by_name clobbers input array when using SQLT_AFC, AVC)
 --SKIPIF--
-<?php if (!extension_loaded("oci8")) print "skip"; ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index b92df9e39ece36e6d60fd543fcd6e513bf63265a..901f6f7bfc3d30bc068e1383c1e09eb69fcc2450 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 Bug #38173 (Freeing nested cursors causes OCI8 to segfault)
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index 4a234e176d5a7309b61632e0b6559c4504d41ac9..4070221ee9b0a5a29bf55791442f71c6b94568b0 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 Bug #40078 (ORA-01405 when fetching NULL values using oci_bind_array_by_name())
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index 1ebc249d38624560710841a76cc85f2f80a2ec37..fcccfe716f641f9bb0155ad51416336289d7f0e5 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 Bug #40415 (Using oci_fetchall with nested cursors)
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php 
 
index b3a1b9969c77fd10bc795604098005f1cb4f8bee..5daa46d6f1acb15d84fa8e812d03dec839cdf75b 100644 (file)
@@ -2,8 +2,8 @@
 Bug #41069 (Oracle crash with certain data over a DB-link when prefetch memory limit used - Oracle bug 6039623)
 --SKIPIF--
 <?php 
-if (!extension_loaded('oci8')) die ("skip no oci8 extension"); 
-require(dirname(__FILE__).'/details.inc');
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
 if (empty($dbase)) die ("skip requires network connection alias for DB link loopback");
 if ($test_drcp) die("skip DRCP does not support shared database links");
 ?>
@@ -50,12 +50,9 @@ $stmtarray = array(
 
        "insert into bug41069_tab (c1, c2, c3, c4, c5, c6, c7, c9, c10, c12, c15)       values
        (113, 'aaaaaaa', 'bbbbbbbbbb', 'cccccc', 'e', 'f', 'dddd', '12/04/2006', '12/04/2006', 2224, 'zzzzzzz')"
-                                  );
+);
                                                 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 
 // Run Tests
@@ -79,14 +76,9 @@ $c = oci_new_connect($user, $password, $dbase);
 $stmtarray = array(
        "drop database link bug41069_dblink",
        "drop table bug41069_tab"
-                                  );
-
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       oci_execute($s);
-}
+);
 
-oci_close($c);
+oci8_test_sql_execute($c, $stmtarray);
 
 echo "Done\n";
 
index 2b0e3707d62cf3ec7cef493efbabb255c457a45b..10b7ef160d257de75f6cc8cc09e380a9f80fd779 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 Bug #42134 (Collection error for invalid collection name)
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index 501ed75cd0045a04886d2756b347f5eb3f3d9b59..d5e2f70c195943f5221c39f1d808a6867ec134be 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 Bug #42173 (TIMESTAMP and INTERVAL query and field functions)
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index 4d7e2c5852b0d6cea798197f33b57163fb8877f7..abf6cc8c757b9b573f20e3cf171ff7fa62982ffe 100644 (file)
@@ -1,7 +1,11 @@
 --TEST--
 Bug #42496 (LOB fetch leaks cursors, eventually failing with ORA-1000 maximum open cursors reached)
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+if ($stress_test !== true) die ('skip Slow test not run when $stress_test is FALSE');
+?> 
 --FILE--
 <?php
 
@@ -17,10 +21,7 @@ $stmtarray = array(
        "INSERT INTO bug42496_tab VALUES('test3', 'test3')"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 // Run Test
 
@@ -48,12 +49,7 @@ $stmtarray = array(
        "DROP table bug42496_tab"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       @oci_execute($s);
-}
-
-oci_close($c);
+oci8_test_sql_execute($c, $stmtarray);
 
 ?>
 --EXPECTF--
index e2800bbd8a637d54e039ed918f6d3db0bf128519..8c4b79141598fab2ceef4cff111e6d461cd28acb 100644 (file)
@@ -1,7 +1,11 @@
 --TEST--
 Bug #42496 (LOB fetch leaks cursors, eventually failing with ORA-1000 maximum open cursors reached)
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+if ($stress_test !== true) die ('skip Slow test not run when $stress_test is FALSE');
+?> 
 --FILE--
 <?php
 
@@ -17,10 +21,7 @@ $stmtarray = array(
        "INSERT INTO bug42496_tab VALUES('test3', 'test3')"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 // Run Test
 
@@ -46,12 +47,7 @@ $stmtarray = array(
        "DROP table bug42496_tab"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       @oci_execute($s);
-}
-
-oci_close($c);
+oci8_test_sql_execute($c, $stmtarray);
 
 ?>
 --EXPECTF--
index 921c8149dd82e031f3bdae4f64f4466077084a40..a86d1ca8478499f85db7ce8bc1e287c825572290 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 Bug #42841 (REF CURSOR and oci_new_cursor PHP crash)
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --INI--
 oci8.statement_cache_size=20
 --FILE--
@@ -15,97 +18,94 @@ $c = oci_connect($user, $password, $dbase);
 // Initialization
 
 $stmtarray = array(
-       "create or replace procedure bug42841_proc(out_1 out sys_refcursor) is
+    "create or replace procedure bug42841_proc(out_1 out sys_refcursor) is
    begin
-         open out_1 for select 11 from dual union all select 12 from dual union all select 13 from dual;
+      open out_1 for select 11 from dual union all select 12 from dual union all select 13 from dual;
    end bug42841_proc;",
 
-       "create or replace package bug43449_pkg is
-               type cursortype is ref Cursor;  
-               function testcursor return cursortype;
-       end bug43449_pkg;",
-       
-       "create or replace package body bug43449_pkg is
-       function testcursor return cursortype is
-       retCursor cursorType;
-       begin
-               Open retCursor For 'select * from dual';
-               return retCursor;
-       end;
-       end bug43449_pkg;"
+    "create or replace package bug43449_pkg is
+        type cursortype is ref Cursor;  
+        function testcursor return cursortype;
+    end bug43449_pkg;",
+    
+    "create or replace package body bug43449_pkg is
+    function testcursor return cursortype is
+    retCursor cursorType;
+    begin
+        Open retCursor For 'select * from dual';
+        return retCursor;
+    end;
+    end bug43449_pkg;"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 // Main code
 
 function do_bug42841($c)
 {
-       echo "First attempt\n";
-
-       $sql = "BEGIN bug42841_proc(:cursor); END;";
-       $stmt = oci_parse($c, $sql);
-       $cursor = oci_new_cursor($c);
-       oci_bind_by_name($stmt, ":cursor", $cursor, -1, OCI_B_CURSOR);
-       
-       oci_execute($stmt, OCI_DEFAULT);
-       oci_execute($cursor);
-       
-       while($row = oci_fetch_array($cursor, OCI_ASSOC + OCI_RETURN_LOBS)) {
-               $data1[] = $row;
-       }
-       
-       oci_free_statement($stmt);
-       oci_free_statement($cursor);
-       var_dump($data1);
-       
-       echo "Second attempt\n";
-       
-       $sql = "BEGIN bug42841_proc(:cursor); END;";
-       $stmt = oci_parse($c, $sql);
-       $cursor = oci_new_cursor($c);
-       oci_bind_by_name($stmt, ":cursor", $cursor, -1, OCI_B_CURSOR);
-       
-       oci_execute($stmt, OCI_DEFAULT);
-       oci_execute($cursor);
-       
-       while($row = oci_fetch_array($cursor, OCI_ASSOC + OCI_RETURN_LOBS)) {
-               $data2[] = $row;
-       }
-       
-       oci_free_statement($stmt);
-       oci_free_statement($cursor);
-       var_dump($data2);
+    echo "First attempt\n";
+
+    $sql = "BEGIN bug42841_proc(:cursor); END;";
+    $stmt = oci_parse($c, $sql);
+    $cursor = oci_new_cursor($c);
+    oci_bind_by_name($stmt, ":cursor", $cursor, -1, OCI_B_CURSOR);
+    
+    oci_execute($stmt, OCI_DEFAULT);
+    oci_execute($cursor);
+    
+    while($row = oci_fetch_array($cursor, OCI_ASSOC + OCI_RETURN_LOBS)) {
+        $data1[] = $row;
+    }
+    
+    oci_free_statement($stmt);
+    oci_free_statement($cursor);
+    var_dump($data1);
+    
+    echo "Second attempt\n";
+    
+    $sql = "BEGIN bug42841_proc(:cursor); END;";
+    $stmt = oci_parse($c, $sql);
+    $cursor = oci_new_cursor($c);
+    oci_bind_by_name($stmt, ":cursor", $cursor, -1, OCI_B_CURSOR);
+    
+    oci_execute($stmt, OCI_DEFAULT);
+    oci_execute($cursor);
+    
+    while($row = oci_fetch_array($cursor, OCI_ASSOC + OCI_RETURN_LOBS)) {
+        $data2[] = $row;
+    }
+    
+    oci_free_statement($stmt);
+    oci_free_statement($cursor);
+    var_dump($data2);
 }
 
 function do_bug43449($c)
 {
 
-       for ($i = 0; $i < 2; $i++) {
-               var_dump(bug43449_getCur($c));
-       }
+    for ($i = 0; $i < 2; $i++) {
+        var_dump(bug43449_getCur($c));
+    }
 }
 
 function bug43449_getCur($c)
-{              
-       $cur = oci_new_cursor($c);
-       $stmt = oci_parse($c, 'begin :cur := bug43449_pkg.testcursor; end;');
-       oci_bind_by_name($stmt, ':cur', $cur, -1, OCI_B_CURSOR);
-       oci_execute($stmt, OCI_DEFAULT);
-       oci_execute($cur, OCI_DEFAULT);
-       
-       $ret = array();
-       
-       while (ocifetchinto($cur, $row, OCI_ASSOC)) {
-               $ret[] = $row;
-       }
-       
-       oci_free_statement($cur);
-       oci_free_statement($stmt);
-       return $ret;
+{       
+    $cur = oci_new_cursor($c);
+    $stmt = oci_parse($c, 'begin :cur := bug43449_pkg.testcursor; end;');
+    oci_bind_by_name($stmt, ':cur', $cur, -1, OCI_B_CURSOR);
+    oci_execute($stmt, OCI_DEFAULT);
+    oci_execute($cur, OCI_DEFAULT);
+    
+    $ret = array();
+    
+    while (ocifetchinto($cur, $row, OCI_ASSOC)) {
+        $ret[] = $row;
+    }
+    
+    oci_free_statement($cur);
+    oci_free_statement($stmt);
+    return $ret;
 }
 
 echo "Test bug 42841: Procedure with OUT cursor parameter\n";
@@ -119,14 +119,11 @@ do_bug43449($c);
 // Cleanup
 
 $stmtarray = array(
-       "drop procedure bug42841_proc",
-       "drop package bug43449_pkg"
+    "drop procedure bug42841_proc",
+    "drop package bug43449_pkg"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 echo "Done\n";
 
index d28aabfcedcf6cae80b3af48f676d9d90fc5e16e..e84fa42556ce751543346834a94283d01e09a6af 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 Bug #43492 (Nested cursor leaks)
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
@@ -22,10 +25,7 @@ $stmtarray = array(
     "INSERT INTO bug43492_tab VALUES ('J')"
 );
 
-foreach ($stmtarray as $stmt) {
-    $s = oci_parse($c, $stmt);
-    @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 /*
 
@@ -66,12 +66,7 @@ $stmtarray = array(
     "DROP table bug43492_tab"
 );
 
-foreach ($stmtarray as $stmt) {
-    $s = oci_parse($c, $stmt);
-    @oci_execute($s);
-}
-
-oci_close($c);
+oci8_test_sql_execute($c, $stmtarray);
 
 ?>
 --EXPECT--
index fcf96e984edd88529b2d25c85fa28ec9e90a63c6..61511cf6d2f452977092b416b261420929b07469 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 Bug #43492 (Nested cursor leaks after related bug #44206 fixed)
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
@@ -26,10 +29,7 @@ $stmtarray = array(
     "INSERT INTO bug43492_tab VALUES ('J')"
 );
 
-foreach ($stmtarray as $stmt) {
-    $s = oci_parse($c, $stmt);
-    @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 function fetch($c, $i) {
     $s = ociparse($c, 'select cursor(select * from bug43492_tab) c from bug43492_tab');
@@ -57,12 +57,7 @@ $stmtarray = array(
     "DROP table bug43492_tab"
 );
 
-foreach ($stmtarray as $stmt) {
-    $s = oci_parse($c, $stmt);
-    @oci_execute($s);
-}
-
-oci_close($c);
+oci8_test_sql_execute($c, $stmtarray);
 
 ?>
 --EXPECT--
index 1ea46b40d7b0713e8b06d89dfde824339bc9d328..600fb047bf8016591ff06668b246e8b8c9c3108c 100644 (file)
@@ -2,13 +2,11 @@
 Bug #43497 (OCI8 XML/getClobVal aka temporary LOBs leak UGA memory)
 --SKIPIF--
 <?php 
-if (!extension_loaded('oci8')) die ("skip no oci8 extension"); 
-ob_start();
-phpinfo(INFO_MODULES);
-$phpinfo = ob_get_clean();
-$ov = preg_match('/Oracle Version => 9/', $phpinfo);
-if ($ov === 1) {
-       die ("skip expected output only valid for Oracle clients from 10g onwards");
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+if ($stress_test !== true) die ('skip Slow test not run when $stress_test is FALSE');
+if (preg_match('/^1[01]\./', oci_client_version()) != 1) {
+    die("skip expected output only valid with Oracle 10g or greater version of client");
 }
 ?>
 --FILE--
index e2cb1ce4860af1c726a37468c9ea5a812ec5c302..932a863d7a1567edf05e3b04cf922c7ac49a5c4d 100644 (file)
@@ -1,14 +1,12 @@
 --TEST--
 Bug #43497 (OCI8 XML/getClobVal aka temporary LOBs leak UGA memory)
 --SKIPIF--
-<?php 
-if (!extension_loaded('oci8')) die ("skip no oci8 extension"); 
-ob_start();
-phpinfo(INFO_MODULES);
-$phpinfo = ob_get_clean();
-$ov = preg_match('/Oracle Version => 9.2/', $phpinfo);
-if ($ov !== 1) {
-       die ("skip expected output only valid for Oracle 9.2 clients");
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+if ($stress_test !== true) die ('skip Slow test not run when $stress_test is FALSE');
+if (preg_match('/Unknown/', oci_client_version()) != 1) {
+    die("skip expected output only valid with Oracle 9gR2 clients");
 }
 ?>
 --FILE--
index fd10b26b8b013d45fff9f4a15808e33bbb24b3be..faacdc625401c261c12d40b7a69915d4977e6683 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
-Bug #44008 (Incorrect usage of OCI-Lob->close doesn't crash PHP)
+Bug #44008 (Incorrect usage of OCI-Lob->close crashes PHP)
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
@@ -15,10 +18,7 @@ $stmtarray = array(
                end;"
 );
 
-foreach ($stmtarray as $stmt) {
-        $s = oci_parse($c, $stmt);
-        @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 // Run Test
 
@@ -39,12 +39,7 @@ $stmtarray = array(
         "drop procedure bug44008_proc"
 );
 
-foreach ($stmtarray as $stmt) {
-        $s = oci_parse($c, $stmt);
-        oci_execute($s);
-}
-
-oci_close($c);
+oci8_test_sql_execute($c, $stmtarray);
 
 echo "Done\n";
 
index eee21c3aef6272f1ece958462f7b9815aa7741a6..aa4f2bb8e7fe4a32a9fe36cc47faf4baef922801 100644 (file)
@@ -2,8 +2,8 @@
 Bug #44113 (New collection creation can fail with OCI-22303)
 --SKIPIF--
 <?php 
-if (!extension_loaded('oci8')) die ("skip no oci8 extension");
-require(dirname(__FILE__).'/details.inc');
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
 if ($stress_test !== true) die ('skip Slow test not run when $stress_test is FALSE');
 ?>
 --FILE--
@@ -17,10 +17,7 @@ $stmtarray = array(
        "create or replace type bug44113_list_t as table of number"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 // Run Test
 // The test can take some time to complete and can exceed PHP's test
@@ -41,12 +38,7 @@ $stmtarray = array(
        "drop type bug44113_list_t"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       oci_execute($s);
-}
-
-oci_close($c);
+oci8_test_sql_execute($c, $stmtarray);
 
 echo "Done\n";
 
index e5771e4182c5cbc371304099022696b7bfd2d2e7..63805bf6e3a017566ae1383e2be3a62bf9fd6474 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 Bug #44206 (Test if selecting ref cursors leads to ORA-1000 maximum open cursors reached)
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index b1dc7720cefa3927b075a5d0b9ac8f0f5a91562e..b257f1fc09ee751d0a79934169c9aa861ad0a24f 100644 (file)
@@ -11,14 +11,14 @@ require(dirname(__FILE__).'/connect.inc');
 
 echo "Test 1\n";
 
-$stmt = 'select dummy "a", dummy "20" from dual';
+$stmt = 'select dummy "A", dummy "20" from dual';
 
 $s = oci_parse($c, $stmt);
 oci_execute($s);
 $r = oci_fetch_all($s, $data, 0, -1, OCI_FETCHSTATEMENT_BY_ROW);
 var_dump($data);
 var_dump($data[0]);
-var_dump($data[0]["a"]);
+var_dump($data[0]["A"]);
 var_dump($data[0]["20"]);
 oci_free_statement($s);
 
@@ -28,9 +28,9 @@ $s = oci_parse($c, $stmt);
 oci_execute($s);
 $r = oci_fetch_all($s, $data, 0, -1, OCI_ASSOC);
 var_dump($data);
-var_dump($data["a"]);
+var_dump($data["A"]);
 var_dump($data["20"]);
-var_dump($data["a"][0]);
+var_dump($data["A"][0]);
 var_dump($data["20"][0]);
 oci_free_statement($s);
 
@@ -44,14 +44,14 @@ Test 1
 array(1) {
   [0]=>
   array(2) {
-    ["a"]=>
+    ["A"]=>
     string(1) "X"
     [20]=>
     string(1) "X"
   }
 }
 array(2) {
-  ["a"]=>
+  ["A"]=>
   string(1) "X"
   [20]=>
   string(1) "X"
@@ -60,7 +60,7 @@ string(1) "X"
 string(1) "X"
 Test 2
 array(2) {
-  ["a"]=>
+  ["A"]=>
   array(1) {
     [0]=>
     string(1) "X"
index 0504952f69eb5aebbe5e5248f5c4da36ccf1935c..604b57f262d72fc1bd97ec51f08f56394a3945f3 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 Bug #46994 (CLOB size does not update when using CLOB IN OUT param in stored procedure)
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
@@ -22,10 +25,7 @@ $stmtarray = array(
          end bug46994_proc2;"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 // Run Test
 
@@ -64,10 +64,7 @@ $stmtarray = array(
        "drop procedure bug46994_proc2"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 oci_close($c);
 
index 073b410fcd0ad0d093cc179b902ebf9b848327b1..c82d2cd73b51000d35b9e94438ac9ac6a7e4115e 100644 (file)
@@ -1,12 +1,17 @@
 --TEST--
 Bug #47189 (Multiple oci_fetch_all calls) 
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs: different error handling for this undefined behavior
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
 require(dirname(__FILE__).'/connect.inc');
 
+echo "Test 1\n";
+
 $s = oci_parse($c, "select * from dual");
 oci_execute($s);
 oci_fetch_all($s, $rs, 0, -1, OCI_FETCHSTATEMENT_BY_ROW);
@@ -14,6 +19,8 @@ var_dump($rs);
 oci_fetch_all($s, $rs1, 0, -1, OCI_FETCHSTATEMENT_BY_ROW);
 var_dump($rs1); 
 
+echo "Test 2\n";
+
 $s = oci_parse($c, "select * from dual");
 oci_execute($s);
 oci_fetch_all($s, $rs, 0, 1, OCI_FETCHSTATEMENT_BY_ROW);
@@ -25,6 +32,7 @@ var_dump($rs1);
 ===DONE===
 <?php exit(0); ?>
 --EXPECTF--
+Test 1
 array(1) {
   [0]=>
   array(1) {
@@ -34,6 +42,7 @@ array(1) {
 }
 array(0) {
 }
+Test 2
 array(1) {
   [0]=>
   array(1) {
index 710246738eaf52eae106eedc5a777a8b9ddad68c..6b94bdef2102e96aa5013edf825b191ce3534aee 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 Bug #47281 ($php_errormsg is limited in size of characters)
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --ENV--
 NLS_LANG=.AL32UTF8
 --FILE--
@@ -19,21 +22,7 @@ $stmtarray = array(
     end;"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       $r = @oci_execute($s);
-       if (!$r) {
-               $m = oci_error($s);
-               if (!in_array($m['code'], array(   // ignore expected errors
-                               942 // table or view does not exist
-                       ,  2289 // sequence does not exist
-                       ,  4080 // trigger does not exist
-                       , 38802 // edition does not exist
-                ))) {
-                       echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
-               }
-       }
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 // Run Test
 
@@ -54,13 +43,10 @@ echo $php_errormsg. "\n";
 // Clean up
 
 $stmtarray = array(
-       "drop procedure bug47281_sp"
+    "drop procedure bug47281_sp"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 ?>
 ===DONE===
diff --git a/ext/oci8/tests/bug47281_tt.phpt b/ext/oci8/tests/bug47281_tt.phpt
new file mode 100644 (file)
index 0000000..4b4e92e
--- /dev/null
@@ -0,0 +1,59 @@
+--TEST--
+Bug #47281 ($php_errormsg is limited in size of characters)
+--SKIPIF--
+<?php
+$target_dbs = array('oracledb' => false, 'timesten' => true);  // test runs on these DBs: shorter message length in TimesTen
+require(dirname(__FILE__).'/skipif.inc');
+?>
+--ENV--
+NLS_LANG=.AL32UTF8
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+    "create or replace procedure bug47281_sp as
+    begin
+    raise_application_error(-20000,
+        'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaBcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccDeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeFggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggghhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhIjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjKlllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllM');
+    end;"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+// Run Test
+
+echo "Test 1\n";
+
+$s = oci_parse($c, 'begin bug47281_sp; end;');
+$r = @oci_execute($s);
+
+if (!$r) {
+    $m = oci_error($s);
+    echo $m['message'], "\n";
+}
+
+echo "Test 2\n";
+
+echo $php_errormsg. "\n";
+
+// Clean up
+
+$stmtarray = array(
+    "drop procedure bug47281_sp"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1
+ORA-57000: TT8507: ORA-20000: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+Test 2
+oci_execute(): ORA-57000: TT8507: ORA-20000: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+===DONE===
index fea3333ccf17634f5cfc86383cd94ad03225af95..a97272f65f4236b8ab88604f2451c78eb98c40c7 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 Bug #51253 (oci_bind_array_by_name() array references)
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
diff --git a/ext/oci8/tests/bug51291_1.phpt b/ext/oci8/tests/bug51291_1.phpt
new file mode 100644 (file)
index 0000000..789b94e
--- /dev/null
@@ -0,0 +1,394 @@
+--TEST--
+Bug #51291 (oci_error() doesn't report last error when called two times)
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+echo "Test 1 - Parse\n";
+
+$s = @oci_parse($c, "select ' from dual");
+if (!$s) {
+    var_dump(oci_error($c));
+    echo "2nd call\n";
+    var_dump(oci_error($c));
+}
+
+echo "\nTest 2 - Parse\n";
+
+$s = @oci_parse($c, "select ' from dual");
+if (!$s) {
+    var_dump(oci_error(), oci_error($c), oci_error($s));
+    echo "2nd call\n";
+    var_dump(oci_error(), oci_error($c), oci_error($s));
+}
+
+echo "\nTest 3 - Execute\n";
+
+$s = @oci_parse($c, 'select doesnotexist from dual');
+$r = @oci_execute($s, OCI_DEFAULT);
+if (!$r) { 
+    var_dump(oci_error($s));
+    echo "2nd call\n";
+    var_dump(oci_error($s));
+}
+
+echo "\nTest 4 - Execute - consecutive oci_error calls of different kinds\n";
+
+$s = @oci_parse($c, 'select doesnotexist from dual');
+$r = @oci_execute($s, OCI_DEFAULT);
+if (!$r) { 
+    var_dump(oci_error(), oci_error($c), oci_error($s));
+    echo "2nd call\n";
+    var_dump(oci_error(), oci_error($c), oci_error($s));
+}
+
+
+echo "\nTest 5 - Execute - after oci_rollback\n";
+
+$s = @oci_parse($c, 'select doesnotexist from dual');
+$r = @oci_execute($s, OCI_DEFAULT);
+if (!$r) { 
+    var_dump(oci_error(), oci_error($c), oci_error($s));
+    $r = oci_rollback($c);
+    echo "Rollback status is ";
+    if (is_null($r)) echo "null";
+    else if ($r === false) echo "false";
+    else if ($r === true) echo "true";
+    else echo $r;
+    echo "\n";
+    echo "2nd call after oci_rollback\n";
+    var_dump(oci_error(), oci_error($c), oci_error($s));
+}
+
+
+echo "\nTest 6 - Execute - after successful 2nd query with new handle\n";
+
+$s = @oci_parse($c, 'select doesnotexist from dual');
+$r = @oci_execute($s, OCI_DEFAULT);
+if (!$r) { 
+    var_dump(oci_error(), oci_error($c), oci_error($s));
+    $s2 = oci_parse($c, 'select 1 from dual');
+    $r = oci_execute($s2, OCI_DEFAULT);
+    echo "Execute status is ";
+    if (is_null($r)) echo "null";
+    else if ($r === false) echo "false";
+    else if ($r === true) echo "true";
+    else echo $r;
+    echo "\n";
+    echo "2nd call after successful execute\n";
+    var_dump(oci_error(), oci_error($c), oci_error($s), oci_error($s2));
+}
+
+
+echo "\nTest 7 - Execute - after successful 2nd query with same handle\n";
+
+$s = @oci_parse($c, 'select doesnotexist from dual');
+$r = @oci_execute($s, OCI_DEFAULT);
+if (!$r) { 
+    var_dump(oci_error(), oci_error($c), oci_error($s));
+    $s = oci_parse($c, 'select 1 from dual');
+    $r = oci_execute($s, OCI_DEFAULT);
+    echo "Execute status is ";
+    if (is_null($r)) echo "null";
+    else if ($r === false) echo "false";
+    else if ($r === true) echo "true";
+    else echo $r;
+    echo "\n";
+    echo "2nd call after successful execute\n";
+    var_dump(oci_error(), oci_error($c), oci_error($s));
+}
+
+
+echo "\nTest 8 - Execute - after unsuccessful 2nd query with new handle\n";
+
+$s = @oci_parse($c, 'select doesnotexist from dual');
+$r = @oci_execute($s, OCI_DEFAULT);
+if (!$r) { 
+    var_dump(oci_error(), oci_error($c), oci_error($s));
+    $s2 = oci_parse($c, 'select reallynothere from dual');
+    $r = oci_execute($s2, OCI_DEFAULT);
+    echo "Execute status is ";
+    if (is_null($r)) echo "null";
+    else if ($r === false) echo "false";
+    else if ($r === true) echo "true";
+    else echo $r;
+    echo "\n";
+    echo "2nd call after unsuccessful execute\n";
+    var_dump(oci_error(), oci_error($c), oci_error($s), oci_error($s2));
+}
+
+echo "\nTest 9 - Execute - after unsuccessful 2nd query with same handle\n";
+
+$s = @oci_parse($c, 'select doesnotexist from dual');
+$r = @oci_execute($s, OCI_DEFAULT);
+if (!$r) { 
+    var_dump(oci_error(), oci_error($c), oci_error($s));
+    $s = oci_parse($c, 'select reallynothere from dual');
+    $r = oci_execute($s, OCI_DEFAULT);
+    echo "Execute status is ";
+    if (is_null($r)) echo "null";
+    else if ($r === false) echo "false";
+    else if ($r === true) echo "true";
+    else echo $r;
+    echo "\n";
+    echo "2nd call after unsuccessful execute\n";
+    var_dump(oci_error(), oci_error($c), oci_error($s));
+}
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1 - Parse
+array(4) {
+  ["code"]=>
+  int(1756)
+  ["message"]=>
+  string(48) "ORA-01756: %s"
+  ["offset"]=>
+  int(0)
+  ["sqltext"]=>
+  string(0) ""
+}
+2nd call
+array(4) {
+  ["code"]=>
+  int(1756)
+  ["message"]=>
+  string(48) "ORA-01756: %s"
+  ["offset"]=>
+  int(0)
+  ["sqltext"]=>
+  string(0) ""
+}
+
+Test 2 - Parse
+
+Warning: oci_error() expects parameter 1 to be resource, boolean given in %sbug51291_1.php on line %d
+bool(false)
+array(4) {
+  ["code"]=>
+  int(1756)
+  ["message"]=>
+  string(48) "ORA-01756: %s"
+  ["offset"]=>
+  int(0)
+  ["sqltext"]=>
+  string(0) ""
+}
+NULL
+2nd call
+
+Warning: oci_error() expects parameter 1 to be resource, boolean given in %sbug51291_1.php on line %d
+bool(false)
+array(4) {
+  ["code"]=>
+  int(1756)
+  ["message"]=>
+  string(48) "ORA-01756: %s"
+  ["offset"]=>
+  int(0)
+  ["sqltext"]=>
+  string(0) ""
+}
+NULL
+
+Test 3 - Execute
+array(4) {
+  ["code"]=>
+  int(904)
+  ["message"]=>
+  string(%d) "ORA-00904:%sDOESNOTEXIST%s"
+  ["offset"]=>
+  int(%d)
+  ["sqltext"]=>
+  string(29) "select doesnotexist from dual"
+}
+2nd call
+array(4) {
+  ["code"]=>
+  int(904)
+  ["message"]=>
+  string(%d) "ORA-00904:%sDOESNOTEXIST%s"
+  ["offset"]=>
+  int(%d)
+  ["sqltext"]=>
+  string(29) "select doesnotexist from dual"
+}
+
+Test 4 - Execute - consecutive oci_error calls of different kinds
+bool(false)
+bool(false)
+array(4) {
+  ["code"]=>
+  int(904)
+  ["message"]=>
+  string(%d) "ORA-00904:%sDOESNOTEXIST%s"
+  ["offset"]=>
+  int(%d)
+  ["sqltext"]=>
+  string(29) "select doesnotexist from dual"
+}
+2nd call
+bool(false)
+bool(false)
+array(4) {
+  ["code"]=>
+  int(904)
+  ["message"]=>
+  string(%d) "ORA-00904:%sDOESNOTEXIST%s"
+  ["offset"]=>
+  int(%d)
+  ["sqltext"]=>
+  string(29) "select doesnotexist from dual"
+}
+
+Test 5 - Execute - after oci_rollback
+bool(false)
+bool(false)
+array(4) {
+  ["code"]=>
+  int(904)
+  ["message"]=>
+  string(%d) "ORA-00904:%sDOESNOTEXIST%s"
+  ["offset"]=>
+  int(%d)
+  ["sqltext"]=>
+  string(29) "select doesnotexist from dual"
+}
+Rollback status is true
+2nd call after oci_rollback
+bool(false)
+bool(false)
+array(4) {
+  ["code"]=>
+  int(904)
+  ["message"]=>
+  string(%d) "ORA-00904:%sDOESNOTEXIST%s"
+  ["offset"]=>
+  int(%d)
+  ["sqltext"]=>
+  string(29) "select doesnotexist from dual"
+}
+
+Test 6 - Execute - after successful 2nd query with new handle
+bool(false)
+bool(false)
+array(4) {
+  ["code"]=>
+  int(904)
+  ["message"]=>
+  string(%d) "ORA-00904:%sDOESNOTEXIST%s"
+  ["offset"]=>
+  int(%d)
+  ["sqltext"]=>
+  string(29) "select doesnotexist from dual"
+}
+Execute status is true
+2nd call after successful execute
+bool(false)
+bool(false)
+array(4) {
+  ["code"]=>
+  int(904)
+  ["message"]=>
+  string(%d) "ORA-00904:%sDOESNOTEXIST%s"
+  ["offset"]=>
+  int(%d)
+  ["sqltext"]=>
+  string(29) "select doesnotexist from dual"
+}
+bool(false)
+
+Test 7 - Execute - after successful 2nd query with same handle
+bool(false)
+bool(false)
+array(4) {
+  ["code"]=>
+  int(904)
+  ["message"]=>
+  string(%d) "ORA-00904:%sDOESNOTEXIST%s"
+  ["offset"]=>
+  int(%d)
+  ["sqltext"]=>
+  string(29) "select doesnotexist from dual"
+}
+Execute status is true
+2nd call after successful execute
+bool(false)
+bool(false)
+bool(false)
+
+Test 8 - Execute - after unsuccessful 2nd query with new handle
+bool(false)
+bool(false)
+array(4) {
+  ["code"]=>
+  int(904)
+  ["message"]=>
+  string(%d) "ORA-00904:%sDOESNOTEXIST%s"
+  ["offset"]=>
+  int(%d)
+  ["sqltext"]=>
+  string(29) "select doesnotexist from dual"
+}
+
+Warning: oci_execute(): ORA-00904: %sREALLYNOTHERE%s in %sbug51291_1.php on line %d
+Execute status is false
+2nd call after unsuccessful execute
+bool(false)
+bool(false)
+array(4) {
+  ["code"]=>
+  int(904)
+  ["message"]=>
+  string(%d) "ORA-00904:%sDOESNOTEXIST%s"
+  ["offset"]=>
+  int(%d)
+  ["sqltext"]=>
+  string(29) "select doesnotexist from dual"
+}
+array(4) {
+  ["code"]=>
+  int(904)
+  ["message"]=>
+  string(%d) "ORA-00904%sREALLYNOTHERE%s"
+  ["offset"]=>
+  int(%d)
+  ["sqltext"]=>
+  string(30) "select reallynothere from dual"
+}
+
+Test 9 - Execute - after unsuccessful 2nd query with same handle
+bool(false)
+bool(false)
+array(4) {
+  ["code"]=>
+  int(904)
+  ["message"]=>
+  string(%d) "ORA-00904:%sDOESNOTEXIST%s"
+  ["offset"]=>
+  int(%d)
+  ["sqltext"]=>
+  string(29) "select doesnotexist from dual"
+}
+
+Warning: oci_execute(): ORA-00904: %sREALLYNOTHERE%s in %sbug51291_1.php on line %d
+Execute status is false
+2nd call after unsuccessful execute
+bool(false)
+bool(false)
+array(4) {
+  ["code"]=>
+  int(904)
+  ["message"]=>
+  string(%d) "ORA-00904%sREALLYNOTHERE%s"
+  ["offset"]=>
+  int(%d)
+  ["sqltext"]=>
+  string(30) "select reallynothere from dual"
+}
+===DONE===
diff --git a/ext/oci8/tests/bug51291_2.phpt b/ext/oci8/tests/bug51291_2.phpt
new file mode 100644 (file)
index 0000000..d5dbf6f
--- /dev/null
@@ -0,0 +1,56 @@
+--TEST--
+Bug #51291 (oci_error() doesn't report last error when called two times)
+--SKIPIF--
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs: different error messages from TimesTen
+require(dirname(__FILE__).'/skipif.inc');
+?> 
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+echo "\nTest 1 - Execute - after successful 2nd query with same statement\n";
+
+$s = oci_parse($c, "declare e exception; begin if :bv = 1 then raise e; end if; end;");
+$bv = 1;
+oci_bind_by_name($s, ":bv", $bv);
+$r = @oci_execute($s, OCI_DEFAULT);
+if (!$r) { 
+    var_dump(oci_error(), oci_error($c), oci_error($s));
+    $bv = 0;
+    $r = oci_execute($s, OCI_DEFAULT);
+    echo "Execute status is ";
+    if (is_null($r)) echo "null";
+    else if ($r === false) echo "false";
+    else if ($r === true) echo "true";
+    else echo $r;
+    echo "\n";
+    echo "2nd call after successful execute\n";
+    var_dump(oci_error(), oci_error($c), oci_error($s));
+}
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1 - Execute - after successful 2nd query with same statement
+bool(false)
+bool(false)
+array(4) {
+  ["code"]=>
+  int(6510)
+  ["message"]=>
+  string(72) "ORA-06510: PL/SQL: %s
+ORA-06512: %s"
+  ["offset"]=>
+  int(0)
+  ["sqltext"]=>
+  string(64) "declare e exception; begin if :bv = 1 then raise e; end if; end;"
+}
+Execute status is true
+2nd call after successful execute
+bool(false)
+bool(false)
+bool(false)
+===DONE===
index 57d3cf1b4793daf3feda28cd5395cc7b19a5bd36..625d71a2950d7247b949650a34e7870338a5eadb 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 oci_new_collection()
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index 6d3051989790c9f5bcbd50c44680c986db88e15e..cd068ff0b2d0052ad366b688b6bda42ac994df96 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 oci_new_collection() + free()
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index 58e641ee24326efedfb07b84bf23568250761bee..9d8e4cf9761f46cf5aa14c3361ad0310ee08bfa1 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 oci_new_collection() + free()
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index b5236ef6f6ca4dfdec991d7779cec281a8035b3f..d7c52fe8e2702118cbe70fcbc0643db07b4f0829 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 collection methods
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index f5c6dc7f383732e495b434336513e6f425b3034f..58655a55fe2da03d686f9d05db8f4901902cfc4a 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 collection methods
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index eb2ac7e26d9e79ea6b0dc7744fd4f38cf45018a1..f71db4d0fb8f833afb04541c03dc172a6b477a94 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 oci_collection_assign()
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index 57dff2eb35e6ed6bda133dcbe4e9cd017bb0366b..8f24363e1d6d89f37cd20457c6e5da90715f3931 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 oci_collection_assign()
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index 0f40069964f2e3fd9a3de45c23a6449dc7c4ffcd..84084e7dd3fd8567a8626c70acd24da216175359 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 ocinewcollection()
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index cf258cbe34430061eb02d69b7f8abf64ca9959fb..4799eb6b794cd3a6e2fc7aad6e9cb43ca09de0f3 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 ocinewcollection() + free()
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index 56707d6087a407342b3ba608fec094383cb6deeb..3d65606148e19fd323ccbc0fe75a285dd913731b 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 ocinewcollection() + free()
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index 31e10c065e3a55eb2594e3fe29dba9f91bd314b2..86ce62f79ec1fb7c02a631b0b532bc27f83769ca 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 collection methods
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index 57d44cc9abfd859837f06a8a0745871908ee805e..431d5d6351421aec681486818f3db50c2c452220 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 ocicollassign()
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index 296d6493e218098feae86f7c082323a1ec206888..917af5f2c57148bf8c4fa003603f54544b665ba4 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 collections and wrong dates
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index 3ed416ce0938aa94385cb516f77df3ca9ab5e5e4..0c5b46ddd41051387abb1d9505e660741e91c8c5 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 collections and wrong dates
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index 6f72dd16c1bbd2e7fbd78e141739f10a7ce6824e..da088e919d0cb0339d53a626f097115bdf2832af 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 collections and nulls
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index 7b63a276f349af82ff317c9654fd6ef9654574e7..c5379ac9f3bf1490c749c7e2f6c5a9b5f81ddf4f 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 collections and nulls
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index 7d805d3f70fad27ac93e099a0105c487929abfae..3e8aa9d6a317c073e4cdf3976b4e39ed116393d4 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 collections and strings
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index dca640e846d017b17d47f14ae3ed34cd20f4ee97..3871dd90e1d4b7a6c7c4b6249e2c7608b7291c1f 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 collections and strings
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index 543dafd902bc76561f9a5e371a87b6da458c878a..4b912a80f81cd7e822115099225578f5d78eb170 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 collections and correct dates
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index fd1019e411e3bdb6da0cd16a8ac5f0fca6ac39f3..574281d1494728e1191c68f1bf72524f3627e206 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 collections and correct dates
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index 00d88bb9a4bb661d5ccdcfd009c89c645dd38c74..04f549845e58d1b066aae137b0ce649dea0af8d5 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 collections and correct dates (2)
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index 0d01bc1744cc9f6faa37781dc98302c0c6f66a12..1992b94f682c7c29fd7524cb906b7c2a4d373aaa 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 collections and correct dates (2)
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index 8458525ae5852702bd6fd970542c8b5794a27003..e89f4a37bffd333c2a2d06c35f3bc14f55a225f9 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 collections and strings (2)
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index a0fe555b618450282674d4abee429878e3723163..7d771633d216a0132cde00732687f8ec1768c11e 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 collections and strings (2)
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index 64b0aea106e2ca77aff1fa52cfc483cdec217911..c422d211b7c7dd69d02fc2549e402931a6d63326 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 collections and numbers (2)
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index eeed7839a7d337de16610a433ef565dc05c1d256..18e21dd934e38ad0eee518ee9af0d8187b04e923 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 collections and numbers (2)
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index c2af9cc22d3032d72ecee6682f52d35e83690a1d..2e06e2959c10bb60bf171a03cd13cd5a6e6e16c1 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 collections and negative/too big element indexes
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index cde26f22f09219815de551eb6d426d60f08601fc..67830af25c1c2099be8b962eb5542886670624c9 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 collections and negative/too big element indexes
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index 42347ba6f8ff2ce3bbef8865768ab013d8d46e75..56f509965dac06cbfad420769faaabbf4ce08b05 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 collections and nulls (2)
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index 914844ae61e44cb3e2b2c57aab17e0b58bce3b04..3440195fe610d61187dfba31d618ffa9d49e5bd7 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 collections and nulls (2)
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index f97cc49e7c4f8d3ef27f776071c137577c38de06..a3f0b29ce5c80fe3be23e87a4ab5c8721a5f85d7 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 Collection trim tests
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index 15a673d7188f0f11f024ecd6ad8e85c25de26af8..371c802ede8c416939a7ce2dd981cd352b6a77bb 100644 (file)
@@ -1,7 +1,13 @@
 --TEST--
 Test collection Oracle error handling collections and numbers (2)
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index 836d2cd1dfeafd9279014f5b636f8750c9231b07..806fb193a0e7c6cc98a80c5cea1beb392749b2d6 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 Test OCI_NO_AUTO_COMMIT constant
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index 1819fe116b5ac1be87979fc97789bd7f51ab6871..4079ac0c30784c49e471efa7a288f095c5d0dd3a 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 Test oci_commit failure
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
@@ -16,21 +19,7 @@ $stmtarray = array(
        y int constraint commit_002_tab_check_y check ( y > 0 ) deferrable initially deferred)"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       $r = @oci_execute($s);
-       if (!$r) {
-               $m = oci_error($s);
-               if (!in_array($m['code'], array(   // ignore expected errors
-                           942 // table or view does not exist
-                       ,  2289 // sequence does not exist
-                       ,  4080 // trigger does not exist
-                       , 38802 // edition does not exist
-                ))) {
-                       echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
-               }
-       }
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 // Run Test
 
@@ -68,12 +57,7 @@ $stmtarray = array(
        "drop table commit_002_tab"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       oci_execute($s);
-}
-
-oci_close($c);
+oci8_test_sql_execute($c, $stmtarray);
 
 ?>
 ===DONE===
index 196e0650cc125885e172713ac7b2c5f130ae4ee7..012fc0237207a8f699c7918b33ca25ed18980241 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 ocicommit()/ocirollback()
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index c7c1b870e520ebe9f85b4eb304c0553d48da9449..ad508a2ed2a4fd2206e682315e9826f9c87d30c2 100644 (file)
@@ -2,24 +2,17 @@
 Set and get of connection attributes with all types of connections.
 --SKIPIF--
 <?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); 
-require(dirname(__FILE__)."/connect.inc");
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+
 if (strcasecmp($user, "system") && strcasecmp($user, "sys"))
     die("skip needs to be run as a DBA user");
 if ($test_drcp) die("skip output might vary with DRCP");
 
-$sv = oci_server_version($c);
-$sv = preg_match('/Release 1[012]\./', $sv, $matches);
-if ($sv == 1) {
-    ob_start();
-    phpinfo(INFO_MODULES);
-    $phpinfo = ob_get_clean();
-    $iv = preg_match('/Oracle .*Version => 1[012]\./', $phpinfo);
-    if ($iv != 1) {
-        die ("skip test expected to work only with Oracle 10g or greater client ");
-    }
-}
-else {
-    die ("skip test expected to work only with Oracle 10g or greater server");
+if (preg_match('/Release 1[01]\./', oci_server_version($c), $matches) !== 1) {
+       die("skip expected output only valid when using Oracle 10g or greater database server");
+} else if (preg_match('/^1[01]\./', oci_client_version()) != 1) {
+    die("skip test expected to work only with Oracle 10g or greater version of client");
 }
 
 ?>
index 4765d5eb7b8702426d10c0f0f450d898d987bc63..1072503529d380ec50e941788721fb608161dd33 100644 (file)
@@ -1,25 +1,19 @@
 --TEST--
 Set and get of connection attributes across persistent connections and sysdba connection.
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); 
-require(dirname(__FILE__)."/connect.inc");
+<?php 
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+
 if (strcasecmp($user, "system") && strcasecmp($user, "sys")) die("skip needs to be run as a DBA user");
 if ($test_drcp) die("skip output might vary with DRCP");
 
-$sv = oci_server_version($c);
-$sv = preg_match('/Release 1[012]\./', $sv, $matches);
-if ($sv == 1) {
-    ob_start();
-    phpinfo(INFO_MODULES);
-    $phpinfo = ob_get_clean();
-    $iv = preg_match('/Oracle .*Version => 1[012]\./', $phpinfo);
-    if ($iv != 1) {
-        die ("skip test expected to work only with Oracle 10g or greater version of client");
-    }
-}
-else {
-    die ("skip test expected to work only with Oracle 10g or greater version of server");
+if (preg_match('/Release 1[01]\./', oci_server_version($c), $matches) !== 1) {
+       die("skip expected output only valid when using Oracle 10g or greater database server");
+} else if (preg_match('/^1[01]\./', oci_client_version()) != 1) {
+    die("skip test expected to work only with Oracle 10g or greater version of client");
 }
+
 ?>
 --INI--
 oci8.privileged_connect = On
index 8b6d92123027ae3b8e112b5ee6e76c125adac491..be8d3306de129eb61466a27bbf732e2e0d1c455e 100644 (file)
@@ -1,24 +1,17 @@
 --TEST--
 Set and get of connection attributes with oci_close().
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); 
-require(dirname(__FILE__)."/connect.inc");
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+
 if (strcasecmp($user, "system") && strcasecmp($user, "sys")) die("skip needs to be run as a DBA user");
 if ($test_drcp) die("skip output might vary with DRCP");
 
-$sv = oci_server_version($c);
-$sv = preg_match('/Release 1[012]\./', $sv, $matches);
-if ($sv == 1) {
-    ob_start();
-    phpinfo(INFO_MODULES);
-    $phpinfo = ob_get_clean();
-    $iv = preg_match('/Oracle .*Version => 1[012]\./', $phpinfo);
-    if ($iv != 1) {
-        die ("skip test expected to work only with Oracle 10g or greater version of client");
-    }
-}
-else {
-    die ("skip test expected to work only with Oracle 10g or greater version of server");
+if (preg_match('/Release 1[01]\./', oci_server_version($c), $matches) !== 1) {
+       die("skip expected output only valid when using Oracle 10g or greater database server");
+} else if (preg_match('/^1[01]\./', oci_client_version()) != 1) {
+    die("skip test expected to work only with Oracle 10g or greater version of client");
 }
 ?>
 --FILE--
index 9f55f532635d19cefe248878a51b9e1752ca1ab2..b1a22858a862609b4ba3ae86aa6d8f2644656301 100644 (file)
@@ -1,29 +1,25 @@
 --TEST--
 Set and get of connection attributes with errors.
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); 
-require(dirname(__FILE__)."/connect.inc");
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+
 if (strcasecmp($user, "system") && strcasecmp($user, "sys")) die("skip needs to be run as a DBA user");
 if ($test_drcp) die("skip output might vary with DRCP");
 if ($stress_test !== true) die ('skip Slow test not run when $stress_test is FALSE');
 
-$sv = oci_server_version($c);
-$sv = preg_match('/Release 1[012]\./', $sv, $matches);
-if ($sv == 1) {
-    ob_start();
-    phpinfo(INFO_MODULES);
-    $phpinfo = ob_get_clean();
-    $iv = preg_match('/Oracle .*Version => 1[012]\./', $phpinfo);
-    if ($iv != 1) {
-        die ("skip test expected to work only with Oracle 10g or greater version of client");
-    }
-}
-else {
-    die ("skip test expected to work only with Oracle 10g or greater version of server");
+if (preg_match('/Release (11\.2|12)\./', oci_server_version($c), $matches) !== 1) {
+    // Bug fixed in 11.2 prevents client_info being rest
+       die("skip expected output only valid when using Oracle 11gR2 or greater database server");
+} else if (preg_match('/^1[01]\./', oci_client_version()) != 1) {
+    die("skip test expected to work only with Oracle 10g or greater version of client");
 }
 ?>
 --FILE--
 <?php
+
+
 require(dirname(__FILE__)."/conn_attr.inc");
 
 $user='testuser';
@@ -56,6 +52,7 @@ var_dump(oci_set_action($c1,'ACTION1'));
 get_attr($c1,'ACTION');
 
 // Testing with different types of values
+// NB.  This may diff in 11.1.0.6 due to a bug causing CLIENT_INFO of NULL to be ignored.
 echo "\nSetting to different values \n";
 $values_array = array(1000,NULL,'this is a very huge string with a length  > 64 !!!!!this is a very huge string with a length  > 64 !!!!!this is a very huge string with a length  > 64 !!!!!this is a very huge string with a length  > 64 !!!!!');
 
index 9f6b6c72479875443994492376c34d74b86f30b6..d694ec06a5bdc267433c78f95dda152d2432b4e9 100644 (file)
@@ -1,24 +1,17 @@
 --TEST--
 Set and get connection attributes with scope end.
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); 
-require(dirname(__FILE__)."/connect.inc");
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+
 if (strcasecmp($user, "system") && strcasecmp($user, "sys")) die("skip needs to be run as a DBA user");
 if ($test_drcp) die("skip output might vary with DRCP");
 
-$sv = oci_server_version($c);
-$sv = preg_match('/Release 1[012]\./', $sv, $matches);
-if ($sv == 1) {
-    ob_start();
-    phpinfo(INFO_MODULES);
-    $phpinfo = ob_get_clean();
-    $iv = preg_match('/Oracle .*Version => 1[012]\./', $phpinfo);
-    if ($iv != 1) {
-        die ("skip test expected to work only with Oracle 10g or greater version of client");
-    }
-}
-else {
-    die ("skip test expected to work only with Oracle 10g or greater version of server");
+if (preg_match('/Release 1[01]\./', oci_server_version($c), $matches) !== 1) {
+       die("skip expected output only valid when using Oracle 10g or greater database server");
+} else if (preg_match('/^1[01]\./', oci_client_version()) != 1) {
+    die("skip test expected to work only with Oracle 10g or greater version of client");
 }
 ?>
 --FILE--
index 5e340cf6fad386099ce6aad61210201207aefbdb..06d13485686038e8ec16277ddae937ebcd265edf 100644 (file)
@@ -10,9 +10,8 @@ else {
 }
 
 if (!$c) {
-    echo "connect.inc: Failed to connect as '$user' to '$dbase'\n";
-    $e = oci_error();
-    echo $e['message']."\n";
+    $m = oci_error();
+    trigger_error("connect.inc: Failed to connect as '$user' to '$dbase': ". $m['message'], E_USER_ERROR);
 }
 
 ?>
index d6d16f17eecbbe38a65e9d245a18f290a2c9dbbc..d265d1da9f1083b39dea3ee461468ca5456b58af 100644 (file)
@@ -19,10 +19,7 @@ if (!empty($dbase))
 else
        $c1 = oci_new_connect($user,$password);
                                                                                                 
-foreach ($stmtarray as $stmt) {
-       $s1 = oci_parse($c1, $stmt);
-       @oci_execute($s1);
-}
+oci8_test_sql_execute($c1, $stmtarray);
 
 // Run Test
 
@@ -66,10 +63,7 @@ $stmtarray = array(
        "drop table connect_scope1_tab"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s1 = oci_parse($c1, $stmt);
-       oci_execute($s1);
-}
+oci8_test_sql_execute($c1, $stmtarray);
 
 echo "Done\n";
 
index 7017493f5a062d23f928113dd3542460b4ce6b6e..7d05c114118c350c1dbd0818f80e3b5e6fa12745 100644 (file)
@@ -19,10 +19,7 @@ if (!empty($dbase))
 else
        $c1 = oci_new_connect($user,$password);
                                                                                                 
-foreach ($stmtarray as $stmt) {
-       $s1 = oci_parse($c1, $stmt);
-       @oci_execute($s1);
-}
+oci8_test_sql_execute($c1, $stmtarray);
 
 // Run Test
 
@@ -66,10 +63,7 @@ $stmtarray = array(
        "drop table connect_scope2_tab"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s1 = oci_parse($c1, $stmt);
-       oci_execute($s1);
-}
+oci8_test_sql_execute($c1, $stmtarray);
 
 echo "Done\n";
 
index a881ea6eadf8d01d822dab8b80d8f99acd078a09..7f26d4334d08574a758220806f5da1d5459c839c 100644 (file)
@@ -21,10 +21,7 @@ if (!empty($dbase))
 else
        $c1 = oci_new_connect($user,$password);
                                                 
-foreach ($stmtarray as $stmt) {
-       $s1 = oci_parse($c1, $stmt);
-       @oci_execute($s1);
-}
+oci8_test_sql_execute($c1, $stmtarray);
 
 // Run Test
 
@@ -73,17 +70,14 @@ $stmtarray = array(
        "drop table scope_try1_tab"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s1 = oci_parse($c1, $stmt);
-       oci_execute($s1);
-}
+oci8_test_sql_execute($c1, $stmtarray);
 
 echo "Done\n";
 
 ?>
 --EXPECTF--
 Test 1
-Caught Exception: oci_execute(): ORA-00984: %s
+Caught Exception: oci_execute(): ORA-%r(00984|57000: TT2957)%r: %s
 resource(%d) of type (oci8 connection)
 array(1) {
   ["C1"]=>
index 9e6b5ce2e0656f21a0de2ae089bf94c572688574..94adb85e938631b0a0f551f64a19fa0dbb53713a 100644 (file)
@@ -21,10 +21,7 @@ if (!empty($dbase))
 else
        $c1 = oci_new_connect($user,$password);
                                                 
-foreach ($stmtarray as $stmt) {
-       $s1 = oci_parse($c1, $stmt);
-       @oci_execute($s1);
-}
+oci8_test_sql_execute($c1, $stmtarray);
 
 // Run Test
 
@@ -73,17 +70,14 @@ $stmtarray = array(
        "drop table scope_try2_tab"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s1 = oci_parse($c1, $stmt);
-       oci_execute($s1);
-}
+oci8_test_sql_execute($c1, $stmtarray);
 
 echo "Done\n";
 
 ?>
 --EXPECTF--
 Test 1
-Caught Exception: oci_execute(): ORA-00984: %s
+Caught Exception: oci_execute(): ORA-%r(00984|57000: TT2957)%r: %s
 resource(%d) of type (oci8 connection)
 array(1) {
   ["C1"]=>
index 1cd44b0218bfe9325ddcf3b71df1589dcfaa1321..e7891a1073399657963f625025fd83dad7f2aad0 100644 (file)
@@ -21,10 +21,7 @@ if (!empty($dbase))
 else
        $c1 = oci_new_connect($user,$password);
                                                 
-foreach ($stmtarray as $stmt) {
-       $s1 = oci_parse($c1, $stmt);
-       @oci_execute($s1);
-}
+oci8_test_sql_execute($c1, $stmtarray);
 
 // Run Test
 
@@ -73,17 +70,14 @@ $stmtarray = array(
        "drop table scope_try3_tab"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s1 = oci_parse($c1, $stmt);
-       oci_execute($s1);
-}
+oci8_test_sql_execute($c1, $stmtarray);
 
 echo "Done\n";
 
 ?>
 --EXPECTF--
 Test 1
-Caught Exception: oci_execute(): ORA-00984: %s
+Caught Exception: oci_execute(): ORA-%r(00984|57000: TT2957)%r: %s
 resource(%d) of type (oci8 connection)
 array(1) {
   ["C1"]=>
index 9b4cd1f278ac705d6e84058fecbb9c482ad7dba9..40369c67ba3f4de543270946d560d2b66676a0ec 100644 (file)
@@ -21,10 +21,7 @@ if (!empty($dbase))
 else
        $c1 = oci_new_connect($user,$password);
                                                 
-foreach ($stmtarray as $stmt) {
-       $s1 = oci_parse($c1, $stmt);
-       @oci_execute($s1);
-}
+oci8_test_sql_execute($c1, $stmtarray);
 
 // Run Test
 
@@ -73,17 +70,14 @@ $stmtarray = array(
        "drop table scope_try4_tab"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s1 = oci_parse($c1, $stmt);
-       oci_execute($s1);
-}
+oci8_test_sql_execute($c1, $stmtarray);
 
 echo "Done\n";
 
 ?>
 --EXPECTF--
 Test 1
-Caught Exception: oci_execute(): ORA-00984: %s
+Caught Exception: oci_execute(): ORA-%r(00984|57000: TT2957)%r: %s
 resource(%d) of type (oci8 connection)
 array(1) {
   ["C1"]=>
index 121fb33dc5f923fcab02562751dc202a1dc26a5f..3afc87b9156864cd6fa2f27a5cad5c6a2b3d2a08 100644 (file)
@@ -21,10 +21,7 @@ if (!empty($dbase))
 else
        $c1 = oci_new_connect($user,$password);
                                                 
-foreach ($stmtarray as $stmt) {
-       $s1 = oci_parse($c1, $stmt);
-       @oci_execute($s1);
-}
+oci8_test_sql_execute($c1, $stmtarray);
 
 // Run Test
 
@@ -73,17 +70,14 @@ $stmtarray = array(
        "drop table scope_try5_tab"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s1 = oci_parse($c1, $stmt);
-       oci_execute($s1);
-}
+oci8_test_sql_execute($c1, $stmtarray);
 
 echo "Done\n";
 
 ?>
 --EXPECTF--
 Test 1
-Caught Exception: oci_execute(): ORA-00984: %s
+Caught Exception: oci_execute(): ORA-%r(00984|57000: TT2957)%r: %s
 resource(%d) of type (oci8 persistent connection)
 array(1) {
   ["C1"]=>
index 3347543ab85b9512696cade99996ccee94c1cd76..d7b4edfdbe3b79572ae8ea53e0902ef0043d0167 100644 (file)
@@ -21,10 +21,7 @@ if (!empty($dbase))
 else
        $c1 = oci_new_connect($user,$password);
                                                 
-foreach ($stmtarray as $stmt) {
-       $s1 = oci_parse($c1, $stmt);
-       @oci_execute($s1);
-}
+oci8_test_sql_execute($c1, $stmtarray);
 
 // Run Test
 
@@ -73,17 +70,14 @@ $stmtarray = array(
        "drop table scope_try6_tab"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s1 = oci_parse($c1, $stmt);
-       oci_execute($s1);
-}
+oci8_test_sql_execute($c1, $stmtarray);
 
 echo "Done\n";
 
 ?>
 --EXPECTF--
 Test 1
-Caught Exception: oci_execute(): ORA-00984: %s
+Caught Exception: oci_execute(): ORA-%r(00984|57000: TT2957)%r: %s
 resource(%d) of type (oci8 persistent connection)
 array(1) {
   ["C1"]=>
index be99a8bd6e402323e04f175905861185b1719c20..1620803dbb738d5f781a8db931f357f9f4a0775c 100644 (file)
@@ -10,9 +10,8 @@ $ov = preg_match('/Compile-time ORACLE_HOME/', $phpinfo);
 if ($ov != 1) {
        die ("skip Test only valid when OCI8 is built with an ORACLE_HOME");
 }
-$iv = preg_match('/Oracle .*Version => (11\.2|12)/', $phpinfo);
-if ($iv != 1) {
-        die ("skip tests a feature that works only with Oracle 11gR2 or greater version of client");
+if (preg_match('/^11\.2|12\./', oci_client_version()) != 1) {
+    die("skip test expected to work only with Oracle 11gR2 or greater version of client");
 }
 ?>
 --ENV--
index 602d55ff8fb4f7b471ba1a5c9338d99e8d116de0..5a731337af13c80ed0fd5f09deae3b8e2a020d94 100644 (file)
@@ -10,9 +10,8 @@ $ov = preg_match('/Compile-time ORACLE_HOME/', $phpinfo);
 if ($ov !== 1) {
        die ("skip Test only valid when OCI8 is built with an ORACLE_HOME");
 }
-$iv = preg_match('/Oracle .*Version => (10\.2)/', $phpinfo);
-if ($iv != 1) {
-    die ("skip tests a feature that works only with Oracle 10gR2");
+if (preg_match('/^10\.2\./', oci_client_version()) != 1) {
+    die("skip test expected to work only with Oracle 10gR2 client libraries");
 }
 ?>
 --ENV--
index 9bb42e75a425a6e15cc0173f76a5b8d536b76223..c7cfecf396119eb8fa197be802f9ba9d4a9cae20 100644 (file)
@@ -10,9 +10,8 @@ $ov = preg_match('/Compile-time ORACLE_HOME/', $phpinfo);
 if ($ov !== 1) {
        die ("skip Test only valid when OCI8 is built with an ORACLE_HOME");
 }
-$iv = preg_match('/Oracle .*Version => (11\.2|12)/', $phpinfo);
-if ($iv != 1) {
-    die ("skip tests a feature that works only with Oracle 11gR2 or greater version of client");
+if (preg_match('/^11\.2|12\./', oci_client_version()) != 1) {
+    die("skip test expected to work only with Oracle 11gR2 or greater version of client");
 }
 ?>
 --ENV--
index afd1fceb9b9f0af38b002630f2f73c2a724bd2e1..7335980682eade166c798a54a2964b2d19666c75 100644 (file)
@@ -1,11 +1,13 @@
 <?php
-    if ($c) {
-        $ora_sql = "DROP TABLE ".$schema.$table_name;
-        $statement = oci_parse($c, $ora_sql);
-        @oci_execute($statement);
-
-        $ora_sql = "CREATE TABLE ".$schema.$table_name." (id NUMBER, value NUMBER, blob BLOB, clob CLOB, string VARCHAR(10))";
-        $statement = oci_parse($c, $ora_sql);
-        oci_execute($statement);
-    }
+if ($c) {
+
+
+    $stmtarray = array(
+        "DROP TABLE ".$schema.$table_name,
+        "CREATE TABLE ".$schema.$table_name." (id NUMBER, value NUMBER, blob BLOB, clob CLOB, string VARCHAR(10))"
+    );
+
+    oci8_test_sql_execute($c, $stmtarray);
+
+}
 ?>
index c2ce15cb38ad27989dc66f7a3d13e934e2f045ae..740402e7e0fe7cee6360f47a5f4275e7b5671634 100644 (file)
@@ -1,54 +1,34 @@
 --TEST--
 bind and fetch cursor from a statement
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
-require dirname(__FILE__)."/connect.inc";
-
-$drop_table = "DROP TABLE ".$schema.$table_name."";
+require(dirname(__FILE__)."/connect.inc");
 
-if (!($s = oci_parse($c, $drop_table))) {
-       die("oci_parse(drop) failed!\n");
-}
+// Initialization
 
-@oci_execute($s);
-
-$create_table = "CREATE TABLE ".$schema.$table_name." (id NUMBER, value VARCHAR(20))";
-
-if (!($s = oci_parse($c, $create_table))) {
-       die("oci_parse(create) failed!\n");
-}
-
-if (!oci_execute($s)) {
-       die("oci_execute(create) failed!\n");
-}
-
-$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");
-}
-
-for ($i = 0; $i<3; $i++) {
-       if (!oci_execute($s)) {
-               die("oci_execute(insert) failed!\n");
-       }
-}
-
-if (!oci_commit($c)) {
-       die("oci_commit() failed!\n");
-}
+$stmtarray = array(
+    "drop table cursor_bind_tab",
+    "create table cursor_bind_tab (id NUMBER, value VARCHAR(20))",
+    "insert into cursor_bind_tab values (1, '1')",
+    "insert into cursor_bind_tab values (1, '1')",
+    "insert into cursor_bind_tab values (1, '1')"
+);
 
+oci8_test_sql_execute($c, $stmtarray);
 
 $sql = "
 DECLARE
 TYPE curtype IS REF CURSOR;
 cursor_var curtype;
 BEGIN
-       OPEN cursor_var FOR SELECT id, value FROM ".$schema.$table_name.";
-       :curs := cursor_var;
+    OPEN cursor_var FOR SELECT id, value FROM cursor_bind_tab;
+    :curs := cursor_var;
 END;
 ";
 
@@ -65,18 +45,18 @@ var_dump(oci_fetch_row($cursor));
 var_dump(oci_fetch_row($cursor));
 var_dump(oci_fetch_row($cursor));
 
-echo "Done\n";
+// Clean up
 
-$drop_table = "DROP TABLE ".$schema.$table_name."";
-
-if (!($s = oci_parse($c, $drop_table))) {
-       die("oci_parse(drop) failed!\n");
-}
+$stmtarray = array(
+    "drop table cursor_bind_tab"
+);
 
-@oci_execute($s);
+oci8_test_sql_execute($c, $stmtarray);
 
 ?>
---EXPECT--     
+===DONE===
+<?php exit(0); ?>
+--EXPECT--  
 array(2) {
   [0]=>
   string(1) "1"
@@ -96,4 +76,4 @@ array(2) {
   string(1) "1"
 }
 bool(false)
-Done
+===DONE===
index 33bd04b6d22dbb484121f727b318af25a65b0abf..197aad1d197ce0e71d8b01499339fc9fad1fb9a5 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 binding a cursor (with errors)
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
@@ -17,23 +20,7 @@ $stmtarray = array(
     "insert into cursor_bind_err_tab (id, value) values (1,1)",
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       $r = @oci_execute($s);
-       if (!$r) {
-               $m = oci_error($s);
-               if (!in_array($m['code'], array(   // ignore expected errors
-                    942 // table or view does not exist
-                ))) {
-                       echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
-               }
-       }
-}
-
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 // Run Test
 
@@ -54,10 +41,7 @@ $stmtarray = array(
     "drop table cursor_bind_err_tab"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 echo "Done\n";
 
index 22c89c9c5498c6e1ae336db90baa51995d3304cd..0919e44113cbc67499efbb6b59a131b29ba29d0b 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 fetching cursor from a statement
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index 73447c82b4ffc28e73c48588f2fcaf37299fa594..d60e2ff1ea43000b14f63b9fa4f5b48f1f0199c7 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 fetching cursor from a statement
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
@@ -17,23 +20,7 @@ $stmtarray = array(
     "insert into cursors_old_tab (id, value) values (1,1)",
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       $r = @oci_execute($s);
-       if (!$r) {
-               $m = oci_error($s);
-               if (!in_array($m['code'], array(   // ignore expected errors
-                        942 // table or view does not exist
-                ))) {
-                       echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
-               }
-       }
-}
-
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 // Run Test
 
@@ -58,10 +45,7 @@ $stmtarray = array(
     "drop table cursors_old_tab"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 echo "Done\n";
 
diff --git a/ext/oci8/tests/dbmsoutput.phpt b/ext/oci8/tests/dbmsoutput.phpt
new file mode 100644 (file)
index 0000000..eaace0f
--- /dev/null
@@ -0,0 +1,750 @@
+--TEST--
+PL/SQL: dbms_output
+--SKIPIF--
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+    "create or replace procedure dbmsoutput_proc as
+      begin
+        dbms_output.put_line('Hello World!');
+      end;",
+
+    "create or replace type dorow as table of varchar2(4000)",
+
+    "create or replace function mydofetch return dorow pipelined is
+    line    varchar2(4000);
+    status  integer;
+    begin
+      loop
+        dbms_output.get_line(line, status);
+        exit when status = 1;
+        pipe row (line);
+      end loop;
+      return;
+    end;"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+// Run Test
+
+// Turn DBMS_OUTPUT on
+function setserveroutputon($c)
+{
+    $s = oci_parse($c, "begin dbms_output.enable(null); end;");
+    oci_execute($s);
+}
+
+// Create some output
+function createoutput($c, $prefix)
+{
+    $s = oci_parse($c, "call dbms_output.put_line(:bv1 || ' ' || :bv2 || ' Hello, world! Lots and lots and ... of text')");
+    oci_bind_by_name($s, ":bv1", $i, -1, SQLT_INT);
+    oci_bind_by_name($s, ":bv2", $prefix);
+    for ($i = 0; $i < 100; ++$i) {
+        oci_execute($s);
+    }
+}
+
+// Call dbms_output.get_line()
+// Returns an array of DBMS_OUTPUT lines, or false.
+function getdbmsoutput_do($c)
+{
+    $s = oci_parse($c, "begin dbms_output.get_line(:ln, :st); end;");
+    oci_bind_by_name($s, ":ln", $ln, 100);
+    oci_bind_by_name($s, ":st", $st, -1, SQLT_INT);
+    $res = false;
+    while (($succ = oci_execute($s)) && !$st) {
+        $res[] = $ln;  // append each line to the array
+    }
+    return $res;
+}
+
+function getdbmsoutput_do2($c)
+{
+       $orignumlines = $numlines = 100;
+       $s = oci_parse($c, "begin dbms_output.get_lines(:lines, :numlines); end;");
+       $r = oci_bind_by_name($s, ":numlines", $numlines);
+       $res = array();
+       while ($numlines >= $orignumlines) {
+               oci_bind_array_by_name($s, ":lines", $lines,  $numlines, 255, SQLT_CHR);
+               oci_execute($s);
+               if ($numlines == 0) {
+                       break;
+               }
+               $res = array_merge($res, array_slice($lines, 0, $numlines));
+               unset($lines);
+       }
+       return $res;
+}
+
+function getdbmsoutput_pl($c)
+{
+    $s = oci_parse($c, "select * from table(mydofetch())");
+    oci_execute($s);
+    $res = false;
+    while ($row = oci_fetch_array($s, OCI_NUM)) {
+        $res[] = $row[0];
+    }
+    return $res;
+}
+
+echo "Test 1\n";
+
+setserveroutputon($c);   // Turn output buffering on
+
+$s = oci_parse($c, 'call dbmsoutput_proc()');
+oci_execute($s);
+var_dump(getdbmsoutput_do($c));
+
+echo "Test 2\n";
+
+createoutput($c, 'test 2');
+var_dump(getdbmsoutput_do($c));
+
+echo "Test 3\n";
+
+createoutput($c, 'test 3');
+var_dump(getdbmsoutput_do2($c));
+
+echo "Test 4\n";
+
+createoutput($c, 'test 4');
+var_dump(getdbmsoutput_pl($c));
+
+// Clean up
+
+$stmtarray = array(
+       "drop procedure dbmsoutput_proc"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1
+array(1) {
+  [0]=>
+  string(12) "Hello World!"
+}
+Test 2
+array(100) {
+  [0]=>
+  string(52) "0 test 2 Hello, world! Lots and lots and ... of text"
+  [1]=>
+  string(52) "1 test 2 Hello, world! Lots and lots and ... of text"
+  [2]=>
+  string(52) "2 test 2 Hello, world! Lots and lots and ... of text"
+  [3]=>
+  string(52) "3 test 2 Hello, world! Lots and lots and ... of text"
+  [4]=>
+  string(52) "4 test 2 Hello, world! Lots and lots and ... of text"
+  [5]=>
+  string(52) "5 test 2 Hello, world! Lots and lots and ... of text"
+  [6]=>
+  string(52) "6 test 2 Hello, world! Lots and lots and ... of text"
+  [7]=>
+  string(52) "7 test 2 Hello, world! Lots and lots and ... of text"
+  [8]=>
+  string(52) "8 test 2 Hello, world! Lots and lots and ... of text"
+  [9]=>
+  string(52) "9 test 2 Hello, world! Lots and lots and ... of text"
+  [10]=>
+  string(53) "10 test 2 Hello, world! Lots and lots and ... of text"
+  [11]=>
+  string(53) "11 test 2 Hello, world! Lots and lots and ... of text"
+  [12]=>
+  string(53) "12 test 2 Hello, world! Lots and lots and ... of text"
+  [13]=>
+  string(53) "13 test 2 Hello, world! Lots and lots and ... of text"
+  [14]=>
+  string(53) "14 test 2 Hello, world! Lots and lots and ... of text"
+  [15]=>
+  string(53) "15 test 2 Hello, world! Lots and lots and ... of text"
+  [16]=>
+  string(53) "16 test 2 Hello, world! Lots and lots and ... of text"
+  [17]=>
+  string(53) "17 test 2 Hello, world! Lots and lots and ... of text"
+  [18]=>
+  string(53) "18 test 2 Hello, world! Lots and lots and ... of text"
+  [19]=>
+  string(53) "19 test 2 Hello, world! Lots and lots and ... of text"
+  [20]=>
+  string(53) "20 test 2 Hello, world! Lots and lots and ... of text"
+  [21]=>
+  string(53) "21 test 2 Hello, world! Lots and lots and ... of text"
+  [22]=>
+  string(53) "22 test 2 Hello, world! Lots and lots and ... of text"
+  [23]=>
+  string(53) "23 test 2 Hello, world! Lots and lots and ... of text"
+  [24]=>
+  string(53) "24 test 2 Hello, world! Lots and lots and ... of text"
+  [25]=>
+  string(53) "25 test 2 Hello, world! Lots and lots and ... of text"
+  [26]=>
+  string(53) "26 test 2 Hello, world! Lots and lots and ... of text"
+  [27]=>
+  string(53) "27 test 2 Hello, world! Lots and lots and ... of text"
+  [28]=>
+  string(53) "28 test 2 Hello, world! Lots and lots and ... of text"
+  [29]=>
+  string(53) "29 test 2 Hello, world! Lots and lots and ... of text"
+  [30]=>
+  string(53) "30 test 2 Hello, world! Lots and lots and ... of text"
+  [31]=>
+  string(53) "31 test 2 Hello, world! Lots and lots and ... of text"
+  [32]=>
+  string(53) "32 test 2 Hello, world! Lots and lots and ... of text"
+  [33]=>
+  string(53) "33 test 2 Hello, world! Lots and lots and ... of text"
+  [34]=>
+  string(53) "34 test 2 Hello, world! Lots and lots and ... of text"
+  [35]=>
+  string(53) "35 test 2 Hello, world! Lots and lots and ... of text"
+  [36]=>
+  string(53) "36 test 2 Hello, world! Lots and lots and ... of text"
+  [37]=>
+  string(53) "37 test 2 Hello, world! Lots and lots and ... of text"
+  [38]=>
+  string(53) "38 test 2 Hello, world! Lots and lots and ... of text"
+  [39]=>
+  string(53) "39 test 2 Hello, world! Lots and lots and ... of text"
+  [40]=>
+  string(53) "40 test 2 Hello, world! Lots and lots and ... of text"
+  [41]=>
+  string(53) "41 test 2 Hello, world! Lots and lots and ... of text"
+  [42]=>
+  string(53) "42 test 2 Hello, world! Lots and lots and ... of text"
+  [43]=>
+  string(53) "43 test 2 Hello, world! Lots and lots and ... of text"
+  [44]=>
+  string(53) "44 test 2 Hello, world! Lots and lots and ... of text"
+  [45]=>
+  string(53) "45 test 2 Hello, world! Lots and lots and ... of text"
+  [46]=>
+  string(53) "46 test 2 Hello, world! Lots and lots and ... of text"
+  [47]=>
+  string(53) "47 test 2 Hello, world! Lots and lots and ... of text"
+  [48]=>
+  string(53) "48 test 2 Hello, world! Lots and lots and ... of text"
+  [49]=>
+  string(53) "49 test 2 Hello, world! Lots and lots and ... of text"
+  [50]=>
+  string(53) "50 test 2 Hello, world! Lots and lots and ... of text"
+  [51]=>
+  string(53) "51 test 2 Hello, world! Lots and lots and ... of text"
+  [52]=>
+  string(53) "52 test 2 Hello, world! Lots and lots and ... of text"
+  [53]=>
+  string(53) "53 test 2 Hello, world! Lots and lots and ... of text"
+  [54]=>
+  string(53) "54 test 2 Hello, world! Lots and lots and ... of text"
+  [55]=>
+  string(53) "55 test 2 Hello, world! Lots and lots and ... of text"
+  [56]=>
+  string(53) "56 test 2 Hello, world! Lots and lots and ... of text"
+  [57]=>
+  string(53) "57 test 2 Hello, world! Lots and lots and ... of text"
+  [58]=>
+  string(53) "58 test 2 Hello, world! Lots and lots and ... of text"
+  [59]=>
+  string(53) "59 test 2 Hello, world! Lots and lots and ... of text"
+  [60]=>
+  string(53) "60 test 2 Hello, world! Lots and lots and ... of text"
+  [61]=>
+  string(53) "61 test 2 Hello, world! Lots and lots and ... of text"
+  [62]=>
+  string(53) "62 test 2 Hello, world! Lots and lots and ... of text"
+  [63]=>
+  string(53) "63 test 2 Hello, world! Lots and lots and ... of text"
+  [64]=>
+  string(53) "64 test 2 Hello, world! Lots and lots and ... of text"
+  [65]=>
+  string(53) "65 test 2 Hello, world! Lots and lots and ... of text"
+  [66]=>
+  string(53) "66 test 2 Hello, world! Lots and lots and ... of text"
+  [67]=>
+  string(53) "67 test 2 Hello, world! Lots and lots and ... of text"
+  [68]=>
+  string(53) "68 test 2 Hello, world! Lots and lots and ... of text"
+  [69]=>
+  string(53) "69 test 2 Hello, world! Lots and lots and ... of text"
+  [70]=>
+  string(53) "70 test 2 Hello, world! Lots and lots and ... of text"
+  [71]=>
+  string(53) "71 test 2 Hello, world! Lots and lots and ... of text"
+  [72]=>
+  string(53) "72 test 2 Hello, world! Lots and lots and ... of text"
+  [73]=>
+  string(53) "73 test 2 Hello, world! Lots and lots and ... of text"
+  [74]=>
+  string(53) "74 test 2 Hello, world! Lots and lots and ... of text"
+  [75]=>
+  string(53) "75 test 2 Hello, world! Lots and lots and ... of text"
+  [76]=>
+  string(53) "76 test 2 Hello, world! Lots and lots and ... of text"
+  [77]=>
+  string(53) "77 test 2 Hello, world! Lots and lots and ... of text"
+  [78]=>
+  string(53) "78 test 2 Hello, world! Lots and lots and ... of text"
+  [79]=>
+  string(53) "79 test 2 Hello, world! Lots and lots and ... of text"
+  [80]=>
+  string(53) "80 test 2 Hello, world! Lots and lots and ... of text"
+  [81]=>
+  string(53) "81 test 2 Hello, world! Lots and lots and ... of text"
+  [82]=>
+  string(53) "82 test 2 Hello, world! Lots and lots and ... of text"
+  [83]=>
+  string(53) "83 test 2 Hello, world! Lots and lots and ... of text"
+  [84]=>
+  string(53) "84 test 2 Hello, world! Lots and lots and ... of text"
+  [85]=>
+  string(53) "85 test 2 Hello, world! Lots and lots and ... of text"
+  [86]=>
+  string(53) "86 test 2 Hello, world! Lots and lots and ... of text"
+  [87]=>
+  string(53) "87 test 2 Hello, world! Lots and lots and ... of text"
+  [88]=>
+  string(53) "88 test 2 Hello, world! Lots and lots and ... of text"
+  [89]=>
+  string(53) "89 test 2 Hello, world! Lots and lots and ... of text"
+  [90]=>
+  string(53) "90 test 2 Hello, world! Lots and lots and ... of text"
+  [91]=>
+  string(53) "91 test 2 Hello, world! Lots and lots and ... of text"
+  [92]=>
+  string(53) "92 test 2 Hello, world! Lots and lots and ... of text"
+  [93]=>
+  string(53) "93 test 2 Hello, world! Lots and lots and ... of text"
+  [94]=>
+  string(53) "94 test 2 Hello, world! Lots and lots and ... of text"
+  [95]=>
+  string(53) "95 test 2 Hello, world! Lots and lots and ... of text"
+  [96]=>
+  string(53) "96 test 2 Hello, world! Lots and lots and ... of text"
+  [97]=>
+  string(53) "97 test 2 Hello, world! Lots and lots and ... of text"
+  [98]=>
+  string(53) "98 test 2 Hello, world! Lots and lots and ... of text"
+  [99]=>
+  string(53) "99 test 2 Hello, world! Lots and lots and ... of text"
+}
+Test 3
+array(100) {
+  [0]=>
+  string(52) "0 test 3 Hello, world! Lots and lots and ... of text"
+  [1]=>
+  string(52) "1 test 3 Hello, world! Lots and lots and ... of text"
+  [2]=>
+  string(52) "2 test 3 Hello, world! Lots and lots and ... of text"
+  [3]=>
+  string(52) "3 test 3 Hello, world! Lots and lots and ... of text"
+  [4]=>
+  string(52) "4 test 3 Hello, world! Lots and lots and ... of text"
+  [5]=>
+  string(52) "5 test 3 Hello, world! Lots and lots and ... of text"
+  [6]=>
+  string(52) "6 test 3 Hello, world! Lots and lots and ... of text"
+  [7]=>
+  string(52) "7 test 3 Hello, world! Lots and lots and ... of text"
+  [8]=>
+  string(52) "8 test 3 Hello, world! Lots and lots and ... of text"
+  [9]=>
+  string(52) "9 test 3 Hello, world! Lots and lots and ... of text"
+  [10]=>
+  string(53) "10 test 3 Hello, world! Lots and lots and ... of text"
+  [11]=>
+  string(53) "11 test 3 Hello, world! Lots and lots and ... of text"
+  [12]=>
+  string(53) "12 test 3 Hello, world! Lots and lots and ... of text"
+  [13]=>
+  string(53) "13 test 3 Hello, world! Lots and lots and ... of text"
+  [14]=>
+  string(53) "14 test 3 Hello, world! Lots and lots and ... of text"
+  [15]=>
+  string(53) "15 test 3 Hello, world! Lots and lots and ... of text"
+  [16]=>
+  string(53) "16 test 3 Hello, world! Lots and lots and ... of text"
+  [17]=>
+  string(53) "17 test 3 Hello, world! Lots and lots and ... of text"
+  [18]=>
+  string(53) "18 test 3 Hello, world! Lots and lots and ... of text"
+  [19]=>
+  string(53) "19 test 3 Hello, world! Lots and lots and ... of text"
+  [20]=>
+  string(53) "20 test 3 Hello, world! Lots and lots and ... of text"
+  [21]=>
+  string(53) "21 test 3 Hello, world! Lots and lots and ... of text"
+  [22]=>
+  string(53) "22 test 3 Hello, world! Lots and lots and ... of text"
+  [23]=>
+  string(53) "23 test 3 Hello, world! Lots and lots and ... of text"
+  [24]=>
+  string(53) "24 test 3 Hello, world! Lots and lots and ... of text"
+  [25]=>
+  string(53) "25 test 3 Hello, world! Lots and lots and ... of text"
+  [26]=>
+  string(53) "26 test 3 Hello, world! Lots and lots and ... of text"
+  [27]=>
+  string(53) "27 test 3 Hello, world! Lots and lots and ... of text"
+  [28]=>
+  string(53) "28 test 3 Hello, world! Lots and lots and ... of text"
+  [29]=>
+  string(53) "29 test 3 Hello, world! Lots and lots and ... of text"
+  [30]=>
+  string(53) "30 test 3 Hello, world! Lots and lots and ... of text"
+  [31]=>
+  string(53) "31 test 3 Hello, world! Lots and lots and ... of text"
+  [32]=>
+  string(53) "32 test 3 Hello, world! Lots and lots and ... of text"
+  [33]=>
+  string(53) "33 test 3 Hello, world! Lots and lots and ... of text"
+  [34]=>
+  string(53) "34 test 3 Hello, world! Lots and lots and ... of text"
+  [35]=>
+  string(53) "35 test 3 Hello, world! Lots and lots and ... of text"
+  [36]=>
+  string(53) "36 test 3 Hello, world! Lots and lots and ... of text"
+  [37]=>
+  string(53) "37 test 3 Hello, world! Lots and lots and ... of text"
+  [38]=>
+  string(53) "38 test 3 Hello, world! Lots and lots and ... of text"
+  [39]=>
+  string(53) "39 test 3 Hello, world! Lots and lots and ... of text"
+  [40]=>
+  string(53) "40 test 3 Hello, world! Lots and lots and ... of text"
+  [41]=>
+  string(53) "41 test 3 Hello, world! Lots and lots and ... of text"
+  [42]=>
+  string(53) "42 test 3 Hello, world! Lots and lots and ... of text"
+  [43]=>
+  string(53) "43 test 3 Hello, world! Lots and lots and ... of text"
+  [44]=>
+  string(53) "44 test 3 Hello, world! Lots and lots and ... of text"
+  [45]=>
+  string(53) "45 test 3 Hello, world! Lots and lots and ... of text"
+  [46]=>
+  string(53) "46 test 3 Hello, world! Lots and lots and ... of text"
+  [47]=>
+  string(53) "47 test 3 Hello, world! Lots and lots and ... of text"
+  [48]=>
+  string(53) "48 test 3 Hello, world! Lots and lots and ... of text"
+  [49]=>
+  string(53) "49 test 3 Hello, world! Lots and lots and ... of text"
+  [50]=>
+  string(53) "50 test 3 Hello, world! Lots and lots and ... of text"
+  [51]=>
+  string(53) "51 test 3 Hello, world! Lots and lots and ... of text"
+  [52]=>
+  string(53) "52 test 3 Hello, world! Lots and lots and ... of text"
+  [53]=>
+  string(53) "53 test 3 Hello, world! Lots and lots and ... of text"
+  [54]=>
+  string(53) "54 test 3 Hello, world! Lots and lots and ... of text"
+  [55]=>
+  string(53) "55 test 3 Hello, world! Lots and lots and ... of text"
+  [56]=>
+  string(53) "56 test 3 Hello, world! Lots and lots and ... of text"
+  [57]=>
+  string(53) "57 test 3 Hello, world! Lots and lots and ... of text"
+  [58]=>
+  string(53) "58 test 3 Hello, world! Lots and lots and ... of text"
+  [59]=>
+  string(53) "59 test 3 Hello, world! Lots and lots and ... of text"
+  [60]=>
+  string(53) "60 test 3 Hello, world! Lots and lots and ... of text"
+  [61]=>
+  string(53) "61 test 3 Hello, world! Lots and lots and ... of text"
+  [62]=>
+  string(53) "62 test 3 Hello, world! Lots and lots and ... of text"
+  [63]=>
+  string(53) "63 test 3 Hello, world! Lots and lots and ... of text"
+  [64]=>
+  string(53) "64 test 3 Hello, world! Lots and lots and ... of text"
+  [65]=>
+  string(53) "65 test 3 Hello, world! Lots and lots and ... of text"
+  [66]=>
+  string(53) "66 test 3 Hello, world! Lots and lots and ... of text"
+  [67]=>
+  string(53) "67 test 3 Hello, world! Lots and lots and ... of text"
+  [68]=>
+  string(53) "68 test 3 Hello, world! Lots and lots and ... of text"
+  [69]=>
+  string(53) "69 test 3 Hello, world! Lots and lots and ... of text"
+  [70]=>
+  string(53) "70 test 3 Hello, world! Lots and lots and ... of text"
+  [71]=>
+  string(53) "71 test 3 Hello, world! Lots and lots and ... of text"
+  [72]=>
+  string(53) "72 test 3 Hello, world! Lots and lots and ... of text"
+  [73]=>
+  string(53) "73 test 3 Hello, world! Lots and lots and ... of text"
+  [74]=>
+  string(53) "74 test 3 Hello, world! Lots and lots and ... of text"
+  [75]=>
+  string(53) "75 test 3 Hello, world! Lots and lots and ... of text"
+  [76]=>
+  string(53) "76 test 3 Hello, world! Lots and lots and ... of text"
+  [77]=>
+  string(53) "77 test 3 Hello, world! Lots and lots and ... of text"
+  [78]=>
+  string(53) "78 test 3 Hello, world! Lots and lots and ... of text"
+  [79]=>
+  string(53) "79 test 3 Hello, world! Lots and lots and ... of text"
+  [80]=>
+  string(53) "80 test 3 Hello, world! Lots and lots and ... of text"
+  [81]=>
+  string(53) "81 test 3 Hello, world! Lots and lots and ... of text"
+  [82]=>
+  string(53) "82 test 3 Hello, world! Lots and lots and ... of text"
+  [83]=>
+  string(53) "83 test 3 Hello, world! Lots and lots and ... of text"
+  [84]=>
+  string(53) "84 test 3 Hello, world! Lots and lots and ... of text"
+  [85]=>
+  string(53) "85 test 3 Hello, world! Lots and lots and ... of text"
+  [86]=>
+  string(53) "86 test 3 Hello, world! Lots and lots and ... of text"
+  [87]=>
+  string(53) "87 test 3 Hello, world! Lots and lots and ... of text"
+  [88]=>
+  string(53) "88 test 3 Hello, world! Lots and lots and ... of text"
+  [89]=>
+  string(53) "89 test 3 Hello, world! Lots and lots and ... of text"
+  [90]=>
+  string(53) "90 test 3 Hello, world! Lots and lots and ... of text"
+  [91]=>
+  string(53) "91 test 3 Hello, world! Lots and lots and ... of text"
+  [92]=>
+  string(53) "92 test 3 Hello, world! Lots and lots and ... of text"
+  [93]=>
+  string(53) "93 test 3 Hello, world! Lots and lots and ... of text"
+  [94]=>
+  string(53) "94 test 3 Hello, world! Lots and lots and ... of text"
+  [95]=>
+  string(53) "95 test 3 Hello, world! Lots and lots and ... of text"
+  [96]=>
+  string(53) "96 test 3 Hello, world! Lots and lots and ... of text"
+  [97]=>
+  string(53) "97 test 3 Hello, world! Lots and lots and ... of text"
+  [98]=>
+  string(53) "98 test 3 Hello, world! Lots and lots and ... of text"
+  [99]=>
+  string(53) "99 test 3 Hello, world! Lots and lots and ... of text"
+}
+Test 4
+array(100) {
+  [0]=>
+  string(52) "0 test 4 Hello, world! Lots and lots and ... of text"
+  [1]=>
+  string(52) "1 test 4 Hello, world! Lots and lots and ... of text"
+  [2]=>
+  string(52) "2 test 4 Hello, world! Lots and lots and ... of text"
+  [3]=>
+  string(52) "3 test 4 Hello, world! Lots and lots and ... of text"
+  [4]=>
+  string(52) "4 test 4 Hello, world! Lots and lots and ... of text"
+  [5]=>
+  string(52) "5 test 4 Hello, world! Lots and lots and ... of text"
+  [6]=>
+  string(52) "6 test 4 Hello, world! Lots and lots and ... of text"
+  [7]=>
+  string(52) "7 test 4 Hello, world! Lots and lots and ... of text"
+  [8]=>
+  string(52) "8 test 4 Hello, world! Lots and lots and ... of text"
+  [9]=>
+  string(52) "9 test 4 Hello, world! Lots and lots and ... of text"
+  [10]=>
+  string(53) "10 test 4 Hello, world! Lots and lots and ... of text"
+  [11]=>
+  string(53) "11 test 4 Hello, world! Lots and lots and ... of text"
+  [12]=>
+  string(53) "12 test 4 Hello, world! Lots and lots and ... of text"
+  [13]=>
+  string(53) "13 test 4 Hello, world! Lots and lots and ... of text"
+  [14]=>
+  string(53) "14 test 4 Hello, world! Lots and lots and ... of text"
+  [15]=>
+  string(53) "15 test 4 Hello, world! Lots and lots and ... of text"
+  [16]=>
+  string(53) "16 test 4 Hello, world! Lots and lots and ... of text"
+  [17]=>
+  string(53) "17 test 4 Hello, world! Lots and lots and ... of text"
+  [18]=>
+  string(53) "18 test 4 Hello, world! Lots and lots and ... of text"
+  [19]=>
+  string(53) "19 test 4 Hello, world! Lots and lots and ... of text"
+  [20]=>
+  string(53) "20 test 4 Hello, world! Lots and lots and ... of text"
+  [21]=>
+  string(53) "21 test 4 Hello, world! Lots and lots and ... of text"
+  [22]=>
+  string(53) "22 test 4 Hello, world! Lots and lots and ... of text"
+  [23]=>
+  string(53) "23 test 4 Hello, world! Lots and lots and ... of text"
+  [24]=>
+  string(53) "24 test 4 Hello, world! Lots and lots and ... of text"
+  [25]=>
+  string(53) "25 test 4 Hello, world! Lots and lots and ... of text"
+  [26]=>
+  string(53) "26 test 4 Hello, world! Lots and lots and ... of text"
+  [27]=>
+  string(53) "27 test 4 Hello, world! Lots and lots and ... of text"
+  [28]=>
+  string(53) "28 test 4 Hello, world! Lots and lots and ... of text"
+  [29]=>
+  string(53) "29 test 4 Hello, world! Lots and lots and ... of text"
+  [30]=>
+  string(53) "30 test 4 Hello, world! Lots and lots and ... of text"
+  [31]=>
+  string(53) "31 test 4 Hello, world! Lots and lots and ... of text"
+  [32]=>
+  string(53) "32 test 4 Hello, world! Lots and lots and ... of text"
+  [33]=>
+  string(53) "33 test 4 Hello, world! Lots and lots and ... of text"
+  [34]=>
+  string(53) "34 test 4 Hello, world! Lots and lots and ... of text"
+  [35]=>
+  string(53) "35 test 4 Hello, world! Lots and lots and ... of text"
+  [36]=>
+  string(53) "36 test 4 Hello, world! Lots and lots and ... of text"
+  [37]=>
+  string(53) "37 test 4 Hello, world! Lots and lots and ... of text"
+  [38]=>
+  string(53) "38 test 4 Hello, world! Lots and lots and ... of text"
+  [39]=>
+  string(53) "39 test 4 Hello, world! Lots and lots and ... of text"
+  [40]=>
+  string(53) "40 test 4 Hello, world! Lots and lots and ... of text"
+  [41]=>
+  string(53) "41 test 4 Hello, world! Lots and lots and ... of text"
+  [42]=>
+  string(53) "42 test 4 Hello, world! Lots and lots and ... of text"
+  [43]=>
+  string(53) "43 test 4 Hello, world! Lots and lots and ... of text"
+  [44]=>
+  string(53) "44 test 4 Hello, world! Lots and lots and ... of text"
+  [45]=>
+  string(53) "45 test 4 Hello, world! Lots and lots and ... of text"
+  [46]=>
+  string(53) "46 test 4 Hello, world! Lots and lots and ... of text"
+  [47]=>
+  string(53) "47 test 4 Hello, world! Lots and lots and ... of text"
+  [48]=>
+  string(53) "48 test 4 Hello, world! Lots and lots and ... of text"
+  [49]=>
+  string(53) "49 test 4 Hello, world! Lots and lots and ... of text"
+  [50]=>
+  string(53) "50 test 4 Hello, world! Lots and lots and ... of text"
+  [51]=>
+  string(53) "51 test 4 Hello, world! Lots and lots and ... of text"
+  [52]=>
+  string(53) "52 test 4 Hello, world! Lots and lots and ... of text"
+  [53]=>
+  string(53) "53 test 4 Hello, world! Lots and lots and ... of text"
+  [54]=>
+  string(53) "54 test 4 Hello, world! Lots and lots and ... of text"
+  [55]=>
+  string(53) "55 test 4 Hello, world! Lots and lots and ... of text"
+  [56]=>
+  string(53) "56 test 4 Hello, world! Lots and lots and ... of text"
+  [57]=>
+  string(53) "57 test 4 Hello, world! Lots and lots and ... of text"
+  [58]=>
+  string(53) "58 test 4 Hello, world! Lots and lots and ... of text"
+  [59]=>
+  string(53) "59 test 4 Hello, world! Lots and lots and ... of text"
+  [60]=>
+  string(53) "60 test 4 Hello, world! Lots and lots and ... of text"
+  [61]=>
+  string(53) "61 test 4 Hello, world! Lots and lots and ... of text"
+  [62]=>
+  string(53) "62 test 4 Hello, world! Lots and lots and ... of text"
+  [63]=>
+  string(53) "63 test 4 Hello, world! Lots and lots and ... of text"
+  [64]=>
+  string(53) "64 test 4 Hello, world! Lots and lots and ... of text"
+  [65]=>
+  string(53) "65 test 4 Hello, world! Lots and lots and ... of text"
+  [66]=>
+  string(53) "66 test 4 Hello, world! Lots and lots and ... of text"
+  [67]=>
+  string(53) "67 test 4 Hello, world! Lots and lots and ... of text"
+  [68]=>
+  string(53) "68 test 4 Hello, world! Lots and lots and ... of text"
+  [69]=>
+  string(53) "69 test 4 Hello, world! Lots and lots and ... of text"
+  [70]=>
+  string(53) "70 test 4 Hello, world! Lots and lots and ... of text"
+  [71]=>
+  string(53) "71 test 4 Hello, world! Lots and lots and ... of text"
+  [72]=>
+  string(53) "72 test 4 Hello, world! Lots and lots and ... of text"
+  [73]=>
+  string(53) "73 test 4 Hello, world! Lots and lots and ... of text"
+  [74]=>
+  string(53) "74 test 4 Hello, world! Lots and lots and ... of text"
+  [75]=>
+  string(53) "75 test 4 Hello, world! Lots and lots and ... of text"
+  [76]=>
+  string(53) "76 test 4 Hello, world! Lots and lots and ... of text"
+  [77]=>
+  string(53) "77 test 4 Hello, world! Lots and lots and ... of text"
+  [78]=>
+  string(53) "78 test 4 Hello, world! Lots and lots and ... of text"
+  [79]=>
+  string(53) "79 test 4 Hello, world! Lots and lots and ... of text"
+  [80]=>
+  string(53) "80 test 4 Hello, world! Lots and lots and ... of text"
+  [81]=>
+  string(53) "81 test 4 Hello, world! Lots and lots and ... of text"
+  [82]=>
+  string(53) "82 test 4 Hello, world! Lots and lots and ... of text"
+  [83]=>
+  string(53) "83 test 4 Hello, world! Lots and lots and ... of text"
+  [84]=>
+  string(53) "84 test 4 Hello, world! Lots and lots and ... of text"
+  [85]=>
+  string(53) "85 test 4 Hello, world! Lots and lots and ... of text"
+  [86]=>
+  string(53) "86 test 4 Hello, world! Lots and lots and ... of text"
+  [87]=>
+  string(53) "87 test 4 Hello, world! Lots and lots and ... of text"
+  [88]=>
+  string(53) "88 test 4 Hello, world! Lots and lots and ... of text"
+  [89]=>
+  string(53) "89 test 4 Hello, world! Lots and lots and ... of text"
+  [90]=>
+  string(53) "90 test 4 Hello, world! Lots and lots and ... of text"
+  [91]=>
+  string(53) "91 test 4 Hello, world! Lots and lots and ... of text"
+  [92]=>
+  string(53) "92 test 4 Hello, world! Lots and lots and ... of text"
+  [93]=>
+  string(53) "93 test 4 Hello, world! Lots and lots and ... of text"
+  [94]=>
+  string(53) "94 test 4 Hello, world! Lots and lots and ... of text"
+  [95]=>
+  string(53) "95 test 4 Hello, world! Lots and lots and ... of text"
+  [96]=>
+  string(53) "96 test 4 Hello, world! Lots and lots and ... of text"
+  [97]=>
+  string(53) "97 test 4 Hello, world! Lots and lots and ... of text"
+  [98]=>
+  string(53) "98 test 4 Hello, world! Lots and lots and ... of text"
+  [99]=>
+  string(53) "99 test 4 Hello, world! Lots and lots and ... of text"
+}
+===DONE===
index 47191c8585b518d1a919353b18fd576ee249e7aa..cc70c6ecb3c7cf4c8b9e87b91b70c4e6764d18fb 100644 (file)
@@ -19,23 +19,7 @@ $stmtarray = array(
     "insert into default_prefetch_tab (id, value) values (1,1)",
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       $r = @oci_execute($s);
-       if (!$r) {
-               $m = oci_error($s);
-               if (!in_array($m['code'], array(   // ignore expected errors
-                    942 // table or view does not exist
-                ))) {
-                       echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
-               }
-       }
-}
-
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 // Run Test
 
@@ -59,11 +43,7 @@ $stmtarray = array(
     "drop table default_prefetch_tab"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       oci_execute($s);
-}
-       
+oci8_test_sql_execute($c, $stmtarray);
        
 echo "Done\n";
 ?>
diff --git a/ext/oci8/tests/default_prefetch0.phpt b/ext/oci8/tests/default_prefetch0.phpt
new file mode 100644 (file)
index 0000000..cc70c6e
--- /dev/null
@@ -0,0 +1,53 @@
+--TEST--
+oci8.default_prefetch ini option
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--INI--
+oci8.default_prefetch=20
+--FILE--
+<?php
+
+require(dirname(__FILE__)."/connect.inc");
+
+// Initialize
+
+$stmtarray = array(
+    "drop table default_prefetch_tab",
+    "create table default_prefetch_tab (id number, value number)",
+    "insert into default_prefetch_tab (id, value) values (1,1)",
+    "insert into default_prefetch_tab (id, value) values (1,1)",
+    "insert into default_prefetch_tab (id, value) values (1,1)",
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+// Run Test
+
+$select_sql = "select * from default_prefetch_tab";
+
+if (!($s = oci_parse($c, $select_sql))) {
+       die("oci_parse(select) failed!\n");
+}
+
+if (!oci_execute($s)) {
+       die("oci_execute(select) failed!\n");
+}
+
+var_dump(oci_fetch($s));
+
+var_dump(oci_num_rows($s));
+
+// Cleanup
+
+$stmtarray = array(
+    "drop table default_prefetch_tab"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+       
+echo "Done\n";
+?>
+--EXPECT--
+bool(true)
+int(1)
+Done
index bcd66fa38196fbcd7e2b6b7f027f9969ae5e060d..bc788293657dbe0efd4a74323398ef5612a558cb 100644 (file)
@@ -19,23 +19,7 @@ $stmtarray = array(
     "insert into default_prefetch1_tab (id, value) values (1,1)",
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       $r = @oci_execute($s);
-       if (!$r) {
-               $m = oci_error($s);
-               if (!in_array($m['code'], array(   // ignore expected errors
-                        942 // table or view does not exist
-                ))) {
-                       echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
-               }
-       }
-}
-
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 // Run Test
 
@@ -59,10 +43,7 @@ $stmtarray = array(
     "drop table default_prefetch1_tab"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
        
 echo "Done\n";
 ?>
index 7b3f29f2960c3a5185bef477ddd80f88f29574f9..d8a76dbb079f4e3bdbb45951907598fcba1be5d5 100644 (file)
@@ -19,23 +19,7 @@ $stmtarray = array(
     "insert into default_prefetch2_tab (id, value) values (1,1)",
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       $r = @oci_execute($s);
-       if (!$r) {
-               $m = oci_error($s);
-               if (!in_array($m['code'], array(   // ignore expected errors
-                    942 // table or view does not exist
-                ))) {
-                       echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
-               }
-       }
-}
-
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 // Run Test
 
@@ -60,10 +44,7 @@ $stmtarray = array(
     "drop table default_prefetch2_tab"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
        
 echo "Done\n";
 ?>
index d99bc7e1a6e6287c95d4969a16c47fe902cf84c8..c6ce7bd9b30481af689e21452308c9f814f8346f 100644 (file)
@@ -15,18 +15,7 @@ $stmtarray = array(
     "insert into define_tab (string) values ('some')",
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       $r = @oci_execute($s);
-       if (!$r) {
-               $m = oci_error($s);
-               if (!in_array($m['code'], array(   // ignore expected errors
-                    942 // table or view does not exist
-                               ))) {
-                       echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
-               }
-       }
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 // Run test
 
@@ -49,10 +38,7 @@ $stmtarray = array(
     "drop table define_tab"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 echo "Done\n";
 
diff --git a/ext/oci8/tests/define0.phpt b/ext/oci8/tests/define0.phpt
new file mode 100644 (file)
index 0000000..f2f06e3
--- /dev/null
@@ -0,0 +1,61 @@
+--TEST--
+oci_define_by_name()
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require(dirname(__FILE__)."/connect.inc");
+
+// Initialize
+
+$stmtarray = array(
+    "drop table define0_tab",
+    "create table define0_tab (string varchar(10))",
+    "insert into define0_tab (string) values ('some')",
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+// Run test
+
+$stmt = oci_parse($c, "select string from define0_tab");
+
+/* the define MUST be done BEFORE ociexecute! */
+
+echo "Test 1\n";
+
+$string = '';
+oci_define_by_name($stmt, "STRING", $string, 20);
+oci_execute($stmt);
+while (oci_fetch($stmt)) {
+       var_dump($string);
+}
+
+echo "Test 2\n";
+
+$string = '';
+$s2 = oci_parse($c, 'select string from define0_tab');
+oci_define_by_name($s2, 'STRING', $string);
+oci_execute($s2);
+while (oci_fetch($s2)) {
+    var_dump($string);
+}
+
+// Cleanup
+
+$stmtarray = array(
+    "drop table define0_tab"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1
+string(%d) "some"
+Test 2
+string(%d) "some"
+===DONE===
index 341bc9ed83426320966ad3b76826f9aa2bf1212c..6e4b74e3bacb553e64b94cccfa17552fe6496ab1 100644 (file)
@@ -15,18 +15,7 @@ $stmtarray = array(
     "insert into define1_tab (string) values ('some')",
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       $r = @oci_execute($s);
-       if (!$r) {
-               $m = oci_error($s);
-               if (!in_array($m['code'], array(   // ignore expected errors
-                               942 // table or view does not exist
-                               ))) {
-                       echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
-               }
-       }
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 // Run test
 
@@ -52,10 +41,7 @@ $stmtarray = array(
     "drop table define1_tab"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 echo "Done\n";
 
index 46e11bf8861b958fdac2063caba7c95ee78c257c..c53bebd2e1f83dddcb4127954e7c4762298066c3 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 Test oci_define_by_name types
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
@@ -12,10 +15,7 @@ $stmtarray = array(
        "create table phptestrawtable( id number(10), fileimage raw(1000))"
 );
                                                 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 $stmt = oci_parse ($c, "insert into phptestrawtable (id, fileimage) values (:id, :fileimage)");
 $i=1;
@@ -68,8 +68,13 @@ while (oci_fetch($stmt)) {
        echo "file md5:" . md5($fi) . "\n";
 }
 
-$stmt = oci_parse($c, "drop table phptestrawtable");
-oci_execute($stmt);
+// Cleanup
+
+$stmtarray = array(
+    "drop table phptestrawtable"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
 
 echo "Done\n";
 ?>
index 892e8e38098078d0197407337c42cab592773a85..77714a92f049f112e152ae24d0d0a1570b78f020 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 Test oci_define_by_name() LOB descriptor
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
@@ -12,10 +15,7 @@ $stmtarray = array(
        "create table phpdefblobtable (id number(10), fileimage blob)"
 );
                                                 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 // Load data
 $stmt = oci_parse ($c, "insert into phpdefblobtable (id, fileimage) values (:id, empty_blob()) returning fileimage into :fileimage");
@@ -75,8 +75,11 @@ while (oci_fetch($stmt)) {
    echo "file md5:" . md5($fid->load()) . "\n";
 }
 
-$stmt = oci_parse($c, "drop table phpdefblobtable");
-oci_execute($stmt);
+$stmtarray = array(
+       "drop table phpdefblobtable"
+);
+                                                
+oci8_test_sql_execute($c, $stmtarray);
 
 echo "Done\n";
 
index 8d83f73ac3cce7f547160f0428e587fab299e49e..266fd7edd70fe2cd365c54f4e48e7110de5b1bdb 100644 (file)
@@ -15,18 +15,7 @@ $stmtarray = array(
     "insert into define4_tab (value, string) values (1234, 'some')",
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       $r = @oci_execute($s);
-       if (!$r) {
-               $m = oci_error($s);
-               if (!in_array($m['code'], array(   // ignore expected errors
-                    942 // table or view does not exist
-                               ))) {
-                       echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
-               }
-       }
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 // Run test
 
@@ -60,10 +49,7 @@ $stmtarray = array(
     "drop table define4_tab"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 echo "Done\n";
 
index 63541ce9dd4efd22767bfbbf51c3b80fff83e0ec..68fa01d09aa872298a3584567aee38af3820b231 100644 (file)
@@ -16,18 +16,7 @@ $stmtarray = array(
     "insert into define5_tab (id, string) values (2, 'thing')",
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       $r = @oci_execute($s);
-       if (!$r) {
-               $m = oci_error($s);
-               if (!in_array($m['code'], array(   // ignore expected errors
-                    942 // table or view does not exist
-                               ))) {
-                       echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
-               }
-       }
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 // Run test
 
@@ -63,10 +52,7 @@ $stmtarray = array(
     "drop table define5_tab"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 echo "Done\n";
 
diff --git a/ext/oci8/tests/define6.phpt b/ext/oci8/tests/define6.phpt
new file mode 100644 (file)
index 0000000..50e23ec
--- /dev/null
@@ -0,0 +1,138 @@
+--TEST--
+oci_define_by_name tests with REF CURSORs
+--SKIPIF--
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+    "drop table define6_tab",
+    "create table define6_tab (id number)",
+    "insert into define6_tab values (1)"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+// Run Test
+
+$sql = 
+"DECLARE
+  TYPE curtype IS REF CURSOR;
+  cursor_var curtype;
+BEGIN
+  OPEN cursor_var FOR SELECT id FROM define6_tab;
+  :curs := cursor_var;
+END;";
+
+echo "Test 1 - define last\n";
+
+$s1 = oci_parse($c, $sql);
+$cursor1 = oci_new_cursor($c);
+oci_bind_by_name($s1, ":curs", $cursor1, -1, OCI_B_CURSOR);
+oci_execute($s1);
+oci_execute($cursor1);
+oci_define_by_name($cursor1, 'ID', $id1);
+while (oci_fetch_row($cursor1)) {
+    var_dump($id1);
+}
+
+
+echo "Test 2 - define last with preset var\n";
+
+$s2 = oci_parse($c, $sql);
+$cursor2 = oci_new_cursor($c);
+oci_bind_by_name($s2, ":curs", $cursor2, -1, OCI_B_CURSOR);
+oci_execute($s2);
+oci_execute($cursor2);
+$id2 = '';
+oci_define_by_name($cursor2, 'ID', $id2);
+while (oci_fetch_row($cursor2)) {
+    var_dump($id2);
+}
+
+
+echo "Test 3 - define before cursor execute\n";
+
+$s3 = oci_parse($c, $sql);
+$cursor3 = oci_new_cursor($c);
+oci_bind_by_name($s3, ":curs", $cursor3, -1, OCI_B_CURSOR);
+oci_execute($s3);
+oci_define_by_name($cursor3, 'ID', $id3);
+oci_execute($cursor3);
+while (oci_fetch_row($cursor3)) {
+    var_dump($id3);
+}
+
+
+echo "Test 4 - define before top level execute\n";
+
+$s4 = oci_parse($c, $sql);
+$cursor4 = oci_new_cursor($c);
+oci_bind_by_name($s4, ":curs", $cursor4, -1, OCI_B_CURSOR);
+oci_define_by_name($cursor4, 'ID', $id4);
+oci_execute($s4);
+oci_execute($cursor4);
+while (oci_fetch_row($cursor4)) {
+    var_dump($id4);
+}
+
+
+echo "Test 5 - define before bind\n";
+
+$s5 = oci_parse($c, $sql);
+$cursor5 = oci_new_cursor($c);
+oci_define_by_name($cursor5, 'ID', $id5);
+oci_bind_by_name($s5, ":curs", $cursor5, -1, OCI_B_CURSOR);
+oci_execute($s5);
+oci_execute($cursor5);
+while (oci_fetch_row($cursor5)) {
+    var_dump($id5);
+}
+
+
+echo "Test 6 - fetch on wrong handle\n";
+
+$s6 = oci_parse($c, $sql);
+$cursor6 = oci_new_cursor($c);
+oci_define_by_name($cursor6, 'ID', $id6);
+oci_bind_by_name($s6, ":curs", $cursor6, -1, OCI_B_CURSOR);
+oci_execute($s6);
+oci_execute($cursor6);
+while (oci_fetch_row($s6)) {
+    var_dump($id6);
+}
+
+
+// Clean up
+
+$stmtarray = array(
+    "drop table define6_tab"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1 - define last
+NULL
+Test 2 - define last with preset var
+string(0) ""
+Test 3 - define before cursor execute
+string(1) "1"
+Test 4 - define before top level execute
+string(1) "1"
+Test 5 - define before bind
+string(1) "1"
+Test 6 - fetch on wrong handle
+
+Warning: oci_fetch_row(): ORA-24374: %s in %sdefine6.php on line %d
+===DONE===
index 618f9d5f5713e61f45723a0c9181bd43e726e2e1..f65e6b80809b45d2331ebc9e4dcae487542d19f7 100644 (file)
@@ -15,18 +15,7 @@ $stmtarray = array(
     "insert into define_old_tab (string) values ('some')",
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       $r = @oci_execute($s);
-       if (!$r) {
-               $m = oci_error($s);
-               if (!in_array($m['code'], array(   // ignore expected errors
-                    942 // table or view does not exist
-                               ))) {
-                       echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
-               }
-       }
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 // Run test
 
@@ -49,11 +38,7 @@ $stmtarray = array(
     "drop table define_old_tab"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       oci_execute($s);
-}
-
+oci8_test_sql_execute($c, $stmtarray);
 
 echo "Done\n";
 
index 8be4f3a06d32e8fb4bf59803b9568ff3acef30ee..9193fdddebfaffb7d7ad1203dc616c88e90cf4f2 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 commit connection after destroying the descriptor
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index 922b8c4f49c35bdb88aba8b3371b84f89db8a641..4c07e636e3859b45bd1ce3a49d531bb2b311cb09 100644 (file)
@@ -3,9 +3,6 @@
 /*
  * Please change $user, $password and $dbase to match your configuration.
  *
- * Set $oracle_on_localhost to TRUE if the Oracle Database is
- * installed on your localhost.
- *
  * Set $test_drcp to TRUE if you want to run the Oracle Database
  * Resident Connection Pooling (DRCP) tests. For these tests to run
  * successfully, you need a server and client which is Oracle 11g or
  * string like hostname:port/service_name:POOLED
  *
  * Set $stress_test to TRUE if you want to run some longer/slower/more
- * memory intensive tests.
+ * memory intensive tests.     External configuration such as increasing
+ * the timeout of run-tests.php may also be needed.
  */
 
 if (file_exists(dirname(__FILE__)."/details_local.inc")) {
-    include(dirname(__FILE__)."/details_local.inc");   // this file is not part of the source distribution; make it your own local variant of details.inc
+       include(dirname(__FILE__)."/details_local.inc");   // this file is not part of the source distribution; make it your own local variant of details.inc
 } else {
-    if (false !== getenv('PHP_OCI8_TEST_DB')) {
-        $user          = getenv('PHP_OCI8_TEST_USER');   // Database username for tests
-        $password      = getenv('PHP_OCI8_TEST_PASS');   // Password for $user
-        $dbase         = getenv('PHP_OCI8_TEST_DB');     // Database connection string
-        $test_drcp     = getenv('PHP_OCI8_TEST_DRCP');
-        if (false !== $test_drcp && 0 == strcasecmp($test_drcp,'TRUE')) {
-            $test_drcp = TRUE;
-        } else {
-            $test_drcp = FALSE;
-        }
-        $oracle_on_localhost = getenv('PHP_OCI8_TEST_DB_ON_LOCALHOST');
-        if (false !== $oracle_on_localhost && 0 == strcasecmp($oracle_on_localhost,'TRUE')) {
-            $oracle_on_localhost = TRUE;
-        } else {
-            $oracle_on_localhost = FALSE;
-        }
-        $stress_test = getenv('PHP_OCI8_STRESS_TEST');
-        if (false !== $stress_test && 0 == strcasecmp($stress_test,'TRUE')) {
-            $stress_test = TRUE;
-        } else {
-            $stress_test = FALSE;
-        }
-    } else {
-        $user                                          = "system";
-        $password                                      = "oracle";
-        $dbase                                         = "localhost/XE";
-        $oracle_on_localhost           = TRUE;
-        $test_drcp                                     = FALSE;
-        $stress_test                           = FALSE;
-    }
-    
-    /*
-     * Common object names for scripts to use
-     */
-    
-    $table_name = "tb".substr(str_replace(Array(".", "-"), "_", php_uname("n")), 0, 5);
-    $type_name = strtoupper("tp".substr(str_replace(Array(".", "-"), "_", php_uname("n")), 0, 5));
-    $schema = '';
+       if (false !== getenv('PHP_OCI8_TEST_DB')) {
+               $user           = getenv('PHP_OCI8_TEST_USER');   // Database username for tests
+               $password       = getenv('PHP_OCI8_TEST_PASS');   // Password for $user
+               $dbase          = getenv('PHP_OCI8_TEST_DB');     // Database connection string
+               $test_drcp      = getenv('PHP_OCI8_TEST_DRCP');
+               $stress_test = getenv('PHP_OCI8_STRESS_TEST');
+               if (false !== $test_drcp && 0 == strcasecmp($test_drcp,'TRUE')) {
+                       $test_drcp = TRUE;
+               } else {
+                       $test_drcp = FALSE;
+               }
+               if (false !== $stress_test && 0 == strcasecmp($stress_test,'TRUE')) {
+                       $stress_test = TRUE;
+               } else {
+                       $stress_test = FALSE;
+               }
+       } else {
+               $user                                           = "system";
+               $password                                       = "oracle";
+               $dbase                                          = "localhost/XE";
+               $test_drcp                                      = FALSE;
+               $stress_test                            = FALSE;
+       }
+       
+       /*
+        * Common object names for scripts to use
+        */
+       
+       $table_name = "tb".substr(str_replace(Array(".", "-"), "_", php_uname("n")), 0, 5);
+       $type_name = strtoupper("tp".substr(str_replace(Array(".", "-"), "_", php_uname("n")), 0, 5));
+       $schema = '';
+}
+
+
+/*
+ * Used for creating/dropping schema objects used by a test
+ */
+
+function oci8_test_sql_execute($c, $stmtarray)
+{
+       foreach ($stmtarray as $stmt) {
+               $s = oci_parse($c, $stmt);
+               if (!$s) {
+                       $m = oci_error($c);
+                       echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
+               }
+               else {
+                       $r = @oci_execute($s);
+                       if (!$r) {
+                               $m = oci_error($s);
+                               if (!in_array($m['code'], array(   // ignore expected errors
+                                                               942 // table or view does not exist
+                                                       ,  1918 // user does not exist
+                                                       ,  2024 // database link not found
+                                                       ,  2289 // sequence does not exist
+                                                       ,  4080 // trigger does not exist
+                                                       , 38802 // edition does not exist
+                                               ))) {
+                                       echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
+                               }
+                       }
+               }
+       }
 }
 
 ?>
index bf619a4efd0e29243f848d0814ab15e0976b8e23..25395dc187b228f0f40fd388af493520fb03f93a 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 DRCP: oci_connect()
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs (Calling PL/SQL from SQL is not supported in TimesTen)
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --INI--
 oci8.connection_class=test
 oci8.old_oci_close_semantics=0
@@ -16,10 +19,12 @@ require dirname(__FILE__)."/drcp_functions.inc";
 // To verify this, we change the value of a PL/SQL package variable in one
 // session and query for this through another connection
 
+echo "Test 1a\n";
 var_dump($conn1 = oci_connect($user,$password,$dbase));
 // Create the package
 drcp_create_package($conn1);
-     
+
+echo "Test 1b\n";     
 // OCI_CONNECT
 echo " This is with OCI_CONNECT.....\n";
 drcp_select_packagevar($conn1); // Returns 0
@@ -27,12 +32,14 @@ drcp_set_packagevar($conn1,1000);
 oci_close($conn1);
 echo " Connection conn1  closed....\n";
 
+echo "Test 2\n";
 // Second connection should return 0 for the package variable.
 var_dump($conn2 = oci_connect($user,$password,$dbase));
 echo " Select with connection 2 \n";
 drcp_select_packagevar($conn2); // Returns 0
 drcp_set_packagevar($conn2,100);
 
+echo "Test 3\n";
 // Third connection. There is no oci_close() for conn2 hence this should
 // return the value set by conn2.
 var_dump($conn3 = oci_connect($user,$password,$dbase));
@@ -43,8 +50,9 @@ drcp_select_packagevar($conn3); // Returns 100
 oci_close($conn2);
 oci_close($conn3);
 
+echo "Test 4\n";
 // OCI_PCONNECT
-echo "\n This is with oci_pconnect().....\n";
+echo " This is with oci_pconnect().....\n";
 var_dump($pconn1 = oci_pconnect($user,$password,$dbase));
 drcp_set_packagevar($pconn1,1000);
 oci_close($pconn1);
@@ -53,6 +61,7 @@ echo " Connection pconn1  closed....\n";
 // Second connection with oci_pconnect should return the same session hence the
 // value returned is what is set by pconn1
 
+echo "Test 5\n";
 var_dump($pconn2 = oci_pconnect($user,$password,$dbase));
 echo " Select with persistent connection 2 \n";
 drcp_select_packagevar($pconn2); // Returns 1000
@@ -62,23 +71,28 @@ echo "Done\n";
 
 ?>
 --EXPECTF--
+Test 1a
 resource(%d) of type (oci8 connection)
+Test 1b
  This is with OCI_CONNECT.....
  The value of the package variable is 0
  Package variable value set to 1000
  Connection conn1  closed....
+Test 2
 resource(%d) of type (oci8 connection)
  Select with connection 2 
  The value of the package variable is 0
  Package variable value set to 100
+Test 3
 resource(%d) of type (oci8 connection)
  Select with connection 3 
  The value of the package variable is 100
-
+Test 4
  This is with oci_pconnect().....
 resource(%d) of type (oci8 persistent connection)
  Package variable value set to 1000
  Connection pconn1  closed....
+Test 5
 resource(%d) of type (oci8 persistent connection)
  Select with persistent connection 2 
  The value of the package variable is 1000
index 26adb21f35ea6603b1069c1cc671a564f869a634..f6b24446c99c3feca1caabc651fe1960556f56fb 100644 (file)
@@ -14,7 +14,7 @@ function drcp_create_table($conn)
        $dept_values = array("ACCOUNTS","HR","HR","ADMIN","ACCOUNTS","HR",
                                                 "ACCOUNTS","HR","ACCOUNTS");
        for($i=0; $i<8; $i++) {
-               $insert = "INSERT INTO DRCPTEST VALUES('".$id_values[$i]."','". $name_values[$i]."','".$dept_values[$i]."')";
+               $insert = "INSERT INTO DRCPTEST VALUES(".$id_values[$i].",'". $name_values[$i]."','".$dept_values[$i]."')";
                $s = oci_parse($conn, $insert);
                oci_execute($s);
        }       
index 9af20625eddc7be78832e956b7f2050c4256c4e0..45b5ee4bdb642ef697fd9a54eef763b85a625efe 100644 (file)
@@ -5,7 +5,10 @@ DRCP: privileged connect
 if (!extension_loaded('oci8')) die("skip no oci8 extension");
 if (strcasecmp($user, "system") && strcasecmp($user, "sys")) die("skip needs to be run as a DBA user");
 require(dirname(__FILE__)."/details.inc");
-if (empty($oracle_on_localhost)) die("skip this test is unlikely to work with remote Oracle - unless an Oracle password file has been created");
+if (preg_match('/Compile-time ORACLE_HOME/', $phpinfo) !== 1) {
+    // Assume building PHP with an ORACLE_HOME means the tested DB is on the same machine as PHP
+    die("skip this test is unlikely to work with remote Oracle - unless an Oracle password file has been created");
+}
 ?>
 --INI--
 oci8.privileged_connect=1
@@ -26,22 +29,22 @@ echo "Done\n";
 
 ?>
 --EXPECTF--
-Warning: oci_connect(): ORA-01031: insufficient privileges in %s on line %d
+Warning: oci_connect(): ORA-01031: %s in %s on line %d
 bool(false)
 
-Warning: oci_connect(): ORA-01031: insufficient privileges in %s on line %d
+Warning: oci_connect(): ORA-01031: %s in %s on line %d
 bool(false)
 
-Warning: oci_new_connect(): ORA-01031: insufficient privileges in %s on line %d
+Warning: oci_new_connect(): ORA-01031: %s in %s on line %d
 bool(false)
 
-Warning: oci_new_connect(): ORA-01031: insufficient privileges in %s on line %d
+Warning: oci_new_connect(): ORA-01031: %s in %s on line %d
 bool(false)
 
-Warning: oci_pconnect(): ORA-01031: insufficient privileges in %s on line %d
+Warning: oci_pconnect(): ORA-01031: %s in %s on line %d
 bool(false)
 
-Warning: oci_pconnect(): ORA-01031: insufficient privileges in %s on line %d
+Warning: oci_pconnect(): ORA-01031: %s in %s on line %d
 bool(false)
 Done
 
index 187d7e18626b4741c6fcae410e20ea9fca5dacee..bf86e66e7b64fc1b272f4780c0127eda5a00723d 100644 (file)
@@ -7,20 +7,10 @@ require(dirname(__FILE__)."/connect.inc");
 if (strcasecmp($user, "system") && strcasecmp($user, "sys")) die("skip needs to be run as a DBA user");
 if ($test_drcp) die("skip as Output might vary with DRCP");
 
-$sv = oci_server_version($c);
-$sv = preg_match('/Release (11.2|12)/', $sv, $matches);
-
-if ($sv == 1) {
-    ob_start();
-    phpinfo(INFO_MODULES);
-    $phpinfo = ob_get_clean();
-    $iv = preg_match('/Oracle .*Version => (11.2|12)/', $phpinfo);
-    if ($iv != 1) {
-        die ("skip test expected to work only with Oracle 11g or greater version of client");
-    }
-}
-else {
-    die ("skip test expected to work only with Oracle 11g or greater version of server");
+if (preg_match('/Release (11\.2|12)/', oci_server_version($c), $matches) !== 1) {
+       die("skip expected output only valid when using Oracle 11gR2 or greater databases");
+} else if (preg_match('/^(11\.2|12\.)/', oci_client_version()) != 1) {
+    die("skip test expected to work only with Oracle 11g or greater version of client");
 }
 
 ?>
diff --git a/ext/oci8/tests/dupcolnames.phpt b/ext/oci8/tests/dupcolnames.phpt
new file mode 100644 (file)
index 0000000..bf07497
--- /dev/null
@@ -0,0 +1,102 @@
+--TEST--
+SELECT tests with duplicate column anmes
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+    "drop table dupcolnames_tab1",
+    "drop table dupcolnames_tab2",
+
+    "create table dupcolnames_tab1 (c1 number, dupnamecol varchar2(20))",
+    "create table dupcolnames_tab2 (c2 number, dupnamecol varchar2(20))",
+
+    "insert into dupcolnames_tab1 (c1, dupnamecol) values (1, 'chris')",
+    "insert into dupcolnames_tab2 (c2, dupnamecol) values (2, 'jones')",
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+// Run Test
+
+echo "Test 1 - OCI_ASSOC\n";
+$s = oci_parse($c, "select * from dupcolnames_tab1, dupcolnames_tab2");
+oci_execute($s);
+while (($r = oci_fetch_array($s, OCI_ASSOC)) != false) {
+    var_dump($r);
+}
+
+
+echo "\nTest 2 - OCI_NUM\n";
+$s = oci_parse($c, "select * from dupcolnames_tab1, dupcolnames_tab2");
+oci_execute($s);
+while (($r = oci_fetch_array($s, OCI_NUM)) != false) {
+    var_dump($r);
+}
+
+
+echo "\nTest 3 - OCI_ASSOC+OCI_NUM\n";
+$s = oci_parse($c, "select * from dupcolnames_tab1, dupcolnames_tab2");
+oci_execute($s);
+while (($r = oci_fetch_array($s, OCI_ASSOC+OCI_NUM)) != false) {
+    var_dump($r);
+}
+
+// Clean up
+
+$stmtarray = array(
+    "drop table dupcolnames_tab1",
+    "drop table dupcolnames_tab2",
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1 - OCI_ASSOC
+array(3) {
+  ["C1"]=>
+  string(1) "1"
+  ["DUPNAMECOL"]=>
+  string(5) "jones"
+  ["C2"]=>
+  string(1) "2"
+}
+
+Test 2 - OCI_NUM
+array(4) {
+  [0]=>
+  string(1) "1"
+  [1]=>
+  string(5) "chris"
+  [2]=>
+  string(1) "2"
+  [3]=>
+  string(5) "jones"
+}
+
+Test 3 - OCI_ASSOC+OCI_NUM
+array(7) {
+  [0]=>
+  string(1) "1"
+  ["C1"]=>
+  string(1) "1"
+  [1]=>
+  string(5) "chris"
+  ["DUPNAMECOL"]=>
+  string(5) "jones"
+  [2]=>
+  string(1) "2"
+  ["C2"]=>
+  string(1) "2"
+  [3]=>
+  string(5) "jones"
+}
+===DONE===
index 9a4b0f3b61ea20528d02144eec622630351c204f..b9c8fd817ef879dc95ee58cf50f1ee0731de3b82 100644 (file)
@@ -4,26 +4,17 @@ Basic test for setting Oracle 11gR2 "edition" attribute
 <?php 
 if (!extension_loaded('oci8')) die("skip no oci8 extension"); 
 require(dirname(__FILE__)."/connect.inc");
-if (strcasecmp($user, "system") && strcasecmp($user, "sys")) 
+if (strcasecmp($user, "system") && strcasecmp($user, "sys")) {
     die("skip needs to be run as a DBA user");
-if ($test_drcp) 
+}
+if ($test_drcp) {
     die("skip as Output might vary with DRCP");
-
-$sv = oci_server_version($c);
-$sv = preg_match('/Release (11\.2|12)/', $sv, $matches);
-if ($sv == 1) {
-    ob_start();
-    phpinfo(INFO_MODULES);
-    $phpinfo = ob_get_clean();
-    $iv = preg_match('/Oracle .*Version => (11\.2|12)/', $phpinfo);
-    if ($iv != 1) {
-        die ("skip tests a feature that works only with Oracle 11gR2 or greater version of client");
-    }
 }
-else {
-    die ("skip tests a feature that works only with Oracle 11gR2 or greater version of server");
+if (preg_match('/Release (1[1]\.2|12)\./', oci_server_version($c), $matches) !== 1) {
+       die("skip expected output only valid when using Oracle 11gR2 or greater databases");
+} else if (preg_match('/^(11\.2|12)\./', oci_client_version()) != 1) {
+    die("skip test expected to work only with Oracle 11gR2 or greater version of client");
 }
-
 ?>
 --FILE--
 <?php
@@ -62,10 +53,7 @@ $stmtarray = array(
     "create or replace editioning view view_ed as select name,age,job from edit_tab",
 );
 
-foreach ($stmtarray as $stmt) {
-    $s = oci_parse($conn, $stmt);
-    @oci_execute($s);
-}
+oci8_test_sql_execute($conn, $stmtarray);
 
 // Check the current edition of the DB and the contents of view_ed.
 get_edit_attr($conn);
index f7ab979bcf8817659c15199f954d336f609bbeb1..030e6a673c85950741ac9c0b50a6d465efe86257 100644 (file)
@@ -9,19 +9,10 @@ if (strcasecmp($user, "system") && strcasecmp($user, "sys"))
 if ($test_drcp)
     die("skip as Output might vary with DRCP");
 
-$sv = oci_server_version($c);
-$sv = preg_match('/Release (11\.2|12)/', $sv, $matches);
-if ($sv == 1) {
-    ob_start();
-    phpinfo(INFO_MODULES);
-    $phpinfo = ob_get_clean();
-    $iv = preg_match('/Oracle .*Version => (11\.2|12)/', $phpinfo);
-    if ($iv != 1) {
-        die ("skip tests a feature that works only with Oracle 11gR2 or greater version of client");
-    }
-}
-else {
-    die ("skip tests a feature that works only with Oracle 11gR2 or greater version of server");
+if (preg_match('/Release (1[1]\.2|12)\./', oci_server_version($c), $matches) !== 1) {
+       die("skip expected output only valid when using Oracle 11gR2 or greater databases");
+} else if (preg_match('/^(11\.2|12)\./', oci_client_version()) != 1) {
+    die("skip test expected to work only with Oracle 11gR2 or greater version of client");
 }
 
 ?>
index 743820f901666b2568c4bb4570373efb05532b80..7fedd0ddad6dc36c4f0cfcee709302295133db2b 100644 (file)
@@ -1,17 +1,20 @@
 --TEST--
-oci_error()
+oci_error() error message for parsing error
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs: different error messages from TimesTen
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
 require dirname(__FILE__)."/connect.inc";
 
 if (!empty($dbase)) {
-       var_dump(oci_connect($user, $password, $dbase));
+    var_dump(oci_connect($user, $password, $dbase));
 }
 else {
-       var_dump(oci_connect($user, $password));
+    var_dump(oci_connect($user, $password));
 }
 
 var_dump($s = oci_parse($c, "WRONG SYNTAX"));
@@ -25,13 +28,13 @@ echo "Done\n";
 resource(%s) of type (oci8 connection)
 resource(%s) of type (oci8 statement)
 
-Warning: oci_execute(): ORA-00900: invalid SQL statement in %s on line %d
+Warning: oci_execute(): ORA-00900: %s in %s on line %d
 bool(false)
 array(4) {
   ["code"]=>
   int(900)
   ["message"]=>
-  string(32) "ORA-00900: invalid SQL statement"
+  string(%d) "ORA-00900: %s"
   ["offset"]=>
   int(0)
   ["sqltext"]=>
index 25a3f09e92d363f78697e2f1d342556d40a40b66..c6fba2e83bfb34a35aab5b6235d91d5be4cfaef8 100644 (file)
@@ -12,13 +12,13 @@ echo "Done\n";
 
 ?>
 --EXPECTF--
-Warning: oci_connect(): ORA-12154: TNS:could not resolve %s in %s on line %d
+Warning: oci_connect(): ORA-12154: %s in %s on line %d
 bool(false)
 array(4) {
   ["code"]=>
   int(12154)
   ["message"]=>
-  string(%d) "ORA-12154: TNS:could not resolve %s"
+  string(%d) "ORA-12154: %s"
   ["offset"]=>
   int(0)
   ["sqltext"]=>
index 13ea6cebe299b255ebc4cb5b9431e720b0717860..12eab61a6a9eacfaae97d0f48022d77f6c54bf72 100644 (file)
@@ -1,11 +1,15 @@
 --TEST--
 Exercise error code for SUCCESS_WITH_INFO
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php 
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+if ($stress_test !== true) die ('skip Slow test not run when $stress_test is FALSE');
+?>
 --FILE--
 <?php
 
-require dirname(__FILE__).'/connect.inc';
+require(dirname(__FILE__).'/connect.inc');
 
 ini_set('error_reporting', E_ALL);
 
@@ -20,5 +24,5 @@ echo "Done\n";
 
 ?>
 --EXPECTF--
-ORA-24344: success with compilation error
+ORA-24344: %s
 Done
index ad66ad59fee73ff1b48489452c4e9bbf7527f9c8..6ee26ee82501c715f6e2b89e2d2a2bcfab7a1ed1 100644 (file)
@@ -65,6 +65,6 @@ Test 3 - Resource mismatch !!
 
 Warning: oci_bind_by_name(): Invalid variable used for bind in %s on line %d
 
-Warning: oci_execute(): ORA-01008: %s on line %d
+Warning: oci_execute(): ORA-%r(01008|57000)%r: %s on line %d
 bool(false)
 Done
index a6889c897a7ad4bd90a76b443faf3064a982aff4..c6f9cd300d3db700901ffa1aa9a4c16045c1fde3 100644 (file)
@@ -1,17 +1,20 @@
 --TEST--
 ocierror()
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs: different error messages from TimesTen
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
 require dirname(__FILE__)."/connect.inc";
 
 if (!empty($dbase)) {
-       var_dump(ocilogon($user, $password, $dbase));
+    var_dump(ocilogon($user, $password, $dbase));
 }
 else {
-       var_dump(ocilogon($user, $password));
+    var_dump(ocilogon($user, $password));
 }
 
 var_dump($s = ociparse($c, "WRONG SYNTAX"));
@@ -25,13 +28,13 @@ echo "Done\n";
 resource(%s) of type (oci8 connection)
 resource(%s) of type (oci8 statement)
 
-Warning: ociexecute(): ORA-00900: invalid SQL statement in %s on line %d
+Warning: ociexecute(): ORA-00900: %s in %s on line %d
 bool(false)
 array(4) {
   ["code"]=>
   int(900)
   ["message"]=>
-  string(32) "ORA-00900: invalid SQL statement"
+  string(%d) "ORA-00900: %s"
   ["offset"]=>
   int(0)
   ["sqltext"]=>
index 8100e31706491569f57c842aeb66dfdf7ea55bfd..458df8715a9a2fbca04f89c0e2094cb737e9019d 100644 (file)
@@ -104,7 +104,7 @@ array(4) {
   ["code"]=>
   int(1756)
   ["message"]=>
-  string(48) "ORA-01756: quoted string not properly terminated"
+  string(48) "ORA-01756: %s"
   ["offset"]=>
   int(0)
   ["sqltext"]=>
@@ -115,7 +115,7 @@ array(4) {
   ["code"]=>
   int(1756)
   ["message"]=>
-  string(48) "ORA-01756: quoted string not properly terminated"
+  string(48) "ORA-01756: %s"
   ["offset"]=>
   int(0)
   ["sqltext"]=>
@@ -126,17 +126,17 @@ array(4) {
   ["code"]=>
   int(1756)
   ["message"]=>
-  string(48) "ORA-01756: quoted string not properly terminated"
+  string(48) "ORA-01756: %s"
   ["offset"]=>
   int(0)
   ["sqltext"]=>
   string(0) ""
 }
 No connection: error: bool(false)
-Normal connection (take #2): Parse error: ORA-01756: quoted string not properly terminated
-New connection (take #2): Parse error: ORA-01756: quoted string not properly terminated
-Persistent connection (take #2): Parse error: ORA-01756: quoted string not properly terminated
+Normal connection (take #2): Parse error: ORA-01756: %s
+New connection (take #2): Parse error: ORA-01756: %s
+Persistent connection (take #2): Parse error: ORA-01756: %s
 Normal connection: New Collection error: OCI-22303: type ""."ABC" not found
-New connection (take #3): Parse error: ORA-01756: quoted string not properly terminated
-Persistent connection (take #3): Parse error: ORA-01756: quoted string not properly terminated
+New connection (take #3): Parse error: ORA-01756: %s
+Persistent connection (take #3): Parse error: ORA-01756: %s
 Done
index 83aae69f7dc98eee2e7aa5039b3e57539b6c8cc0..52d515ffc4c6c799766cc84a67e27bba7ddd7a23 100644 (file)
@@ -16,9 +16,9 @@ var_dump(oci_fetch_array($stmt));
 echo "Done\n";
 ?>
 --EXPECTF--    
-Warning: oci_execute(): ORA-00942: table or view does not exist in %s on line %d
+Warning: oci_execute(): ORA-00942: %s in %s on line %d
 bool(false)
 
-Warning: oci_fetch_array(): ORA-24374: define not done before fetch or execute and fetch in %s on line %d
+Warning: oci_fetch_array(): ORA-24374: %s in %s on line %d
 bool(false)
 Done
index 520632494084a72991096a723cc94e663688b38c..e48aeefd87b6140bec50bdec87c74bdaa2466988 100644 (file)
@@ -17,23 +17,7 @@ $stmtarray = array(
     "insert into fetch_tab (id, value) values (1,1)",
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       $r = @oci_execute($s);
-       if (!$r) {
-               $m = oci_error($s);
-               if (!in_array($m['code'], array(   // ignore expected errors
-                    942 // table or view does not exist
-                ))) {
-                       echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
-               }
-       }
-}
-
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 // Run Test
 
@@ -58,11 +42,7 @@ $stmtarray = array(
     "drop table fetch_tab"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       oci_execute($s);
-}
-
+oci8_test_sql_execute($c, $stmtarray);
        
 echo "Done\n";
 ?>
index a007bac830088bbe7c944619f4d9bd7e90832a33..4fc41daad482fb2efb3a312eb8b112e8e09f5ec0 100644 (file)
@@ -17,18 +17,7 @@ $stmtarray = array(
     "insert into fetch_all_tab (id, value) values (1,1)"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       $r = @oci_execute($s);
-       if (!$r) {
-               $m = oci_error($s);
-               if (!in_array($m['code'], array(   // ignore expected errors
-                    942 // table or view does not exist
-                ))) {
-                       echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
-               }
-       }
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 if (!($s = oci_parse($c, "select * from fetch_all_tab"))) {
        die("oci_parse(select) failed!\n");
@@ -55,10 +44,7 @@ $stmtarray = array(
     "drop table fetch_all_tab"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
        
 echo "Done\n";
 ?>
diff --git a/ext/oci8/tests/fetch_all1.phpt b/ext/oci8/tests/fetch_all1.phpt
new file mode 100644 (file)
index 0000000..4fc41da
--- /dev/null
@@ -0,0 +1,94 @@
+--TEST--
+oci_fetch_all()
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require(dirname(__FILE__)."/connect.inc");
+
+// Initialize
+
+$stmtarray = array(
+    "drop table fetch_all_tab",
+    "create table fetch_all_tab (id number, value number)",
+    "insert into fetch_all_tab (id, value) values (1,1)",
+    "insert into fetch_all_tab (id, value) values (1,1)",
+    "insert into fetch_all_tab (id, value) values (1,1)"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+if (!($s = oci_parse($c, "select * from fetch_all_tab"))) {
+       die("oci_parse(select) failed!\n");
+}
+
+/* oci_fetch_all */
+if (!oci_execute($s)) {
+       die("oci_execute(select) failed!\n");
+}
+var_dump(oci_fetch_all($s, $all));
+var_dump($all);
+
+/* ocifetchstatement */
+if (!oci_execute($s)) {
+       die("oci_execute(select) failed!\n");
+}
+
+var_dump(ocifetchstatement($s, $all));
+var_dump($all);
+
+// Cleanup
+
+$stmtarray = array(
+    "drop table fetch_all_tab"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+       
+echo "Done\n";
+?>
+--EXPECTF--
+int(3)
+array(2) {
+  [%u|b%"ID"]=>
+  array(3) {
+    [0]=>
+    %unicode|string%(1) "1"
+    [1]=>
+    %unicode|string%(1) "1"
+    [2]=>
+    %unicode|string%(1) "1"
+  }
+  [%u|b%"VALUE"]=>
+  array(3) {
+    [0]=>
+    %unicode|string%(1) "1"
+    [1]=>
+    %unicode|string%(1) "1"
+    [2]=>
+    %unicode|string%(1) "1"
+  }
+}
+int(3)
+array(2) {
+  [%u|b%"ID"]=>
+  array(3) {
+    [0]=>
+    %unicode|string%(1) "1"
+    [1]=>
+    %unicode|string%(1) "1"
+    [2]=>
+    %unicode|string%(1) "1"
+  }
+  [%u|b%"VALUE"]=>
+  array(3) {
+    [0]=>
+    %unicode|string%(1) "1"
+    [1]=>
+    %unicode|string%(1) "1"
+    [2]=>
+    %unicode|string%(1) "1"
+  }
+}
+Done
index ff44cac70d5f5eca1946f7520ea92343838d0251..483e51573d3ac321e1aa97eee2276caf48fb4cef 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 oci_fetch_all() - 2 
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index 42fe617dc9856914663a66b01132b64814444bb0..1748ea5658eb3c80cf8b887f53a3840620b848b3 100644 (file)
@@ -14,28 +14,12 @@ $stmtarray = array(
     "create table fetch_all3_tab (id number, value number)",
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       $r = @oci_execute($s);
-       if (!$r) {
-               $m = oci_error($s);
-               if (!in_array($m['code'], array(   // ignore expected errors
-                        942 // table or view does not exist
-                ))) {
-                       echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
-               }
-       }
-}
-
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 $insert_sql = "insert into fetch_all3_tab (id, value) values (:idbv,:vbv)";
 $s = oci_parse($c, $insert_sql);
-oci_bind_by_name($s, ":idbv", $idbv, SQLT_INT);
-oci_bind_by_name($s, ":vbv", $vbv, SQLT_INT);
+oci_bind_by_name($s, ":idbv", $idbv, -1, SQLT_INT);
+oci_bind_by_name($s, ":vbv", $vbv, -1, SQLT_INT);
 
 for ($i = 1; $i <= 4; $i++) {
     $idbv = $i;
@@ -137,10 +121,7 @@ $stmtarray = array(
     "drop table fetch_all3_tab"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
     
 echo "Done\n";
 ?>
index 9b82262e3f806e4e732c75c67c5a1426fac66846..1d3c9677ee9c61a19e2ebb8454c5d70bdd1a8e58 100644 (file)
@@ -15,21 +15,7 @@ $stmtarray = array(
        "insert into fetch_all4_tab values (1, 'abc')"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       $r = @oci_execute($s);
-       if (!$r) {
-               $m = oci_error($s);
-               if (!in_array($m['code'], array(   // ignore expected errors
-                           942 // table or view does not exist
-                       ,  2289 // sequence does not exist
-                       ,  4080 // trigger does not exist
-                        , 38802 // edition does not exist
-                ))) {
-                       echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
-               }
-       }
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 // Run Test
 
@@ -56,12 +42,7 @@ $stmtarray = array(
        "drop table fetch_all4_tab"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       oci_execute($s);
-}
-
-oci_close($c);
+oci8_test_sql_execute($c, $stmtarray);
 
 ?>
 ===DONE===
index bb9061a4458d8a7b5457f4a54f260d88c002787b..a6bb3c3f18a0d64955dbd6d41f7b7259eaa4f9db 100644 (file)
@@ -17,21 +17,7 @@ $stmtarray = array(
        "insert into fetch_all5_tab values (3, 'ghi')"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       $r = @oci_execute($s);
-       if (!$r) {
-               $m = oci_error($s);
-               if (!in_array($m['code'], array(   // ignore expected errors
-                           942 // table or view does not exist
-                       ,  2289 // sequence does not exist
-                       ,  4080 // trigger does not exist
-                        , 38802 // edition does not exist
-                ))) {
-                       echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
-               }
-       }
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 // Run Test
 
@@ -65,10 +51,7 @@ $stmtarray = array(
        "drop table fetch_all5_tab"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 oci_close($c);
 
index e2f32483d58a33116e019f85893bc995c1955f71..db5c6c554b9be41ca979f9ebb91d3b6aafd963a9 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 oci_fetch_array()
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
@@ -24,6 +27,8 @@ if (!oci_commit($c)) {
        die("oci_commit() failed!\n");
 }
 
+echo "Test 1\n";
+
 $select_sql = "SELECT * FROM ".$schema."".$table_name."";
 
 if (!($s = oci_parse($c, $select_sql))) {
@@ -37,6 +42,8 @@ while ($row = oci_fetch_array($s)) {
        var_dump($row);
 }
 
+echo "Test 2\n";
+
 if (!oci_execute($s)) {
        die("oci_execute(select) failed!\n");
 }
@@ -44,6 +51,8 @@ while ($row = oci_fetch_array($s, OCI_NUM)) {
        var_dump($row);
 }
 
+echo "Test 3\n";
+
 if (!oci_execute($s)) {
        die("oci_execute(select) failed!\n");
 }
@@ -51,6 +60,8 @@ while ($row = oci_fetch_array($s, OCI_ASSOC)) {
        var_dump($row);
 }
 
+echo "Test 4\n";
+
 if (!oci_execute($s)) {
        die("oci_execute(select) failed!\n");
 }
@@ -58,6 +69,8 @@ while ($row = oci_fetch_array($s, OCI_BOTH)) {
        var_dump($row);
 }
 
+echo "Test 5\n";
+
 if (!oci_execute($s)) {
        die("oci_execute(select) failed!\n");
 }
@@ -65,6 +78,8 @@ while ($row = oci_fetch_array($s, OCI_RETURN_LOBS)) {
        var_dump($row);
 }
 
+echo "Test 6\n";
+
 if (!oci_execute($s)) {
        die("oci_execute(select) failed!\n");
 }
@@ -72,11 +87,21 @@ while ($row = oci_fetch_array($s, OCI_RETURN_NULLS)) {
        var_dump($row);
 }
 
+echo "Test 7\n";
+
+if (!oci_execute($s)) {
+       die("oci_execute(select) failed!\n");
+}
+while ($row = oci_fetch_array($s, OCI_NUM+OCI_RETURN_NULLS)) {
+       var_dump($row);
+}
+
 require dirname(__FILE__).'/drop_table.inc';
        
 echo "Done\n";
 ?>
 --EXPECT--
+Test 1
 array(10) {
   [0]=>
   string(1) "1"
@@ -143,6 +168,7 @@ array(10) {
   ["STRING"]=>
   NULL
 }
+Test 2
 array(2) {
   [0]=>
   string(1) "1"
@@ -161,6 +187,7 @@ array(2) {
   [1]=>
   string(1) "1"
 }
+Test 3
 array(2) {
   ["ID"]=>
   string(1) "1"
@@ -179,6 +206,7 @@ array(2) {
   ["VALUE"]=>
   string(1) "1"
 }
+Test 4
 array(4) {
   [0]=>
   string(1) "1"
@@ -209,6 +237,7 @@ array(4) {
   ["VALUE"]=>
   string(1) "1"
 }
+Test 5
 array(4) {
   [0]=>
   string(1) "1"
@@ -239,6 +268,7 @@ array(4) {
   ["VALUE"]=>
   string(1) "1"
 }
+Test 6
 array(10) {
   [0]=>
   string(1) "1"
@@ -305,4 +335,42 @@ array(10) {
   ["STRING"]=>
   NULL
 }
+Test 7
+array(5) {
+  [0]=>
+  string(1) "1"
+  [1]=>
+  string(1) "1"
+  [2]=>
+  NULL
+  [3]=>
+  NULL
+  [4]=>
+  NULL
+}
+array(5) {
+  [0]=>
+  string(1) "1"
+  [1]=>
+  string(1) "1"
+  [2]=>
+  NULL
+  [3]=>
+  NULL
+  [4]=>
+  NULL
+}
+array(5) {
+  [0]=>
+  string(1) "1"
+  [1]=>
+  string(1) "1"
+  [2]=>
+  NULL
+  [3]=>
+  NULL
+  [4]=>
+  NULL
+}
 Done
+
index 7dacf2e5b257e6eb7d2d28caea8e18bcc5b1c672..5c4c91e1d8aa0f6584369b5fc73814e59a1dee05 100644 (file)
@@ -1,30 +1,23 @@
 --TEST--
 oci_fetch_assoc()
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
 --FILE--
 <?php
 
 require dirname(__FILE__)."/connect.inc";
-require dirname(__FILE__).'/create_table.inc';
 
-$insert_sql = "INSERT INTO ".$schema."".$table_name." (id, value) VALUES (1,1)";
+$stmtarray = array(
+       "drop table fetch_assoc_tab",
+       "create table fetch_assoc_tab (id number, value number, dummy varchar2(20))",
+       "insert into fetch_assoc_tab values (1,1,null)",
+       "insert into fetch_assoc_tab values (1,1,null)",
+       "insert into fetch_assoc_tab values (1,1,null)"
+);
 
-if (!($s = oci_parse($c, $insert_sql))) {
-       die("oci_parse(insert) failed!\n");
-}
-
-for ($i = 0; $i<3; $i++) {
-       if (!oci_execute($s)) {
-               die("oci_execute(insert) failed!\n");
-       }
-}
+oci8_test_sql_execute($c, $stmtarray);
 
-if (!oci_commit($c)) {
-       die("oci_commit() failed!\n");
-}
-
-$select_sql = "SELECT * FROM ".$schema."".$table_name."";
+$select_sql = "select * from fetch_assoc_tab";
 
 if (!($s = oci_parse($c, $select_sql))) {
        die("oci_parse(select) failed!\n");
@@ -37,46 +30,40 @@ while ($row = oci_fetch_assoc($s)) {
        var_dump($row);
 }
 
-require dirname(__FILE__).'/drop_table.inc';
+// Clean up
+
+$stmtarray = array(
+       "drop table fetch_assoc_tab"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
 
 echo "Done\n";
 
 ?>
 --EXPECT--
-array(5) {
+array(3) {
   ["ID"]=>
   string(1) "1"
   ["VALUE"]=>
   string(1) "1"
-  ["BLOB"]=>
-  NULL
-  ["CLOB"]=>
-  NULL
-  ["STRING"]=>
+  ["DUMMY"]=>
   NULL
 }
-array(5) {
+array(3) {
   ["ID"]=>
   string(1) "1"
   ["VALUE"]=>
   string(1) "1"
-  ["BLOB"]=>
-  NULL
-  ["CLOB"]=>
-  NULL
-  ["STRING"]=>
+  ["DUMMY"]=>
   NULL
 }
-array(5) {
+array(3) {
   ["ID"]=>
   string(1) "1"
   ["VALUE"]=>
   string(1) "1"
-  ["BLOB"]=>
-  NULL
-  ["CLOB"]=>
-  NULL
-  ["STRING"]=>
+  ["DUMMY"]=>
   NULL
 }
 Done
index 17e06e1cf8c98beba33968a3a2f838f1a175e1a4..45a6a8132ed122e5a3708f939d72c2b64cff6c61 100644 (file)
@@ -17,23 +17,7 @@ $stmtarray = array(
     "insert into fetch_into_tab (id, value) values (1,1)",
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       $r = @oci_execute($s);
-       if (!$r) {
-               $m = oci_error($s);
-               if (!in_array($m['code'], array(   // ignore expected errors
-                        942 // table or view does not exist
-                ))) {
-                       echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
-               }
-       }
-}
-
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 // Run Test
 
@@ -61,11 +45,8 @@ $stmtarray = array(
     "drop table fetch_into_tab"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       oci_execute($s);
-}
-       
+oci8_test_sql_execute($c, $stmtarray);
+
 echo "Done\n";
 ?>
 --EXPECTF--
index 263590d14014f0a2a3ab1d67dc6a9c7277580521..8f7a6bdeb860c41a8e61a3d143cc60803a0a27fd 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 various ocifetchinto() tests
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index c196d39f62bef56f0cd37cf9a050acddfa54bda0..7bef2c08211ccc975774435e97f3d0146e94769f 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 ocifetchinto() & wrong number of params
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index 674a88ff28a975d4549ead929ef2195370c2c45c..1c290d5e953dd411342176b585a1fb181cb34974 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 oci_fetch_object()
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
@@ -10,53 +13,39 @@ require(dirname(__FILE__).'/connect.inc');
 // Initialization
 
 $stmtarray = array(
-       "drop table fetch_object_tab",
-       "create table fetch_object_tab (\"caseSensitive\" number, secondcol varchar2(20), anothercol char(15))",
-       "insert into fetch_object_tab values (123, '1st row col2 string', '1 more text')",
-       "insert into fetch_object_tab values (456, '2nd row col2 string', '2 more text')",
-       "insert into fetch_object_tab values (789, '3rd row col2 string', '3 more text')",
+    "drop table fetch_object_tab",
+    "create table fetch_object_tab (\"caseSensitive\" number, secondcol varchar2(20), anothercol char(15))",
+    "insert into fetch_object_tab values (123, '1st row col2 string', '1 more text')",
+    "insert into fetch_object_tab values (456, '2nd row col2 string', '2 more text')",
+    "insert into fetch_object_tab values (789, '3rd row col2 string', '3 more text')",
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       $r = @oci_execute($s);
-       if (!$r) {
-               $m = oci_error($s);
-               if (!in_array($m['code'], array(   // ignore expected errors
-                    942 // table or view does not exist
-                ,  2289 // sequence does not exist
-                ,  4080 // trigger does not exist
-                , 38802 // edition does not exist
-                ))) {
-                       echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
-               }
-       }
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 // Run Test
 
 echo "Test 1\n";
 
 if (!($s = oci_parse($c, 'select * from fetch_object_tab'))) {
-       die("oci_parse(select) failed!\n");
+    die("oci_parse(select) failed!\n");
 }
 
 if (!oci_execute($s)) {
-       die("oci_execute(select) failed!\n");
+    die("oci_execute(select) failed!\n");
 }
 
 while ($row = oci_fetch_object($s)) {
-       var_dump($row);
+    var_dump($row);
 }
 
 echo "Test 2\n";
 
 if (!($s = oci_parse($c, 'select * from fetch_object_tab'))) {
-       die("oci_parse(select) failed!\n");
+    die("oci_parse(select) failed!\n");
 }
 
 if (!oci_execute($s)) {
-       die("oci_execute(select) failed!\n");
+    die("oci_execute(select) failed!\n");
 }
 
 while ($row = oci_fetch_object($s)) {
@@ -68,11 +57,11 @@ while ($row = oci_fetch_object($s)) {
 echo "Test 3\n";
 
 if (!($s = oci_parse($c, 'select * from fetch_object_tab where rownum < 2 order by "caseSensitive"'))) {
-       die("oci_parse(select) failed!\n");
+    die("oci_parse(select) failed!\n");
 }
 
 if (!oci_execute($s)) {
-       die("oci_execute(select) failed!\n");
+    die("oci_execute(select) failed!\n");
 }
 
 $row = oci_fetch_object($s);
@@ -82,13 +71,10 @@ echo $row->CASESENSITIVE . "\n";
 // Clean up
 
 $stmtarray = array(
-       "drop table fetch_object_tab"
+    "drop table fetch_object_tab"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 ?>
 ===DONE===
diff --git a/ext/oci8/tests/fetch_object_1.phpt b/ext/oci8/tests/fetch_object_1.phpt
new file mode 100644 (file)
index 0000000..4f14a5e
--- /dev/null
@@ -0,0 +1,123 @@
+--TEST--
+oci_fetch_object()
+--SKIPIF--
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+    "drop table fetch_object_tab",
+    "create table fetch_object_tab (\"caseSensitive\" number, secondcol varchar2(20), anothercol char(15))",
+    "insert into fetch_object_tab values (123, '1st row col2 string', '1 more text')",
+    "insert into fetch_object_tab values (456, '2nd row col2 string', '2 more text')",
+    "insert into fetch_object_tab values (789, '3rd row col2 string', '3 more text')",
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+// Run Test
+
+echo "Test 1\n";
+
+if (!($s = oci_parse($c, 'select * from fetch_object_tab'))) {
+    die("oci_parse(select) failed!\n");
+}
+
+if (!oci_execute($s)) {
+    die("oci_execute(select) failed!\n");
+}
+
+while ($row = oci_fetch_object($s)) {
+    var_dump($row);
+}
+
+echo "Test 2\n";
+
+if (!($s = oci_parse($c, 'select * from fetch_object_tab'))) {
+    die("oci_parse(select) failed!\n");
+}
+
+if (!oci_execute($s)) {
+    die("oci_execute(select) failed!\n");
+}
+
+while ($row = oci_fetch_object($s)) {
+    echo $row->caseSensitive . "\n";
+    echo $row->SECONDCOL . "\n";
+    echo $row->ANOTHERCOL . "\n";
+}
+
+echo "Test 3\n";
+
+if (!($s = oci_parse($c, 'select * from fetch_object_tab where rownum < 2 order by "caseSensitive"'))) {
+    die("oci_parse(select) failed!\n");
+}
+
+if (!oci_execute($s)) {
+    die("oci_execute(select) failed!\n");
+}
+
+$row = oci_fetch_object($s);
+echo $row->caseSensitive . "\n";
+echo $row->CASESENSITIVE . "\n";
+
+// Clean up
+
+$stmtarray = array(
+    "drop table fetch_object_tab"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1
+object(stdClass)#%d (3) {
+  ["caseSensitive"]=>
+  string(3) "123"
+  ["SECONDCOL"]=>
+  string(19) "1st row col2 string"
+  ["ANOTHERCOL"]=>
+  string(15) "1 more text    "
+}
+object(stdClass)#%d (3) {
+  ["caseSensitive"]=>
+  string(3) "456"
+  ["SECONDCOL"]=>
+  string(19) "2nd row col2 string"
+  ["ANOTHERCOL"]=>
+  string(15) "2 more text    "
+}
+object(stdClass)#%d (3) {
+  ["caseSensitive"]=>
+  string(3) "789"
+  ["SECONDCOL"]=>
+  string(19) "3rd row col2 string"
+  ["ANOTHERCOL"]=>
+  string(15) "3 more text    "
+}
+Test 2
+123
+1st row col2 string
+1 more text    
+456
+2nd row col2 string
+2 more text    
+789
+3rd row col2 string
+3 more text    
+Test 3
+123
+
+Notice: Undefined property: stdClass::$CASESENSITIVE in %sfetch_object_1.php on line %d
+
+===DONE===
index b078ebb1d360ca39ceadb4acb8ed6330c4717959..1814446aa8805e60da71593aa494a8a60ec0fe9b 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 oci_fetch_object() with CLOB and NULL
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
 --FILE--
 <?php
 
@@ -10,53 +13,39 @@ require(dirname(__FILE__).'/connect.inc');
 // Initialization
 
 $stmtarray = array(
-       "drop table fetch_object_2_tab",
-       "create table fetch_object_2_tab (col1 number, col2 CLOB, col3 varchar2(15))",
-       "insert into fetch_object_2_tab values (123, '1st row col2 string', '1 more text')",
-       "insert into fetch_object_2_tab values (456, '2nd row col2 string', NULL)",
-       "insert into fetch_object_2_tab values (789, '3rd row col2 string', '3 more text')",
+    "drop table fetch_object_2_tab",
+    "create table fetch_object_2_tab (col1 number, col2 CLOB, col3 varchar2(15))",
+    "insert into fetch_object_2_tab values (123, '1st row col2 string', '1 more text')",
+    "insert into fetch_object_2_tab values (456, '2nd row col2 string', NULL)",
+    "insert into fetch_object_2_tab values (789, '3rd row col2 string', '3 more text')",
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       $r = @oci_execute($s);
-       if (!$r) {
-               $m = oci_error($s);
-               if (!in_array($m['code'], array(   // ignore expected errors
-                    942 // table or view does not exist
-                ,  2289 // sequence does not exist
-                ,  4080 // trigger does not exist
-                , 38802 // edition does not exist
-                ))) {
-                       echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
-               }
-       }
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 // Run Test
 
 echo "Test 1\n";
 
 if (!($s = oci_parse($c, 'select * from fetch_object_2_tab order by 1'))) {
-       die("oci_parse(select) failed!\n");
+    die("oci_parse(select) failed!\n");
 }
 
 if (!oci_execute($s)) {
-       die("oci_execute(select) failed!\n");
+    die("oci_execute(select) failed!\n");
 }
 
 while ($row = oci_fetch_object($s)) {
-       var_dump($row);
+    var_dump($row);
 }
 
 echo "Test 2\n";
 
 if (!($s = oci_parse($c, 'select * from fetch_object_2_tab order by 1'))) {
-       die("oci_parse(select) failed!\n");
+    die("oci_parse(select) failed!\n");
 }
 
 if (!oci_execute($s)) {
-       die("oci_execute(select) failed!\n");
+    die("oci_execute(select) failed!\n");
 }
 
 while ($row = oci_fetch_object($s)) {
@@ -68,13 +57,10 @@ while ($row = oci_fetch_object($s)) {
 // Clean up
 
 $stmtarray = array(
-       "drop table fetch_object_2_tab"
+    "drop table fetch_object_2_tab"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 ?>
 ===DONE===
@@ -82,37 +68,37 @@ foreach ($stmtarray as $stmt) {
 --EXPECTF--
 Test 1
 object(stdClass)#%d (3) {
-  [%u|b%"COL1"]=>
-  %unicode|string%(3) "123"
-  [%u|b%"COL2"]=>
+  ["COL1"]=>
+  string(3) "123"
+  ["COL2"]=>
   object(OCI-Lob)#%d (1) {
-    [%u|b%"descriptor"]=>
+    ["descriptor"]=>
     resource(%d) of type (oci8 descriptor)
   }
-  [%u|b%"COL3"]=>
-  %unicode|string%(11) "1 more text"
+  ["COL3"]=>
+  string(11) "1 more text"
 }
 object(stdClass)#%d (3) {
-  [%u|b%"COL1"]=>
-  %unicode|string%(3) "456"
-  [%u|b%"COL2"]=>
+  ["COL1"]=>
+  string(3) "456"
+  ["COL2"]=>
   object(OCI-Lob)#%d (1) {
-    [%u|b%"descriptor"]=>
+    ["descriptor"]=>
     resource(%d) of type (oci8 descriptor)
   }
-  [%u|b%"COL3"]=>
+  ["COL3"]=>
   NULL
 }
 object(stdClass)#%d (3) {
-  [%u|b%"COL1"]=>
-  %unicode|string%(3) "789"
-  [%u|b%"COL2"]=>
+  ["COL1"]=>
+  string(3) "789"
+  ["COL2"]=>
   object(OCI-Lob)#%d (1) {
-    [%u|b%"descriptor"]=>
+    ["descriptor"]=>
     resource(%d) of type (oci8 descriptor)
   }
-  [%u|b%"COL3"]=>
-  %unicode|string%(11) "3 more text"
+  ["COL3"]=>
+  string(11) "3 more text"
 }
 Test 2
 123
index c6084d4fe2980acbbb019ec5dfa4d774fffe98a2..2b28634ab3f01a9284567eaaf619ef5458bce758 100644 (file)
@@ -17,23 +17,7 @@ $stmtarray = array(
     "insert into fetch_row_tab (id, value) values (1,1)",
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       $r = @oci_execute($s);
-       if (!$r) {
-               $m = oci_error($s);
-               if (!in_array($m['code'], array(   // ignore expected errors
-                    942 // table or view does not exist
-                ))) {
-                       echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
-               }
-       }
-}
-
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 // Run Test
 
@@ -54,10 +38,7 @@ $stmtarray = array(
     "drop table fetch_row_tab"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 echo "Done\n";
 
index 18143f6f1bc11cb7aa8f56027a831a438134b340..92b77187a81a3a1ecda67ea6027c61fb2fdaa096 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 oci_field_*() family
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
diff --git a/ext/oci8/tests/field_funcs0.phpt b/ext/oci8/tests/field_funcs0.phpt
new file mode 100644 (file)
index 0000000..5448fcb
--- /dev/null
@@ -0,0 +1,108 @@
+--TEST--
+oci_field_*() family
+--SKIPIF--
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+require dirname(__FILE__).'/create_table.inc';
+
+$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");
+}
+
+for ($i = 0; $i<3; $i++) {
+       if (!oci_execute($s)) {
+               die("oci_execute(insert) failed!\n");
+       }
+}
+
+if (!oci_commit($c)) {
+       die("oci_commit() failed!\n");
+}
+
+$select_sql = "SELECT * FROM ".$schema."".$table_name."";
+
+if (!($s = oci_parse($c, $select_sql))) {
+       die("oci_parse(select) failed!\n");
+}
+
+if (!oci_execute($s)) {
+       die("oci_execute(select) failed!\n");
+}
+
+$row = oci_fetch_array($s, OCI_NUM + OCI_RETURN_NULLS + OCI_RETURN_LOBS);
+var_dump($row);
+
+foreach ($row as $num => $field) {
+       $num++;
+       var_dump(oci_field_is_null($s, $num));
+       var_dump(oci_field_name($s, $num));
+       var_dump(oci_field_type($s, $num));
+       var_dump(oci_field_type_raw($s, $num));
+       var_dump(oci_field_scale($s, $num));
+       var_dump(oci_field_precision($s, $num));
+       var_dump(oci_field_size($s, $num));
+}
+
+
+require dirname(__FILE__).'/drop_table.inc';
+
+echo "Done\n";
+
+?>
+--EXPECT--
+array(5) {
+  [0]=>
+  string(1) "1"
+  [1]=>
+  string(1) "1"
+  [2]=>
+  NULL
+  [3]=>
+  NULL
+  [4]=>
+  NULL
+}
+bool(false)
+string(2) "ID"
+string(6) "NUMBER"
+int(2)
+int(-127)
+int(0)
+int(22)
+bool(false)
+string(5) "VALUE"
+string(6) "NUMBER"
+int(2)
+int(-127)
+int(0)
+int(22)
+bool(true)
+string(4) "BLOB"
+string(4) "BLOB"
+int(113)
+int(0)
+int(0)
+int(4000)
+bool(true)
+string(4) "CLOB"
+string(4) "CLOB"
+int(112)
+int(0)
+int(0)
+int(4000)
+bool(true)
+string(6) "STRING"
+string(8) "VARCHAR2"
+int(1)
+int(0)
+int(0)
+int(10)
+Done
index 0b4ad76b393d36ecab91f2e6272e9d4d341b7057..c14ee8957e7095066e34f03c92d653e4e1497eab 100644 (file)
@@ -1,5 +1,5 @@
 --TEST--
-oci_field_*() family
+oci_field_*() family: error cases
 --SKIPIF--
 <?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
 --FILE--
@@ -14,40 +14,25 @@ $stmtarray = array(
     "create table field_funcs1_tab (id number, value number)",
     "insert into field_funcs1_tab (id, value) values (1,1)",
     "insert into field_funcs1_tab (id, value) values (1,1)",
-    "insert into field_funcs1_tab (id, value) values (1,1)",
+    "insert into field_funcs1_tab (id, value) values (1,1)"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       $r = @oci_execute($s);
-       if (!$r) {
-               $m = oci_error($s);
-               if (!in_array($m['code'], array(   // ignore expected errors
-                        942 // table or view does not exist
-                ))) {
-                       echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
-               }
-       }
-}
-
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 // Run Test
 
 if (!($s = oci_parse($c, "select * from field_funcs1_tab"))) {
-       die("oci_parse(select) failed!\n");
+    die("oci_parse(select) failed!\n");
 }
 
 if (!oci_execute($s)) {
-       die("oci_execute(select) failed!\n");
+    die("oci_execute(select) failed!\n");
 }
 
 $row = oci_fetch_array($s, OCI_NUM + OCI_RETURN_NULLS + OCI_RETURN_LOBS);
 var_dump($row);
 
+echo "Test 1\n";
 var_dump(oci_field_is_null($s, -1));
 var_dump(oci_field_name($s, -1));
 var_dump(oci_field_type($s, -1));
@@ -56,6 +41,7 @@ var_dump(oci_field_scale($s, -1));
 var_dump(oci_field_precision($s, -1));
 var_dump(oci_field_size($s, -1));
 
+echo "Test 2\n";
 var_dump(oci_field_is_null($s, "none"));
 var_dump(oci_field_name($s, "none"));
 var_dump(oci_field_type($s, "none"));
@@ -64,6 +50,7 @@ var_dump(oci_field_scale($s, "none"));
 var_dump(oci_field_precision($s, "none"));
 var_dump(oci_field_size($s, "none"));
 
+echo "Test 3\n";
 var_dump(oci_field_is_null($c, -1));
 var_dump(oci_field_name($c, -1));
 var_dump(oci_field_type($c, -1));
@@ -72,6 +59,7 @@ var_dump(oci_field_scale($c, -1));
 var_dump(oci_field_precision($c, -1));
 var_dump(oci_field_size($c, -1));
 
+echo "Test 4\n";
 var_dump(oci_field_is_null($s, array()));
 var_dump(oci_field_name($s, array()));
 var_dump(oci_field_type($s, array()));
@@ -89,10 +77,7 @@ $stmtarray = array(
     "drop table field_funcs1_tab"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 echo "Done\n";
 
@@ -104,6 +89,7 @@ array(2) {
   [1]=>
   %unicode|string%(1) "1"
 }
+Test 1
 
 Warning: oci_field_is_null(): Invalid column index "-1" in %s on line %d
 bool(false)
@@ -125,6 +111,7 @@ bool(false)
 
 Warning: oci_field_size(): Invalid column index "-1" in %s on line %d
 bool(false)
+Test 2
 
 Warning: oci_field_is_null(): Invalid column name "none" in %s on line %d
 bool(false)
@@ -146,6 +133,7 @@ bool(false)
 
 Warning: oci_field_size(): Invalid column name "none" in %s on line %d
 bool(false)
+Test 3
 
 Warning: oci_field_is_null(): supplied resource is not a valid oci8 statement resource in %s on line %d
 bool(false)
@@ -167,6 +155,7 @@ bool(false)
 
 Warning: oci_field_size(): supplied resource is not a valid oci8 statement resource in %s on line %d
 bool(false)
+Test 4
 
 Warning: oci_field_is_null(): Invalid column index "0" in %s on line %d
 bool(false)
diff --git a/ext/oci8/tests/field_funcs3.phpt b/ext/oci8/tests/field_funcs3.phpt
new file mode 100644 (file)
index 0000000..e51949c
--- /dev/null
@@ -0,0 +1,99 @@
+--TEST--
+oci_field_*() family: basic column types
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require(dirname(__FILE__)."/connect.inc");
+
+// Initialization
+$stmtarray = array(
+    "drop table field_funcs3_tab",
+    "create table field_funcs3_tab(c1_c char(2), c2_v varchar2(2), c3_n number, c4_d date)",
+    "insert into field_funcs3_tab values ('c1', 'c2', 3, '01-Jan-2010')"
+);
+
+$v = oci_server_version($c);
+if (strpos($v, 'Oracle TimesTen') === false) {
+    oci8_test_sql_execute($c, array("alter session set nls_date_format = 'DD-MON-YYYY'"));
+}
+oci8_test_sql_execute($c, $stmtarray);
+
+// Run Test
+
+$select_sql = "select * from field_funcs3_tab";
+
+if (!($s = oci_parse($c, $select_sql))) {
+       die("oci_parse(select) failed!\n");
+}
+
+if (!oci_execute($s)) {
+       die("oci_execute(select) failed!\n");
+}
+
+$row = oci_fetch_array($s, OCI_NUM + OCI_RETURN_NULLS + OCI_RETURN_LOBS);
+var_dump($row);
+
+foreach ($row as $num => $field) {
+       $num++;
+       var_dump(oci_field_is_null($s, $num));
+       var_dump(oci_field_name($s, $num));
+       var_dump(oci_field_type($s, $num));
+       var_dump(oci_field_type_raw($s, $num));
+       var_dump(oci_field_scale($s, $num));
+       var_dump(oci_field_precision($s, $num));
+       var_dump(oci_field_size($s, $num));
+}
+
+// Clean up
+
+$stmtarray = array(
+       "drop table field_funcs3_tab"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+array(4) {
+  [0]=>
+  string(2) "c1"
+  [1]=>
+  string(2) "c2"
+  [2]=>
+  string(1) "3"
+  [3]=>
+  string(1%r[19]%r) "%r(01-JAN-2010|0001-01-20 10:00:00)%r"
+}
+bool(false)
+string(4) "C1_C"
+string(4) "CHAR"
+int(96)
+int(0)
+int(0)
+int(2)
+bool(false)
+string(4) "C2_V"
+string(8) "VARCHAR2"
+int(1)
+int(0)
+int(0)
+int(2)
+bool(false)
+string(4) "C3_N"
+string(6) "NUMBER"
+int(2)
+int(-127)
+int(0)
+int(22)
+bool(false)
+string(4) "C4_D"
+string(4) "DATE"
+int(12)
+int(0)
+int(0)
+int(7)
+===DONE===
index e0d24cd7b7cb14bc2fda3f2c07c1a643f2aeaba3..629c5508f1dac8643ac751873922567346036656 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 ocicolumn*() family
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index cbcb92e7ec76c4fc2245fd899ebf70c125d0d472..cb94bfae1327af8427a45b16f06f629b719389f3 100644 (file)
Binary files a/ext/oci8/tests/lob_001.phpt and b/ext/oci8/tests/lob_001.phpt differ
index ebbef1815e2a52d2e0064b8ecf86be4c68c81945..7417f9c127b076ba46ba016228657dcc5d539f67 100644 (file)
@@ -1,21 +1,25 @@
 --TEST--
 oci_lob_write() and friends (with errors)
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --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 ";
-
-$statement = oci_parse($c,$ora_sql);
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+       "drop table lob_002_tab",
+       "create table lob_002_tab (id number, b1 BLOB)",
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+$statement = oci_parse($c, "insert into lob_002_tab (id, b1) values (1, empty_blob()) returning b1 INTO :v_blob ");
 $blob = oci_new_descriptor($c,OCI_D_LOB);
 oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB);
 oci_execute($statement, OCI_DEFAULT);
@@ -32,7 +36,7 @@ var_dump($blob->flush());
 
 oci_commit($c);
 
-$select_sql = "SELECT blob FROM ".$schema.$table_name."";
+$select_sql = "select b1 from lob_002_tab where id = 1";
 $s = oci_parse($c, $select_sql);
 oci_execute($s);
 
@@ -40,12 +44,17 @@ $row = oci_fetch_array($s, OCI_RETURN_LOBS);
 
 var_dump(strlen($row[0]));
 
+// Cleanup
 
-require dirname(__FILE__).'/drop_table.inc';
+$stmtarray = array(
+       "drop table lob_002_tab"
+);
 
-echo "Done\n";
+oci8_test_sql_execute($c, $stmtarray);
 
 ?>
+===DONE===
+<?php exit(0); ?>
 --EXPECTF--
 object(OCI-Lob)#%d (1) {
   ["descriptor"]=>
@@ -63,4 +72,4 @@ Warning: OCI-Lob::seek() expects parameter 1 to be long, string given in %slob_0
 NULL
 bool(false)
 int(40004)
-Done
+===DONE===
index 8a492d16ca9b89dede69c4f8dc5eed4fb1748030..4775444e27911340f56100b7d7606161d6309e9f 100644 (file)
Binary files a/ext/oci8/tests/lob_003.phpt and b/ext/oci8/tests/lob_003.phpt differ
index 32de4a0120058b51cc81847d99b67bb38c057199..3f583c67a2e00064547b2b3d5b2d75f4f101494c 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 oci_lob_seek()/rewind()/append()
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
        
index e1ac6e5340f17d69dec16782255b8d47d6dbb7d6..a1e3c3bd8c9b47b60bc2a5bb59869921a7f09868 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 oci_lob_is_equal()
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
        
index 3192ebc906f5fd7a29f4cbfb397e53b1267ffee1..ae6b37c960e4afbe9f589ee00708b3468a9d28a8 100644 (file)
Binary files a/ext/oci8/tests/lob_006.phpt and b/ext/oci8/tests/lob_006.phpt differ
index 1fe63092c63fe6aec8d6972e800824e762b34755..1ca236ea28a1823cdecc6507826d4b818695a2e5 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 oci_lob_write()/size()/load()
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
        
index a36bb4a34026b985bc0aecbdbc80387013de938f..6f4cc05648d81f1af2063b66292e754adc76ab1c 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 oci_lob_write()/read()/eof()
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
        
index b9f7401128e64cdb9d0f6a16ccf22ac496184ed4..4702e61acad9c46c7bc9c09aa260aaf59312eef4 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 oci_lob_import()/read()
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
        
index 59f3e145f207cacb9e112c9fe641fe5b95b05224..3361c4b9b56fd0af6bb9f3ce92c861a30ec19aa6 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 oci_lob_save()
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
        
index b074e1730ef7c897737de6e5c4bfb65c0b81a081..7580d4caf3777f690be754f62c9df64dcee571f3 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 oci_lob_copy()
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
        
index 2061969bc4c78b43acc5d9491eacefd914782e2a..99b971a0bd3dde28e01db7c24cfd477f2eaab0c5 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 oci_lob_export() 
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
        
index c56de56198b78be299f1bc878dce8c6df80d6df3..556e56dc3fb875b86d3ed1c143fa881eab078d05 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 lob buffering
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
        
index 1ba29ee649999c08d455f584c1ec3b838eec8c30..2a1a6bed64438765b520611dcbc7fe787d7d92fe 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 oci_lob_free()/close() 
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
        
index 297d5b49718c06e7ad013e53bb1ee028a7dea31e..b4a19684a3950588f742386723575c8224945882 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 various tests with wrong param count
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
        
@@ -45,7 +48,7 @@ Warning: oci_bind_by_name() expects at least 3 parameters, 2 given in %s on line
 
 Warning: oci_bind_by_name() expects at least 3 parameters, 1 given in %s on line %d
 
-Warning: oci_execute(): ORA-00932: inconsistent datatypes: expected NUMBER got BLOB in %s on line %d
+Warning: oci_execute(): ORA-00932: %s NUMBER %s BLOB in %s on line %d
 object(OCI-Lob)#%d (1) {
   ["descriptor"]=>
   resource(%d) of type (oci8 descriptor)
index 642e7195ef4ec9df3833fcdffe37d18bb4dd5ef5..e0f78e6a9f225c38a3672b7020f00dcef0ac0949 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 returning multiple lobs
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
        
index ed12cc4685843a916801a388362f4fda0cd0a3a4..d27a09052ed8ff10aee2ad26bc58070f26705c18 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 returning multiple lobs (using persistent connection)
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
        
index 35cec4bd7df7e9b86739701486a6b3fe1cca1139..352cd503372fa97283251a023c3d54f538138d93 100644 (file)
@@ -1,21 +1,27 @@
 --TEST--
 fetching the same lob several times
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
        
-require dirname(__FILE__).'/connect.inc';
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+       "drop table lob_018_tab",
+       "create table lob_018_tab (mykey number, lob_1 clob)",
+);
 
-$drop = "DROP table lob_test";
-$statement = oci_parse($c, $drop);
-@oci_execute($statement);
+oci8_test_sql_execute($c, $stmtarray);
 
-$create = "CREATE table lob_test(mykey NUMBER, lob_1 CLOB)";
-$statement = oci_parse($c, $create);
-oci_execute($statement);
+echo "Test 1\n";
 
-$init = "INSERT INTO lob_test (mykey, lob_1) VALUES(1, EMPTY_CLOB()) RETURNING lob_1 INTO :mylob";
+$init = "insert into lob_018_tab (mykey, lob_1) values(1, empty_clob()) returning lob_1 into :mylob";
 $statement = oci_parse($c, $init);
 $clob = oci_new_descriptor($c, OCI_D_LOB);
 oci_bind_by_name($statement, ":mylob", $clob, -1, OCI_B_CLOB);
@@ -24,7 +30,7 @@ $clob->save("data");
 
 oci_commit($c);
 
-$init = "INSERT INTO lob_test (mykey, lob_1) VALUES(2, EMPTY_CLOB()) RETURNING lob_1 INTO :mylob";
+$init = "insert into lob_018_tab (mykey, lob_1) values(2, empty_clob()) returning lob_1 into :mylob";
 $statement = oci_parse($c, $init);
 $clob = oci_new_descriptor($c, OCI_D_LOB);
 oci_bind_by_name($statement, ":mylob", $clob, -1, OCI_B_CLOB);
@@ -34,7 +40,18 @@ $clob->save("long data");
 oci_commit($c);
 
 
-$query = 'SELECT * FROM lob_test ORDER BY mykey ASC';
+$query = 'select * from lob_018_tab order by mykey asc';
+$statement = oci_parse ($c, $query);
+oci_execute($statement, OCI_DEFAULT);
+
+while ($row = oci_fetch_array($statement, OCI_ASSOC)) {
+       $result = $row['LOB_1']->load();
+       var_dump($result);
+}
+
+echo "Test 2\n";
+
+$query = 'select * from lob_018_tab order by mykey desc';
 $statement = oci_parse ($c, $query);
 oci_execute($statement, OCI_DEFAULT);
 
@@ -43,7 +60,18 @@ while ($row = oci_fetch_array($statement, OCI_ASSOC)) {
        var_dump($result);
 }
 
-$query = 'SELECT * FROM lob_test ORDER BY mykey DESC';
+echo "Test 3 - bind with SQLT_CLOB (an alias for OCI_B_CLOB)\n";
+
+$init = "insert into lob_018_tab (mykey, lob_1) values(3, empty_clob()) returning lob_1 into :mylob";
+$statement = oci_parse($c, $init);
+$clob = oci_new_descriptor($c, OCI_D_LOB);
+oci_bind_by_name($statement, ":mylob", $clob, -1, SQLT_CLOB);
+oci_execute($statement, OCI_DEFAULT);
+$clob->save("more stuff");
+
+oci_commit($c);
+
+$query = 'select * from lob_018_tab where mykey = 3';
 $statement = oci_parse ($c, $query);
 oci_execute($statement, OCI_DEFAULT);
 
@@ -52,16 +80,24 @@ while ($row = oci_fetch_array($statement, OCI_ASSOC)) {
        var_dump($result);
 }
 
-$drop = "DROP table lob_test";
-$statement = oci_parse($c, $drop);
-@oci_execute($statement);
+// Cleanup
+
+$stmtarray = array(
+    "drop table lob_018_tab"
+);
 
-echo "Done\n";
+oci8_test_sql_execute($c, $stmtarray);
 
 ?>
+===DONE===
+<?php exit(0); ?>
 --EXPECTF--
+Test 1
 string(4) "data"
 string(9) "long data"
+Test 2
 string(9) "long data"
 string(4) "data"
-Done
+Test 3 - bind with SQLT_CLOB (an alias for OCI_B_CLOB)
+string(10) "more stuff"
+===DONE===
index fb9a3c8188b9ea5013543e111b8111f0ec75250f..19c21f4a78d0cb26292e830e523c3ae2a81a98d9 100644 (file)
Binary files a/ext/oci8/tests/lob_019.phpt and b/ext/oci8/tests/lob_019.phpt differ
index 6564dede9bd6e67f84366906c8fc68186c1616c2..3faa89ff716a8f10fe46b4f93dbe20091a3342a3 100644 (file)
Binary files a/ext/oci8/tests/lob_020.phpt and b/ext/oci8/tests/lob_020.phpt differ
index 0ae6b377abb7aff8e0503b396993335f9ccb37fb..b7489271b9f116da4d4cd25c7ea40a6b6f7b9a50 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 oci_lob_free()/close() 
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
        
index 5fb9dfab0ec0bc9c74e4e8e18365e76112a1b771..94d175b3bd78d6310b082b1c4f003ff0811ca671 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 fetching the same lob several times
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
        
index 0c352956de0b3139db5dd6da1f34d962eaf5bf63..6416fb45a6b55f409f258ccea3992150369eb408 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 oci_lob_import()/read()
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
        
index 9a7f53240d8766f7f0332469894cc7a984817c66..ed9b56727341043076d72589641662eae0ec6b2f 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 oci_lob_load()
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
        
index 5b5e845a7ac8218b3481d540486fca9829e9c312..1566944cb8b0320853108eba4626affcb372d10a 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 oci_lob_read() tests
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
        
index 157d78a2b6e57ea37fc2691df745413a07cf1ec6..aa4c254dda154f63c37b61ca76d0bbd1430e5ca2 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 oci_lob_seek()/rewind()/append()
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
        
index 8b49b1ac5b9e3211ead69d51c08f48699b5ca574..49850635ca593effafe68472dedda42e57eae6fa 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 oci_lob_truncate()
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
        
index 8ac2da3a3282819af845d34d7d28508608ee8e05..8da7a8af8ff4f92a275a7d102a6680e06130d121 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 Test descriptor types for oci_new_descriptor()
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index 6826f36cdadf187ea552a0706cb53571a71e7dbf..56919e2ba644ecff17bfc266de225c7d858fec0c 100644 (file)
@@ -1,14 +1,21 @@
 --TEST--
 reading/writing BFILE LOBs
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension");
-include "details.inc";
-if (empty($oracle_on_localhost)) die("skip this test won't work with remote Oracle");
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+ob_start();
+phpinfo(INFO_MODULES);
+$phpinfo = ob_get_clean();
+if (preg_match('/Compile-time ORACLE_HOME/', $phpinfo) !== 1) {
+    // Assume building PHP with an ORACLE_HOME means the tested DB is on the same machine as PHP
+    die("skip this test won't work with remote Oracle");
+}
 ?>
 --FILE--
 <?php
 
-require dirname(__FILE__).'/connect.inc';
+require(dirname(__FILE__).'/connect.inc');
 
 $realdirname = dirname(__FILE__);
 $realfilename1 = "oci8bfiletest1.txt";
index 86b2956a510f52b4dbecb3085313b898fd2ce7e4..d7fd21b961c10eb25c779d2d9695eddf46396dbf 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 Test piecewise fetch of CLOBs equal to, and larger than PHP_OCI_LOB_BUFFER_SIZE
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index a27d53bb38cb2bb1e7f983fdc9ca668989bbdc42..39d27fd4a3a7c152f45bbdcf02d7dc8feb978ba1 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 Test LOB->read(), LOB->seek() and LOB->tell() with nul bytes in data
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
        
index 5d6ff6ec90f7fc8ff1710c256f42845d7d75bdb6..97b63c984df6fe5a7ae3b9fa64fe1e30afc116b5 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 oci_lob_write() and friends
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
        
index 5647cd9a414a8cab43f460027169dbe7b29952e3..cdce2d0863d41068081853397802f67732a1acbd 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 various oci_lob_write() error messages
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
        
index 6bf4058e747844a8c5aeb07f23e6de995dc34226..7561f64ff8edd6670a731e14ee1e4e4933bd1d5f 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 lob buffering - 2
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
        
index 6e1f5a73594f4c093711f799b1cdaa9fad52af22..37e010ce79b0543ed2502d2974d60d7d10755696 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 oci_lob_copy() - 2 
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
        
index e72c1cf081b1813ff4714c28bcf98037f75e6365..060b1713cf24527111ad32e692271f9ff1c9179e 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 Exercise cleanup code when LOB buffering is on
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index 228f5e81234f17c149b3664227ff903ead7d55e2..75db589aaedfc4679c215dc4c41667ac841c2823 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 Fetching two different lobs and using them after fetch
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index 91dac66c0d2809e5846a3f7af440ea6369702821..34b7b48b66c51a996f98d69338f25af5bbffe858 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 Array fetch CLOB and BLOB
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index 5675f5a928f31c899871f9b6e06060e441d6b2d0..02d057e2bbda8055048da608b3ba3f14912c47f5 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 Test CLOB->write() for multiple inserts
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index 3f8a73dc5a65bbc87be16bb8f09720a4eb33152a..0a29dc1b9e53b860a0f5726ed0de0e2023adfc5d 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 Bug #37706 (Test LOB locator reuse. Extends simple test of lob_037.phpt)
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index d04b43606a8c0e4ff587879d5e799d0d631c3d48..aa1ea98a5291077837fc390568a43ddb77344a27 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 Check LOBS are valid after statement free
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
@@ -15,10 +18,7 @@ $stmtarray = array(
        "INSERT INTO lob_041_tab VALUES('test data')"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 echo "Test 1 - explicit statement close\n";
 
@@ -60,12 +60,7 @@ $stmtarray = array(
        "DROP table lob_041_tab"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       @oci_execute($s);
-}
-
-oci_close($c);
+oci8_test_sql_execute($c, $stmtarray);
 
 ?>
 
index 25309d6fc0165164d82e74523fcd280072ec79b6..264c610455e082bfd709ccefe94033a97416e38c 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 Check various LOB error messages
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index 0280ef6de8040ff3cbdf4ff9734149e7a53f3ab1..ade79a200c60e6fd1bcf853ae73856ac77b2e5cd 100644 (file)
@@ -1,8 +1,9 @@
 --TEST--
 Bug #49560 (LOB resource destructor and refcount test)
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); 
-require(dirname(__FILE__).'/details.inc');
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
 if ($stress_test !== true) die ('skip Slow test not run when $stress_test is FALSE');
 ?>
 --FILE--
@@ -22,21 +23,7 @@ $stmtarray = array(
      end;",
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       $r = @oci_execute($s);
-       if (!$r) {
-               $m = oci_error($s);
-               if (!in_array($m['code'], array(   // ignore expected errors
-                           942 // table or view does not exist
-                       ,  2289 // sequence does not exist
-                       ,  4080 // trigger does not exist
-                        , 38802 // edition does not exist
-                ))) {
-                       echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
-               }
-       }
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 // Run Test
 
@@ -86,10 +73,7 @@ $stmtarray = array(
        "drop table lob_043_tab"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 oci_close($c);
 
diff --git a/ext/oci8/tests/lob_044.phpt b/ext/oci8/tests/lob_044.phpt
new file mode 100644 (file)
index 0000000..28599cc
--- /dev/null
@@ -0,0 +1,73 @@
+--TEST--
+oci_lob_truncate() with default parameter value
+--SKIPIF--
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
+--FILE--
+<?php
+       
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+       "drop table lob_044_tab",
+       "create table lob_044_tab (blob BLOB)",
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+
+// Run Test
+
+echo "Test 1 - truncate on insert\n";
+
+$s = oci_parse($c, "INSERT INTO lob_044_tab (blob) VALUES (empty_blob()) RETURNING blob INTO :v_blob ");
+$blob = oci_new_descriptor($c, OCI_D_LOB);
+oci_bind_by_name($s,":v_blob", $blob, -1, OCI_B_BLOB);
+oci_execute($s, OCI_DEFAULT);
+
+var_dump($blob->write("this is a biiiig faaat test string. why are you reading it, I wonder? =)"));
+var_dump($blob->seek(0));
+var_dump($blob->read(10000));
+var_dump($blob->truncate());
+var_dump($blob->seek(0));
+var_dump($blob->read(10000));
+
+oci_commit($c);
+
+
+// Read it back
+
+echo "\nTest 2 - read it back\n";
+
+$s = oci_parse($c, "SELECT blob FROM lob_044_tab FOR UPDATE");
+oci_execute($s, OCI_DEFAULT);
+$row = oci_fetch_array($s);
+var_dump($row[0]->read(10000));
+
+// Clean up
+
+$stmtarray = array(
+       "drop table lob_044_tab"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1 - truncate on insert
+int(72)
+bool(true)
+string(72) "this is a biiiig faaat test string. why are you reading it, I wonder? =)"
+bool(true)
+bool(true)
+string(0) ""
+
+Test 2 - read it back
+string(0) ""
+===DONE===
index faa59bf12ddde4b484b80d1cf9d7e5ea7cc23792..3ece9a5895879c9f30f4fa88efa9a4d985f32bb7 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 LOB method aliases
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index 227ebb89fba58d935c8cc92ee88a78078c35f25c..be3e53453d4aa385819ea1f4f46cbea4c55e8f35 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 Test null data for CLOBs
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index cad2d39058c5a352d19b5ac796845451a36766a7..9a07fb5ac0bdf081ede9db2c216a755455fcc55c 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 temporary lobs
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
        
index 2482d65f64f61c1aad086e54606f03e8322e5ac7..e27ea6d47de6c345cf374dd978a632bf5bc443b7 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 closing temporary lobs
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
        
index b4c9b61ad40aa2668e0a4bfe77cf6629b447fa15..01fb87235af7d186d6fba43feeb0989b9d38cf3c 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 Null bytes in SQL statements
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --INI--
 display_errors = On
 error_reporting = E_WARNING
@@ -19,11 +22,6 @@ oci_execute($s);
 oci_fetch_all($s, $res);
 var_dump($res);
 
-echo "Test 2: Invalid use of a null byte\n";
-
-$s = oci_parse($c, "select * from du\0al");
-oci_execute($s);
-
 echo "Test 3: Using a null byte in a bind variable name\n";
 
 $s = oci_parse($c, "select * from dual where :bv = 1");
@@ -31,14 +29,6 @@ $bv = 1;
 oci_bind_by_name($s, ":bv\0:bv", $bv);
 oci_execute($s);
  
-echo "Test 4: Using a null byte in a bind variable value causing WHERE clause to fail\n";
-
-$s = oci_parse($c, "select * from dual where :bv = 'abc'");
-$bv = 'abc\0abc';
-oci_bind_by_name($s, ":bv", $bv);
-oci_execute($s);
-oci_fetch_all($s, $res);
-var_dump($res);
 
 ?>
 ===DONE===
@@ -52,18 +42,9 @@ array(1) {
     string(1) "X"
   }
 }
-Test 2: Invalid use of a null byte
-
-Warning: oci_execute(): ORA-00942: %s in %snull_byte_2.php on line %d
 Test 3: Using a null byte in a bind variable name
 
 Warning: oci_bind_by_name(): ORA-01036: %s in %snull_byte_2.php on line %d
 
 Warning: oci_execute(): ORA-01008: %s in %snull_byte_2.php on line %d
-Test 4: Using a null byte in a bind variable value causing WHERE clause to fail
-array(1) {
-  ["DUMMY"]=>
-  array(0) {
-  }
-}
 ===DONE===
diff --git a/ext/oci8/tests/null_byte_3.phpt b/ext/oci8/tests/null_byte_3.phpt
new file mode 100644 (file)
index 0000000..73d5c26
--- /dev/null
@@ -0,0 +1,42 @@
+--TEST--
+Null bytes in SQL statements
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+--INI--
+display_errors = On
+error_reporting = E_WARNING
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Run Test
+
+echo "Test 1: Invalid use of a null byte\n";
+
+$s = oci_parse($c, "select * from du\0al");
+oci_execute($s);
+
+echo "Test 2: Using a null byte in a bind variable value causing WHERE clause to fail\n";
+
+$s = oci_parse($c, "select * from dual where :bv = 'abc'");
+$bv = 'abc\0abc';
+oci_bind_by_name($s, ":bv", $bv);
+oci_execute($s);
+oci_fetch_all($s, $res);
+var_dump($res);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1: Invalid use of a null byte
+
+Warning: oci_execute(): ORA-00942: %s in %snull_byte_3.php on line %d
+Test 2: Using a null byte in a bind variable value causing WHERE clause to fail
+array(1) {
+  ["DUMMY"]=>
+  array(0) {
+  }
+}
+===DONE===
index e9dc6a8ac2d476655c0020564b174f0f9888037a..0fe85ccddc7446ca9d984f6c21e20cd289983b4c 100644 (file)
@@ -14,23 +14,7 @@ $stmtarray = array(
     "create table num_tab (id number, value number)",
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       $r = @oci_execute($s);
-       if (!$r) {
-               $m = oci_error($s);
-               if (!in_array($m['code'], array(   // ignore expected errors
-                        942 // table or view does not exist
-                ))) {
-                       echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
-               }
-       }
-}
-
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 // Run Test
 
@@ -181,10 +165,7 @@ $stmtarray = array(
     "drop table num_tab"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 echo "Done\n";
 
index 9ba7d770fd3b8ce69f811e48a0979c8e321d21a4..59eb8013e9a0895dad060e434517000a19a26137 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 oci_execute() segfault after repeated bind of LOB descriptor
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index 7133d8bae802855cc4490749c53fcaaef858a0d2..1738702cb66242d6c854b7ee5935e989e971b11f 100644 (file)
@@ -11,20 +11,16 @@ if ($test_drcp) die("skip password change not supported in DRCP Mode");
 --FILE--
 <?php
 
-require(dirname(__FILE__)."/details.inc");
+require(dirname(__FILE__)."/connect.inc");
+
+$stmtarray = array(
+       "drop user testuser cascade",
+       "create user testuser identified by testuserpwd",
+    "grant connect, create session to testuser"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
 
-// Create a user we can stuff around with and not affect subsequent tests
-$c0 = oci_connect($user, $password, $dbase);
-$stmts = array(
-       "drop user testuser",
-       "begin
-        execute immediate 'create user testuser identified by testuserpwd';
-        execute immediate 'grant connect, create session to testuser';
-       end;");
-foreach ($stmts as $sql) {
-       $s = oci_parse($c0, $sql);
-       @oci_execute($s);
-}
 
 // Connect and change the password
 $c1 = oci_connect("testuser", "testuserpwd", $dbase);
@@ -62,16 +58,19 @@ else {
        var_dump($c2);
 }
 
-// Clean up
-oci_close($c1);
-oci_close($c2);
-oci_close($c3);
+echo "Done\n";
+
+?>
+--CLEAN--
+<?php
 
-// Clean up
-$s = oci_parse($c0, "drop user cascade testuser");
-@oci_execute($s);
+require(dirname(__FILE__)."/connect.inc");
 
-echo "Done\n";
+$stmtarray = array(
+    "drop user testuser cascade"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
 
 ?>
 --EXPECTF--
index 71423e717bf62a3056b925465e2728fb69e765a7..ceba0bba80d9c0bf59aae8ee706f520b5fbcaf64 100644 (file)
@@ -11,20 +11,15 @@ if ($test_drcp) die("skip password change not supported in DRCP Mode");
 --FILE--
 <?php
 
-require(dirname(__FILE__)."/details.inc");
+require(dirname(__FILE__)."/connect.inc");
 
-// Create a user we can stuff around with and not affect subsequent tests
-$c0 = oci_connect($user, $password, $dbase);
-$stmts = array(
-       "drop user testuser",
-       "begin
-        execute immediate 'create user testuser identified by testuserpwd';
-        execute immediate 'grant connect, create session to testuser';
-       end;");
-foreach ($stmts as $sql) {
-       $s = oci_parse($c0, $sql);
-       @oci_execute($s);
-}
+$stmtarray = array(
+       "drop user testuser cascade",
+    "create user testuser identified by testuserpwd",
+    "grant connect, create session to testuser"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
 
 // Connect (persistent) and change the password
 $c1 = oci_pconnect("testuser", "testuserpwd", $dbase);
@@ -62,16 +57,19 @@ else {
        var_dump($c2);
 }
 
-// Clean up
-oci_close($c1);
-oci_close($c2);
-oci_close($c3);
+echo "Done\n";
 
-// Clean up
-$s = oci_parse($c0, "drop user cascade testuser");
-@oci_execute($s);
+?>
+--CLEAN--
+<?php
 
-echo "Done\n";
+require(dirname(__FILE__)."/connect.inc");
+
+$stmtarray = array(
+    "drop user testuser cascade"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
 
 ?>
 --EXPECTF--
index ba6baa964b8c5b20c49aa0d74deec05af9f792db..8041699f925e2166dde6bec0585ec7944fa50d99 100644 (file)
@@ -2,23 +2,16 @@
 oci_password_change()
 --SKIPIF--
 <?php
-if (!extension_loaded('oci8')) die("skip no oci8 extension"); 
-require(dirname(__FILE__)."/connect.inc");
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on thes
+require(dirname(__FILE__).'/skipif.inc');
 if (empty($dbase)) die ("skip requires database connection string be set");
 if ($test_drcp) die("skip password change not supported in DRCP Mode");
 
 // This test is known to fail with Oracle 10.2.0.4 client libraries
 // connecting to Oracle Database 11 (Oracle bug 6277160, fixed 10.2.0.5)
-$sv = oci_server_version($c);
-$sv = preg_match('/Release (11|12)\./', $sv, $matches);
-if ($sv === 1) {
-       ob_start();
-       phpinfo(INFO_MODULES);
-       $phpinfo = ob_get_clean();
-       $iv = preg_match('/Oracle .*Version => 10/', $phpinfo);
-       if ($iv === 1) {
-               die ("skip test known to fail using Oracle 10.2.0.4 client libs connecting to Oracle 11 (6277160)");
-       }
+if (preg_match('/Release (11|12)\./', oci_server_version($c), $matches) === 1 &&
+    preg_match('/^10\.2\.0\.[1234]/', oci_client_version()) === 1) {
+    die ("skip test known to fail using Oracle 10.2.0.4 client libs connecting to Oracle 11 (6277160)");
 }
 ?>
 --FILE--
index abcaeb1e56d3ce571526ffef364cc32f52def001..3ff726d2b7c402109015eeeb94a5ebf1b490c5c9 100644 (file)
@@ -2,24 +2,19 @@
 ocipasswordchange()
 --SKIPIF--
 <?php
-if (!extension_loaded('oci8')) die("skip no oci8 extension"); 
-require(dirname(__FILE__)."/connect.inc");
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on thes
+require(dirname(__FILE__).'/skipif.inc');
 if (empty($dbase)) die ("skip requires database connection string be set");
 if ($test_drcp) die("skip password change not supported in DRCP Mode");
 
 // This test is known to fail with Oracle 10.2.0.4 client libraries
 // connecting to Oracle Database 11 (Oracle bug 6277160, fixed 10.2.0.5)
-$sv = oci_server_version($c);
-$sv = preg_match('/Release (11|12)\./', $sv, $matches);
-if ($sv === 1) {
-       ob_start();
-       phpinfo(INFO_MODULES);
-       $phpinfo = ob_get_clean();
-       $iv = preg_match('/Oracle .*Version => 10/', $phpinfo);
-       if ($iv === 1) {
-               die ("skip test known to fail using Oracle 10.2.0.4 client libs connecting to Oracle 11 (6277160)");
-       }
+if (preg_match('/Release (11|12)\./', oci_server_version($c), $matches) === 1 &&
+    preg_match('/^10\.2\.0\.[1234]/', oci_client_version()) === 1) {
+    die ("skip test known to fail using Oracle 10.2.0.4 client libs connecting to Oracle 11 (6277160)");
 }
+
+
 ?>
 --FILE--
 <?php
index 4714fadcd4bff1d378b024a83d289966e7ee0b83..4bffc7644d4261d0e7b0dc70faff907634743334 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 PECL Bug #10194 (segfault in Instant Client when memory_limit is reached inside the callback) 
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --INI--
 memory_limit=10M
 --FILE--
index 4c6aa4f1c9df0d4069c98bcdf47e52965dc9fc42..38f6d9ed2f7c71bd2b3590e81b439ea305e48d8c 100644 (file)
@@ -1,22 +1,22 @@
 --TEST--
 PECL Bug #10194 (segfault in Instant Client when memory_limit is reached inside the callback) 
 --SKIPIF--
-<?php 
-if (!extension_loaded('oci8')) die("skip no oci8 extension"); 
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
 if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platforms only");
-?>
+?> 
 --INI--
 memory_limit=3M
 --FILE--
 <?php
 
 // This test is dependent on the behavior of the memory manager
-       
-require dirname(__FILE__).'/connect.inc';
-require dirname(__FILE__).'/create_table.inc';
+    
+require(dirname(__FILE__).'/connect.inc');
+require(dirname(__FILE__).'/create_table.inc');
 
-$ora_sql = "INSERT INTO ".$schema.$table_name." (blob)
-                          VALUES (empty_blob())";
+$ora_sql = "INSERT INTO ".$schema.$table_name." (blob) VALUES (empty_blob())";
 
 $statement = oci_parse($c,$ora_sql);
 oci_execute($statement);
@@ -30,7 +30,7 @@ $row = oci_fetch_assoc($statement);
 $string = str_repeat("test", 32768*4*4);
 
 for ($i = 0; $i < 8; $i++) {
-       $row['BLOB']->write($string);
+    $row['BLOB']->write($string);
 }
 
 oci_commit($c);
@@ -48,7 +48,7 @@ require dirname(__FILE__).'/drop_table.inc';
 
 echo "Done\n";
 ?>
---EXPECTF--    
+--EXPECTF-- 
 Before load()
 
 Fatal error: Allowed memory size of %d bytes exhausted%s(tried to allocate %d bytes) in %s on line %d
index 433d586a4ef8c697647a25521e53e6222360664d..9ffc03d3203762202085b7cb3f1f13c7aa3fe583 100644 (file)
@@ -2,7 +2,8 @@
 PECL Bug #10194 (segfault in Instant Client when memory_limit is reached inside the callback) 
 --SKIPIF--
 <?php 
-if (!extension_loaded('oci8')) die("skip no oci8 extension"); 
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on thes
+require(dirname(__FILE__).'/skipif.inc');
 if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platforms only");
 ?>
 --INI--
index fc91bc91bcaa6d82543bfdacce4a56c7fbe46174..29ff6439d1c8a05b92f7bec4bb2a01ca6b476d95 100644 (file)
@@ -1,5 +1,5 @@
 --TEST--
-PECL Bug #16035 (Crash with Oracle 10.2 connecting with a character set but ORACLE_HOME isn't set)
+PECL Bug #16035 (Crash with Oracle 10.2 connecting with a character set but ORACLE_HOME is not set)
 --SKIPIF--
 <?php 
 if (!extension_loaded('oci8')) die ("skip no oci8 extension"); 
@@ -23,4 +23,7 @@ oci_connect('abc', 'def', 'ghi', 'jkl');
 <?php exit(0); ?>
 --EXPECTF--
 Warning: oci_connect(): OCIEnvNlsCreate() failed. There is something wrong with your system - please check that ORACLE_HOME and %s are set and point to the right directories in %s on line %d
+
+Warning: oci_connect(): Error while trying to retrieve text for error ORA-01804
+ in %specl_bug16035.php on line %d
 ===DONE===
index d796d2506e763f2a467af91cfe41517cf9afd112..dbf7e6bb83c4ebf61f07d3a728b584981968827f 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 PECL Bug #16842 (NO_DATA_FOUND exception is a warning)
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --INI--
 error_reporting = E_WARNING
 --FILE--
@@ -39,15 +42,15 @@ Raises NO_DATA_FOUND
 Warning: oci_execute(): OCI_NO_DATA in %s on line 11
 bool(false)
 array(4) {
-  [%u|b%"code"]=>
+  ["code"]=>
   int(1403)
-  [%u|b%"message"]=>
-  %unicode|string%(45) "ORA-01403: %s
+  ["message"]=>
+  string(%d) "ORA-01403: %s
 ORA-06512: at line 1"
-  [%u|b%"offset"]=>
+  ["offset"]=>
   int(0)
-  [%u|b%"sqltext"]=>
-  %unicode|string%(31) "begin raise NO_DATA_FOUND; end;"
+  ["sqltext"]=>
+  string(31) "begin raise NO_DATA_FOUND; end;"
 }
 Test 2
 Raises ZERO_DIVIDE
@@ -56,14 +59,14 @@ Warning: oci_execute(): ORA-01476: %s
 ORA-06512: at line 1 in %s on line 19
 bool(false)
 array(4) {
-  [%u|b%"code"]=>
+  ["code"]=>
   int(1476)
-  [%u|b%"message"]=>
-  %unicode|string%(56) "ORA-01476: %s
+  ["message"]=>
+  string(%d) "ORA-01476: %s
 ORA-06512: at line 1"
-  [%u|b%"offset"]=>
+  ["offset"]=>
   int(0)
-  [%u|b%"sqltext"]=>
-  %unicode|string%(29) "begin raise ZERO_DIVIDE; end;"
+  ["sqltext"]=>
+  string(29) "begin raise ZERO_DIVIDE; end;"
 }
 ===DONE===
index c369711fcf07d316889d9746244e3748da6165df..71771b21004b76b4b0066a9f30c71958171689ae 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 PECL Bug #8816 (issue in php_oci_statement_fetch with more than one piecewise column)
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
index 26762601df3521641c3f1729adc3941c735f1565..b163a89e94aeb9f017745633e04af7c5cd1815c3 100644 (file)
@@ -17,23 +17,7 @@ $stmtarray = array(
     "insert into prefetch_tab (id, value) values (1,1)",
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       $r = @oci_execute($s);
-       if (!$r) {
-               $m = oci_error($s);
-               if (!in_array($m['code'], array(   // ignore expected errors
-                        942 // table or view does not exist
-                ))) {
-                       echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
-               }
-       }
-}
-
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 // Run Test
 
@@ -58,10 +42,7 @@ $stmtarray = array(
     "drop table prefetch_tab"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 echo "Done\n";
 ?>
index c2ac8fe8415e9e8179c0a0284c7aa461c6a79220..ac43771c6be1d27c8ab2f3d3c5b557443812caab 100644 (file)
@@ -15,23 +15,7 @@ $stmtarray = array(
     "insert into prefetch_old_tab (id, value) values (1,1)",
 );
 
-foreach ($stmtarray as $stmt) {
-    $s = oci_parse($c, $stmt);
-    $r = @oci_execute($s);
-    if (!$r) {
-        $m = oci_error($s);
-        if (!in_array($m['code'], array(   // ignore expected errors
-                    942 // table or view does not exist
-                ))) {
-            echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
-        }
-    }
-}
-
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 // Run Test
 
@@ -61,10 +45,7 @@ $stmtarray = array(
     "drop table prefetch_old_tab"
 );
 
-foreach ($stmtarray as $stmt) {
-    $s = oci_parse($c, $stmt);
-    oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
        
 echo "Done\n";
 ?>
index c603fdd5bb8e4069f1f360b2120252a37ea3af3e..ea09fbcd979cf9bb0a79df26a34ba9d75f43b78b 100644 (file)
@@ -4,19 +4,10 @@ Prefetch with REF cursor. Test different values for prefetch with oci_set_prefet
 <?php if (!extension_loaded('oci8')) die("skip no oci8 extension");
 if (!extension_loaded('oci8')) die("skip no oci8 extension");
 require(dirname(__FILE__)."/connect.inc");
-ob_start();
-phpinfo(INFO_MODULES);
-$phpinfo = ob_get_clean();
-$iv = preg_match('/Oracle .*Version => (11\.2|12\.)/', $phpinfo);
-if ($iv == 1) {
-       $sv = oci_server_version($c);
-       $sv = preg_match('/Release 1[012]\./', $sv, $matches);
-       if ($sv != 1) {
-        die ("skip expected output only valid when using Oracle 10g or greater server");
-       }
-}
-else {
-    die ("skip expected output only valid when using Oracle 11.2 or greater client");
+if (preg_match('/Release 1[012]\./', oci_server_version($c), $matches) !== 1) {
+       die("skip expected output only valid when using Oracle 10g or greater databases");
+} else if (preg_match('/^(11\.2|12)\./', oci_client_version()) != 1) {
+    die("skip test expected to work only with Oracle 11gR2 or greater version of client");
 }
 ?>
 --FILE--
@@ -45,16 +36,7 @@ $stmtarray = array(
          end refcurpkg;"
        );
 
-foreach($stmtarray as $stmt) {
-       $s = oci_parse($c,$stmt);
-       $r = @oci_execute($s);
-    if (!$r) {
-               $msg = oci_error($s);
-               if ($msg['code'] != 942) {
-            echo $msg['message'],"\n";
-               }
-       }
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 // Insert 500 rows into the table.
 $insert_sql = "INSERT INTO refcurtest (c1, c2) VALUES (:c1,:c2)";
@@ -94,7 +76,7 @@ function fetch_frm_php($c,$cur1,$value) {
     oci_execute($s1);
     oci_set_prefetch($cur1,$value);
     oci_execute($cur1);
-    echo "Fetch Row  from PHP\n";
+    echo "Fetch Row from PHP\n";
     var_dump(oci_fetch_row($cur1));
 }
  
@@ -106,14 +88,14 @@ function fetch_frm_plsql($c,$cur1) {
     if (!oci_bind_by_name($s2,":curs1",$cur1,-1,SQLT_RSET)) {
         die("oci_bind_by_name(sql2) failed!\n");
     }
-    if (!oci_bind_by_name($s2,":c1",$c1,SQLT_INT)) {
+    if (!oci_bind_by_name($s2,":c1",$c1,-1,SQLT_INT)) {
         die("oci_bind_by_name(sql2) failed!\n");
     }
-    if (!oci_bind_by_name($s2,":c2",$c2,SQLT_AFC)) {
+    if (!oci_bind_by_name($s2,":c2",$c2,20,SQLT_CHR)) {
         die("oci_bind_by_name(sql2) failed!\n");
     }
     oci_execute($s2);
-    echo "Fetch Row  from PL/SQL\n";
+    echo "Fetch Row from PL/SQL\n";
     var_dump($c1);
     var_dump($c2);
 }
@@ -125,132 +107,125 @@ $stmtarray = array(
     "drop table refcurtest"
 );
 
-foreach($stmtarray as $stmt) {
-    $s = oci_parse($c,$stmt);
-    $r = @oci_execute($s);
-    if (!$r) {
-        $msg = oci_error($s);
-        echo $msg['message'],"\n";
-    }
-}
-oci_close($c);
+oci8_test_sql_execute($c, $stmtarray);
+
 echo "Done\n";
 ?>
 --EXPECTF--
 -----------------------------------------------
 Test with Prefetch value set to 0 
 -----------------------------------------------
-Fetch Row  from PHP
+Fetch Row from PHP
 array(2) {
   [0]=>
-  %unicode|string%(%d) "0"
+  string(%d) "0"
   [1]=>
-  %unicode|string%(%d) "test0"
+  string(%d) "test0"
 }
-Fetch Row  from PL/SQL
-%unicode|string%(%d) "1"
-%unicode|string%(%d) "test1"
+Fetch Row from PL/SQL
+int(1)
+string(%d) "test1"
 -----------------------------------------------
 Test with Prefetch value set to 1 
 -----------------------------------------------
-Fetch Row  from PHP
+Fetch Row from PHP
 array(2) {
   [0]=>
-  %unicode|string%(%d) "0"
+  string(%d) "0"
   [1]=>
-  %unicode|string%(%d) "test0"
+  string(%d) "test0"
 }
-Fetch Row  from PL/SQL
-%unicode|string%(%d) "2"
-%unicode|string%(%d) "test2"
+Fetch Row from PL/SQL
+int(2)
+string(%d) "test2"
 -----------------------------------------------
 Test with Prefetch value set to 501 
 -----------------------------------------------
-Fetch Row  from PHP
+Fetch Row from PHP
 array(2) {
   [0]=>
-  %unicode|string%(%d) "0"
+  string(%d) "0"
   [1]=>
-  %unicode|string%(%d) "test0"
+  string(%d) "test0"
 }
 
 Warning: oci_execute(): ORA-01002: %s
-ORA-06512: at "SYSTEM.REFCURPKG", line %d
+ORA-06512: at "%s.REFCURPKG", line %d
 ORA-06512: at line %d in %s on line %d
-Fetch Row  from PL/SQL
-NULL
+Fetch Row from PL/SQL
+int(0)
 NULL
 -----------------------------------------------
 Test with Prefetch value set to 499 
 -----------------------------------------------
-Fetch Row  from PHP
+Fetch Row from PHP
 array(2) {
   [0]=>
-  %unicode|string%(%d) "0"
+  string(%d) "0"
   [1]=>
-  %unicode|string%(%d) "test0"
+  string(%d) "test0"
 }
-Fetch Row  from PL/SQL
-%unicode|string%(%d) "500"
-%unicode|string%(%d) "test500"
+Fetch Row from PL/SQL
+int(500)
+string(%d) "test500"
 -----------------------------------------------
 Test with Prefetch value set to 250 
 -----------------------------------------------
-Fetch Row  from PHP
+Fetch Row from PHP
 array(2) {
   [0]=>
-  %unicode|string%(%d) "0"
+  string(%d) "0"
   [1]=>
-  %unicode|string%(%d) "test0"
+  string(%d) "test0"
 }
-Fetch Row  from PL/SQL
-%unicode|string%(%d) "251"
-%unicode|string%(%d) "test251"
+Fetch Row from PL/SQL
+int(251)
+string(%d) "test251"
 -----------------------------------------------
 Test with Prefetch value set to 12345 
 -----------------------------------------------
-Fetch Row  from PHP
+Fetch Row from PHP
 array(2) {
   [0]=>
-  %unicode|string%(%d) "0"
+  string(%d) "0"
   [1]=>
-  %unicode|string%(%d) "test0"
+  string(%d) "test0"
 }
 
 Warning: oci_execute(): ORA-01002: %s
-ORA-06512: at "SYSTEM.REFCURPKG", line %d
+ORA-06512: at "%s.REFCURPKG", line %d
 ORA-06512: at line %d in %s on line %d
-Fetch Row  from PL/SQL
-NULL
+Fetch Row from PL/SQL
+int(0)
 NULL
 -----------------------------------------------
 Test with Prefetch value set to -12345 
 -----------------------------------------------
 
 Warning: oci_set_prefetch(): Number of rows to be prefetched has to be greater than or equal to 0 in %s on line %d
-Fetch Row  from PHP
+Fetch Row from PHP
 array(2) {
   [0]=>
-  %unicode|string%(%d) "0"
+  string(%d) "0"
   [1]=>
-  %unicode|string%(%d) "test0"
+  string(%d) "test0"
 }
-Fetch Row  from PL/SQL
-%unicode|string%(%d) "101"
-%unicode|string%(%d) "test101"
+Fetch Row from PL/SQL
+int(101)
+string(%d) "test101"
 -----------------------------------------------
 Test with Prefetch value set to -1 
 -----------------------------------------------
 
 Warning: oci_set_prefetch(): Number of rows to be prefetched has to be greater than or equal to 0 in %s on line %d
-Fetch Row  from PHP
+Fetch Row from PHP
 array(2) {
   [0]=>
-  %unicode|string%(%d) "0"
+  string(%d) "0"
   [1]=>
-  %unicode|string%(%d) "test0"
+  string(%d) "test0"
 }
-Fetch Row  from PL/SQL
-%unicode|string%(%d) "101"
-%unicode|string%(%d) "test101"
+Fetch Row from PL/SQL
+int(101)
+string(%d) "test101"
 Done
index 78ce051756d7f1af239d6d059fba75e8b8d289de..8d65251077ea307d1d670de4d5eb6433e6fe6c16 100644 (file)
@@ -4,19 +4,10 @@ Prefetch with REF cursor. Test No 2
 <?php if (!extension_loaded('oci8')) die("skip no oci8 extension");
 if (!extension_loaded('oci8')) die("skip no oci8 extension");
 require(dirname(__FILE__)."/connect.inc");
-ob_start();
-phpinfo(INFO_MODULES);
-$phpinfo = ob_get_clean();
-$iv = preg_match('/Oracle .*Version => (11\.2|12\.)/', $phpinfo);
-if ($iv == 1) {
-    $sv = oci_server_version($c);
-    $sv = preg_match('/Release 1[012]\./', $sv, $matches);
-    if ($sv != 1) {
-        die ("skip expected output only valid when using Oracle 10g or greater server");
-    }
-}
-else {
-    die ("skip expected output only valid when using  Oracle 11.1 or greater client");
+if (preg_match('/Release 1[012]\./', oci_server_version($c), $matches) !== 1) {
+       die("skip expected output only valid when using Oracle 10g or greater databases");
+} else if (preg_match('/^(11\.2|12)\./', oci_client_version()) != 1) {
+    die("skip test expected to work only with Oracle 11gR2 or greater version of client");
 }
 ?>
 --FILE--
@@ -45,16 +36,7 @@ $stmtarray = array(
          end refcurpkg;"
        );
 
-foreach($stmtarray as $stmt) {
-       $s = oci_parse($c,$stmt);
-       $r = @oci_execute($s);
-    if (!$r) {
-               $msg = oci_error($s);
-               if ($msg['code'] != 942) {
-            echo $msg['message'],"\n";
-               }
-       }
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 // Insert 500 rows into the table.
 $insert_sql = "INSERT INTO refcurtest (c1, c2) VALUES (:c1,:c2)";
@@ -85,13 +67,13 @@ if (!oci_bind_by_name($s1,":cur1",$cur1,-1,SQLT_RSET)) {
 
 $sql2 = "begin refcurpkg.fetch_ref_cur(:curs1,:c1,:c2); end;";
 $s2 = oci_parse($c,$sql2);
-if (!oci_bind_by_name($s2,":curs1",$cur1,-1,SQLT_RSET)) {
+if (!oci_bind_by_name($s2, ":curs1", $cur1, -1, SQLT_RSET)) {
     die("oci_bind_by_name(sql2) failed!\n");
 }
-if (!oci_bind_by_name($s2,":c1",$c1,SQLT_INT)) {
+if (!oci_bind_by_name($s2, ":c1", $c1, -1, SQLT_INT)) {
     die("oci_bind_by_name(sql2) failed!\n");
 }
-if (!oci_bind_by_name($s2,":c2",$c2,SQLT_AFC)) {
+if (!oci_bind_by_name($s2, ":c2", $c2, 20, SQLT_CHR)) {
     die("oci_bind_by_name(sql2) failed!\n");
 }
 
@@ -124,7 +106,7 @@ if (!oci_bind_by_name($s1,":cur1",$cur1,-1,SQLT_RSET)) {
     die("oci_bind_by_name(sql1) failed!\n");
 }
 
-echo "Fetch Row  from PHP\n";
+echo "Fetch Row from PHP\n";
 oci_execute($s1);
 oci_execute($cur1);
 var_dump(oci_fetch_row($cur1));
@@ -135,55 +117,10 @@ if (!oci_bind_by_name($s2,":curs1",$cur1,-1,SQLT_RSET)) {
     die("oci_bind_by_name(sql2) failed!\n");
 }
 oci_execute($s2);
-echo "Fetch Row  from PL/SQL\n";
-var_dump($c1);
-var_dump($c2);
-
-echo "------Test 3 - Set Prefetch after PL/SQL fetch ----------\n";
-$cur1 = oci_new_cursor($c);
-// Fetch from PL/SQL 
-if (!oci_bind_by_name($s2,":curs1",$cur1,-1,SQLT_RSET)) {
-    die("oci_bind_by_name(sql2) failed!\n");
-}
-oci_execute($s2);
-echo "Fetch Row  from PL/SQL\n";
-var_dump($c1);
-var_dump($c2);
-
-// Fetch from PHP
-echo "Fetch Row  from PHP\n";
-if (!oci_bind_by_name($s1,":cur1",$cur1,-1,SQLT_RSET)) {
-    die("oci_bind_by_name(sql1) failed!\n");
-}
-oci_set_prefetch($cur1,5);
-oci_execute($s1);
-oci_execute($cur1);
-var_dump(oci_fetch_row($cur1));
-
-echo "------Test 4- Overwrite prefetch-----------\n";
-// Fetch from PHP
-$cur1 = oci_new_cursor($c);
-if (!oci_bind_by_name($s1,":cur1",$cur1,-1,SQLT_RSET)) {
-    die("oci_bind_by_name(sql1) failed!\n");
-}
-echo "Fetch Row  from PHP\n";
-oci_execute($s1);
-oci_execute($cur1);
-var_dump(oci_fetch_row($cur1));
-oci_set_prefetch($cur1,5);
-oci_set_prefetch($cur1,0);
-oci_set_prefetch($cur1,100);
-
-// Fetch from PL/SQL
-if (!oci_bind_by_name($s2,":curs1",$cur1,-1,SQLT_RSET)) {
-    die("oci_bind_by_name(sql2) failed!\n");
-}
-oci_execute($s2);
-echo "Fetch Row  from PL/SQL\n";
+echo "Fetch Row from PL/SQL\n";
 var_dump($c1);
 var_dump($c2);
 
-
 function  print_roundtrips($c) {
     $sql_stmt = "select value from v\$mystat a,v\$statname c where
         a.statistic#=c.statistic# and c.name='SQL*Net roundtrips to/from client'";
@@ -201,117 +138,83 @@ $stmtarray = array(
     "drop table refcurtest"
 );
 
-foreach($stmtarray as $stmt) {
-    $s = oci_parse($c,$stmt);
-    $r = @oci_execute($s);
-    if (!$r) {
-        $msg = oci_error($s);
-        echo $msg['message'],"\n";
-    }
-}
+oci8_test_sql_execute($c, $stmtarray);
 
-oci_close($c);
 echo "Done\n";
 ?>
 --EXPECTF--
 ------Test 1- Check Roundtrips with  prefetch 0 and 5 -----------
 array(2) {
   [0]=>
-  %unicode|string%(%d) "0"
+  string(1) "0"
   [1]=>
-  %unicode|string%(%d) "test0"
+  string(5) "test0"
 }
 array(2) {
   [0]=>
-  %unicode|string%(%d) "1"
+  string(1) "1"
   [1]=>
-  %unicode|string%(%d) "test1"
+  string(5) "test1"
 }
 array(2) {
   [0]=>
-  %unicode|string%(%d) "2"
+  string(1) "2"
   [1]=>
-  %unicode|string%(%d) "test2"
+  string(5) "test2"
 }
 array(2) {
   [0]=>
-  %unicode|string%(%d) "3"
+  string(1) "3"
   [1]=>
-  %unicode|string%(%d) "test3"
+  string(5) "test3"
 }
 array(2) {
   [0]=>
-  %unicode|string%(%d) "4"
+  string(1) "4"
   [1]=>
-  %unicode|string%(%d) "test4"
+  string(5) "test4"
 }
 Number of roundtrips made with prefetch count 0 for 5 rows is  6
 array(2) {
   [0]=>
-  %unicode|string%(%d) "5"
+  string(1) "5"
   [1]=>
-  %unicode|string%(%d) "test5"
+  string(5) "test5"
 }
 array(2) {
   [0]=>
-  %unicode|string%(%d) "6"
+  string(1) "6"
   [1]=>
-  %unicode|string%(%d) "test6"
+  string(5) "test6"
 }
 array(2) {
   [0]=>
-  %unicode|string%(%d) "7"
+  string(1) "7"
   [1]=>
-  %unicode|string%(%d) "test7"
+  string(5) "test7"
 }
 array(2) {
   [0]=>
-  %unicode|string%(%d) "8"
+  string(1) "8"
   [1]=>
-  %unicode|string%(%d) "test8"
+  string(5) "test8"
 }
 array(2) {
   [0]=>
-  %unicode|string%(%d) "9"
+  string(1) "9"
   [1]=>
-  %unicode|string%(%d) "test9"
+  string(5) "test9"
 }
 Number of roundtrips made with prefetch count 5 for 5 rows is  2
 ------Test 2 - Set Prefetch before PL/SQL fetch ----------
-Fetch Row  from PHP
-array(2) {
-  [0]=>
-  %unicode|string%(%d) "0"
-  [1]=>
-  %unicode|string%(%d) "test0"
-}
-Fetch Row  from PL/SQL
-%unicode|string%(%d) "101"
-%unicode|string%(%d) "test101"
-------Test 3 - Set Prefetch after PL/SQL fetch ----------
-
-Warning: oci_execute(): ORA-01001: %s
-ORA-06512: at "%s.REFCURPKG", line %d
-ORA-06512: at line %d in %s on line %d
-Fetch Row  from PL/SQL
-%unicode|string%(%d) "101"
-%unicode|string%(%d) "test101"
-Fetch Row  from PHP
-array(2) {
-  [0]=>
-  %unicode|string%(%d) "0"
-  [1]=>
-  %unicode|string%(%d) "test0"
-}
-------Test 4- Overwrite prefetch-----------
-Fetch Row  from PHP
+Fetch Row from PHP
 array(2) {
   [0]=>
-  %unicode|string%(%d) "0"
+  string(1) "0"
   [1]=>
-  %unicode|string%(%d) "test0"
+  string(5) "test0"
 }
-Fetch Row  from PL/SQL
-%unicode|string%(%d) "101"
-%unicode|string%(%d) "test101"
+Fetch Row from PL/SQL
+int(101)
+string(%d) "test101"
 Done
index 0666a96e909388e0eea3d1202e11bb3876acb841..8c0414042b0fca644b27fe99186c01e1884f3551 100644 (file)
@@ -6,19 +6,10 @@ oci8.default_prefetch=5
 <?php if (!extension_loaded('oci8')) die("skip no oci8 extension");
 if (!extension_loaded('oci8')) die("skip no oci8 extension");
 require(dirname(__FILE__)."/connect.inc");
-ob_start();
-phpinfo(INFO_MODULES);
-$phpinfo = ob_get_clean();
-$iv = preg_match('/Oracle .*Version => (11\.2|12\.)/', $phpinfo);
-if ($iv == 1) {
-    $sv = oci_server_version($c);
-    $sv = preg_match('/Release (11\.2|12\.)/', $sv, $matches);
-    if ($sv != 1) {
-        die ("skip expected output only valid when using Oracle 11.2 or greater server");
-    }
-}
-else {
-    die ("skip expected output only valid when using Oracle 11.2 or greater client");
+if (preg_match('/Release (11\.2|12)\./', oci_server_version($c), $matches) !== 1) {
+       die("skip expected output only valid when using Oracle 11gR2 or greater databases");
+} else if (preg_match('/^(11\.2|12)\./', oci_client_version()) != 1) {
+    die("skip test expected to work only with Oracle 11gR2 or greater version of client");
 }
 
 ?>
@@ -32,16 +23,8 @@ $stmtarray = array(
     "create table nescurtest(c1 varchar2(10))"
 );
 
-foreach($stmtarray as $stmt) {
-    $s = oci_parse($c,$stmt);
-    $r = @oci_execute($s);
-    if (!$r) {
-        $msg = oci_error($s);
-               if ($msg['code'] !=942) {
-            echo $msg['message'],"\n";
-               }
-    }
-}
+oci8_test_sql_execute($c, $stmtarray);
+
 // Insert 500 rows into the table.
 $insert_sql = "INSERT INTO nescurtest (c1) VALUES (:c1)";
 if (!($s = oci_parse($c, $insert_sql))) {
@@ -92,15 +75,8 @@ $stmtarray = array(
     "drop table nescurtest"
 );
 
-foreach($stmtarray as $stmt) {
-    $s = oci_parse($c,$stmt);
-    $r = @oci_execute($s);
-    if (!$r) {
-        $msg = oci_error($s);
-        echo $msg['message'],"\n";
-    }
-}
-oci_close($c);
+oci8_test_sql_execute($c, $stmtarray);
+
 echo "Done\n";
 ?>
 --EXPECTF--
diff --git a/ext/oci8/tests/refcur_prefetch_4.phpt b/ext/oci8/tests/refcur_prefetch_4.phpt
new file mode 100644 (file)
index 0000000..d24398c
--- /dev/null
@@ -0,0 +1,176 @@
+--TEST--
+Prefetch with REF cursor. Test No 4
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension");
+if (!extension_loaded('oci8')) die("skip no oci8 extension");
+require(dirname(__FILE__)."/connect.inc");
+if (preg_match('/Release 1[012]\./', oci_server_version($c), $matches) !== 1) {
+       die("skip expected output only valid when using Oracle 10g or greater databases");
+} else if (preg_match('/^(11\.2|12)\./', oci_client_version()) != 1) {
+    die("skip test expected to work only with Oracle 11gR2 or greater version of client");
+}
+?>
+--FILE--
+<?php
+require dirname(__FILE__)."/connect.inc";
+
+// Creates the necessary package and tables. 
+$stmtarray = array(
+          "DROP TABLE refcurtest",
+
+          "CREATE TABLE refcurtest (c1 NUMBER, c2 VARCHAR(20))",
+
+       "CREATE or REPLACE PACKAGE refcurpkg is
+           type refcursortype is ref cursor;
+           procedure open_ref_cur(cur1 out refcursortype);
+           procedure fetch_ref_cur(cur1 in refcursortype, c1 out number, c2 out varchar2);
+        end refcurpkg;",
+
+       "CREATE or REPLACE PACKAGE body refcurpkg is
+           procedure open_ref_cur(cur1 out refcursortype) is
+          begin
+               open cur1 for select * from refcurtest order by c1;
+             end open_ref_cur;
+            procedure fetch_ref_cur(cur1 in refcursortype, c1 out number, c2 out varchar2) is
+             begin
+               fetch cur1 into c1,c2;
+             end fetch_ref_cur;
+         end refcurpkg;"
+       );
+
+oci8_test_sql_execute($c, $stmtarray);
+
+// Insert 500 rows into the table.
+$insert_sql = "INSERT INTO refcurtest (c1, c2) VALUES (:c1,:c2)";
+if (!($s = oci_parse($c, $insert_sql))) {
+    die("oci_parse(insert) failed!\n");
+}
+
+for ($i = 0; $i <= 500; $i++) {
+    $val2 = 'test'.$i;
+    oci_bind_by_name($s,':c1',$i);
+    oci_bind_by_name($s,':c2',$val2);
+    if (!oci_execute($s)) {
+        die("oci_execute(insert) failed!\n");
+    }
+}
+
+// Steps to Fetch from PHP . For every sub-test,the cursor is bound and then executed.
+
+$sql1 = "begin refcurpkg.open_ref_cur(:cur1); end;";
+$s1 = oci_parse($c,$sql1);
+$cur1 = oci_new_cursor($c);
+if (!oci_bind_by_name($s1,":cur1",$cur1,-1,SQLT_RSET)) {
+    die("oci_bind_by_name(sql1) failed!\n");
+}
+
+
+// Steps to Fetch from PL/SQL . For every sub-test,the cursor is bound and then executed.
+
+$sql2 = "begin refcurpkg.fetch_ref_cur(:curs1,:c1,:c2); end;";
+$s2 = oci_parse($c,$sql2);
+if (!oci_bind_by_name($s2, ":curs1", $cur1, -1, SQLT_RSET)) {
+    die("oci_bind_by_name(sql2) failed!\n");
+}
+if (!oci_bind_by_name($s2, ":c1", $c1, -1, SQLT_INT)) {
+    die("oci_bind_by_name(sql2) failed!\n");
+}
+if (!oci_bind_by_name($s2, ":c2", $c2, 20, SQLT_CHR)) {
+    die("oci_bind_by_name(sql2) failed!\n");
+}
+
+
+echo "------Test 1 - Set Prefetch after PL/SQL fetch ----------\n";
+$cur1 = oci_new_cursor($c);
+// Fetch from PL/SQL 
+if (!oci_bind_by_name($s2,":curs1",$cur1,-1,SQLT_RSET)) {
+    die("oci_bind_by_name(sql2) failed!\n");
+}
+oci_execute($s2);
+echo "Fetch Row from PL/SQL\n";
+var_dump($c1);
+var_dump($c2);
+
+// Fetch from PHP
+echo "Fetch Row from PHP\n";
+if (!oci_bind_by_name($s1,":cur1",$cur1,-1,SQLT_RSET)) {
+    die("oci_bind_by_name(sql1) failed!\n");
+}
+oci_set_prefetch($cur1,5);
+oci_execute($s1);
+oci_execute($cur1);
+var_dump(oci_fetch_row($cur1));
+
+echo "------Test 2- Overwrite prefetch-----------\n";
+// Fetch from PHP
+$cur1 = oci_new_cursor($c);
+if (!oci_bind_by_name($s1,":cur1",$cur1,-1,SQLT_RSET)) {
+    die("oci_bind_by_name(sql1) failed!\n");
+}
+echo "Fetch Row from PHP\n";
+oci_execute($s1);
+oci_execute($cur1);
+var_dump(oci_fetch_row($cur1));
+oci_set_prefetch($cur1,5);
+oci_set_prefetch($cur1,0);
+oci_set_prefetch($cur1,100);
+
+// Fetch from PL/SQL
+if (!oci_bind_by_name($s2,":curs1",$cur1,-1,SQLT_RSET)) {
+    die("oci_bind_by_name(sql2) failed!\n");
+}
+oci_execute($s2);
+echo "Fetch Row from PL/SQL\n";
+var_dump($c1);
+var_dump($c2);
+
+
+function  print_roundtrips($c) {
+    $sql_stmt = "select value from v\$mystat a,v\$statname c where
+        a.statistic#=c.statistic# and c.name='SQL*Net roundtrips to/from client'";
+    $s = oci_parse($c,$sql_stmt);
+    oci_define_by_name($s,"VALUE",$value);
+    oci_execute($s);
+    oci_fetch($s);
+    return $value;
+}
+
+// Clean up  here
+
+$stmtarray = array(
+    "drop package refcurpkg",
+    "drop table refcurtest"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+echo "Done\n";
+?>
+--EXPECTF--
+------Test 1 - Set Prefetch after PL/SQL fetch ----------
+
+Warning: oci_execute(): ORA-01001: %s
+ORA-06512: at "SYSTEM.REFCURPKG", line %d
+ORA-06512: at line %d in %s on line %d
+Fetch Row from PL/SQL
+int(0)
+NULL
+Fetch Row from PHP
+array(2) {
+  [0]=>
+  string(1) "0"
+  [1]=>
+  string(5) "test0"
+}
+------Test 2- Overwrite prefetch-----------
+Fetch Row from PHP
+array(2) {
+  [0]=>
+  string(1) "0"
+  [1]=>
+  string(5) "test0"
+}
+Fetch Row from PL/SQL
+int(101)
+string(%d) "test101"
+Done
index 87c5b815fd242f496f0c25c02d49ce1cfb8ec0f5..450c81a877e0ec11640f6ae7786028d944a5a382 100644 (file)
@@ -15,11 +15,11 @@ var_dump(oci_fetch_array($stmt, OCI_RETURN_NULLS));
 
 echo "Done\n";
 ?>
---EXPECT--     
+--EXPECTF--    
 array(2) {
   [0]=>
   NULL
-  ["NULL"]=>
+  ["%r(NULL|EXP)%r"]=>
   NULL
 }
 Done
index bf32fe4b54b42d67b9ddfe0dc5a54a1168dc3304..6cbb5aaad004fb41d2daa6d777cd8f89460e9ed0 100644 (file)
@@ -25,6 +25,6 @@ echo "Done\n";
 ?>
 --EXPECTF--
 resource(%d) of type (oci8 connection)
-string(%d) "%s"
-string(%d) "%s"
+string(%d) "Oracle %s"
+string(%d) "Oracle %s"
 Done
index ed0992c8d9c32eb689714a2be28b8613347ede30..0ae2876e2214bb4760c5d9b67197e89f8af24612 100644 (file)
@@ -2,9 +2,17 @@
 
 if (!extension_loaded('oci8')) die("skip oci8 extension is not available\n");
 
-/* 
- * Remove or comment this line to run tests 
- *
- * */
-die("skip change default login/password\n");
+// Check the test file is valid for this DB type
+require(dirname(__FILE__).'/connect.inc');
+$v = oci_server_version($c);
+if (strpos($v, 'Oracle Database') !== false)
+    $dbtype = 'oracledb';
+else if (strpos($v, 'Oracle TimesTen') !== false)
+    $dbtype = 'timesten';
+else {
+    die("skip Unknown database type $v\n");
+}
+if (!array_key_exists($dbtype, $target_dbs) || $target_dbs[$dbtype] !== true)
+    die("skip Test not valid for $v\n");
+
 ?>
index 19e69d4c21c1178a8fa088dd5ab9108d1952248c..4c48d3f1ddec4c094e8ee6be83f4cb030f9bdbae 100644 (file)
@@ -1,10 +1,15 @@
 --TEST--
 statement cache
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php 
+$target_dbs = array('oracledb' => true, 'timesten' => true);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
 --FILE--
 <?php
 
+// Note: with TimesTen, the column will be called "EXP"
+
 require dirname(__FILE__)."/connect.inc";
 
 $pc = oci_pconnect($user, $password, $dbase);
@@ -23,13 +28,13 @@ echo "Done\n";
 array(2) {
   [0]=>
   string(1) "4"
-  ["1+3"]=>
+  ["%r(1\+3|EXP)%r"]=>
   string(1) "4"
 }
 array(2) {
   [0]=>
   string(1) "4"
-  ["1+3"]=>
+  ["%r(1\+3|EXP)%r"]=>
   string(1) "4"
 }
 Done
index a9458c83d439d33a94214368dfc333e66b81de0a..21aca6cc126b730da9fedffa1268cc14460f78c0 100644 (file)
@@ -1,8 +1,10 @@
 --TEST--
 Basic XMLType test
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
-<?php if (!extension_loaded("simplexml")) die("skip no simplexml extension"); ?>
+<?php 
+if (!extension_loaded("simplexml")) die("skip no simplexml extension");
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
 --FILE--
 <?php
 
@@ -10,7 +12,7 @@ require(dirname(__FILE__)."/connect.inc");
 
 // Initialization
 
-$stmts = array(
+$stmtarray = array(
        "drop table xtt",
        "create table xtt
                   (xt_id number, xt_spec xmltype)
@@ -31,16 +33,7 @@ $stmts = array(
                </Xt>'))"
 );
 
-foreach ($stmts as $q) {
-       $s = oci_parse($c, $q);
-       $r = @oci_execute($s);
-       if (!$r) {
-               $m = oci_error($s);
-               if ($m['code'] != 942) {  // table or view doesn't exist
-                       echo $m['message'], "\n";
-               }
-       }
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 function do_query($c)
 {
@@ -78,14 +71,11 @@ $data = do_query($c);
 
 // Cleanup
 
-$stmts = array(
+$stmtarray = array(
        "drop table xtt",
 );
 
-foreach ($stmts as $q) {
-       $s = oci_parse($c, $q);
-       @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 echo "Done\n";
 
index 9b6fa8ad3294d2e094d6b4039358ee8ee203a04f..83b4123067d4db3980d1348553522a053bda60f7 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 Basic XMLType test #2
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?> 
 --FILE--
 <?php
 
@@ -14,20 +17,7 @@ $stmtarray = array(
        "create table xmltype_02_tab (warehouse_id number, warehouse_spec xmltype)",
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       $r = @oci_execute($s);
-       if (!$r) {
-               $m = oci_error($s);
-               if (!in_array($m['code'], array(   // ignore expected errors
-                          942 // table or view does not exist
-                       , 2289 // sequence does not exist
-                       , 4080 // trigger does not exist
-                ))) {
-                       echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
-               }
-       }
-}
+oci8_test_sql_execute($c, $stmtarray);
 
 // Run Test
 
@@ -109,18 +99,11 @@ $row[0]->free();
 
 // Clean up
 
-//require(dirname(__FILE__).'/drop_table.inc');
-
 $stmtarray = array(
        "drop table xmltype_02_tab"
 );
 
-foreach ($stmtarray as $stmt) {
-       $s = oci_parse($c, $stmt);
-       oci_execute($s);
-}
-
-oci_close($c);
+oci8_test_sql_execute($c, $stmtarray);
 
 ?>
 ===DONE===
@@ -130,57 +113,57 @@ Test 1 Insert new XML data using a temporary CLOB
 array(1) {
   [0]=>
   object(OCI-Lob)#%d (1) {
-    [%u|b%"descriptor"]=>
+    ["descriptor"]=>
     resource(%d) of type (oci8 descriptor)
   }
 }
 Test 2 Manipulate the data using SimpleXML
 object(SimpleXMLElement)#%d (10) {
-  [%u|b%"WarehouseId"]=>
-  %unicode|string%(1) "1"
-  [%u|b%"WarehouseName"]=>
-  %unicode|string%(16) "Southlake, Texas"
-  [%u|b%"Building"]=>
-  %unicode|string%(5) "Owned"
-  [%u|b%"Area"]=>
-  %unicode|string%(5) "25000"
-  [%u|b%"Docks"]=>
-  %unicode|string%(1) "2"
-  [%u|b%"DockType"]=>
-  %unicode|string%(9) "Rear load"
-  [%u|b%"WaterAccess"]=>
-  %unicode|string%(4) "true"
-  [%u|b%"RailAccess"]=>
-  %unicode|string%(1) "N"
-  [%u|b%"Parking"]=>
-  %unicode|string%(6) "Street"
-  [%u|b%"VClearance"]=>
-  %unicode|string%(2) "10"
+  ["WarehouseId"]=>
+  string(1) "1"
+  ["WarehouseName"]=>
+  string(16) "Southlake, Texas"
+  ["Building"]=>
+  string(5) "Owned"
+  ["Area"]=>
+  string(5) "25000"
+  ["Docks"]=>
+  string(1) "2"
+  ["DockType"]=>
+  string(9) "Rear load"
+  ["WaterAccess"]=>
+  string(4) "true"
+  ["RailAccess"]=>
+  string(1) "N"
+  ["Parking"]=>
+  string(6) "Street"
+  ["VClearance"]=>
+  string(2) "10"
 }
 object(SimpleXMLElement)#%d (10) {
-  [%u|b%"WarehouseId"]=>
-  %unicode|string%(1) "1"
-  [%u|b%"WarehouseName"]=>
-  %unicode|string%(16) "Southlake, Texas"
-  [%u|b%"Building"]=>
-  %unicode|string%(5) "Owned"
-  [%u|b%"Area"]=>
-  %unicode|string%(5) "25000"
-  [%u|b%"Docks"]=>
-  %unicode|string%(1) "1"
-  [%u|b%"DockType"]=>
-  %unicode|string%(9) "Rear load"
-  [%u|b%"WaterAccess"]=>
-  %unicode|string%(4) "true"
-  [%u|b%"RailAccess"]=>
-  %unicode|string%(1) "N"
-  [%u|b%"Parking"]=>
-  %unicode|string%(6) "Street"
-  [%u|b%"VClearance"]=>
-  %unicode|string%(2) "10"
+  ["WarehouseId"]=>
+  string(1) "1"
+  ["WarehouseName"]=>
+  string(16) "Southlake, Texas"
+  ["Building"]=>
+  string(5) "Owned"
+  ["Area"]=>
+  string(5) "25000"
+  ["Docks"]=>
+  string(1) "1"
+  ["DockType"]=>
+  string(9) "Rear load"
+  ["WaterAccess"]=>
+  string(4) "true"
+  ["RailAccess"]=>
+  string(1) "N"
+  ["Parking"]=>
+  string(6) "Street"
+  ["VClearance"]=>
+  string(2) "10"
 }
 Test 3: Update changes using a temporary CLOB
-%unicode|string%(331) "<?xml version="1.0"?>
+string(331) "<?xml version="1.0"?>
 <Warehouse>
 <WarehouseId>1</WarehouseId>
 <WarehouseName>Southlake, Texas</WarehouseName>