From a643bda32d068f0170143b032dc151cc481f8f36 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Fri, 10 Jun 2011 19:16:35 +0000 Subject: [PATCH] Add new OCI8 tests. Refactor skipifs. Sync 5.3/5.4/trunk branches --- ext/oci8/tests/array_bind_001.phpt | 2 +- ext/oci8/tests/array_bind_002.phpt | 2 +- ext/oci8/tests/array_bind_003.phpt | 5 +- ext/oci8/tests/array_bind_004.phpt | 5 +- ext/oci8/tests/array_bind_005.phpt | 5 +- ext/oci8/tests/array_bind_006.phpt | 5 +- ext/oci8/tests/array_bind_007.phpt | 2 +- ext/oci8/tests/array_bind_008.phpt | 11 +- ext/oci8/tests/array_bind_010.phpt | 2 +- ext/oci8/tests/array_bind_011.phpt | 2 +- ext/oci8/tests/array_bind_012.phpt | 2 +- ext/oci8/tests/array_bind_014.phpt | 5 +- ext/oci8/tests/array_bind_date.phpt | 5 +- ext/oci8/tests/array_bind_date1.phpt | 5 +- ext/oci8/tests/array_bind_float.phpt | 5 +- ext/oci8/tests/array_bind_float1.phpt | 5 +- ext/oci8/tests/array_bind_int.phpt | 5 +- ext/oci8/tests/array_bind_int1.phpt | 5 +- ext/oci8/tests/array_bind_str.phpt | 7 +- ext/oci8/tests/array_bind_str1.phpt | 7 +- ext/oci8/tests/b47243_1.phpt | 5 +- ext/oci8/tests/b47243_2.phpt | 5 +- ext/oci8/tests/b47243_3.phpt | 5 +- ext/oci8/tests/bind_char_1.phpt | 28 +- ext/oci8/tests/bind_char_1_11gR1.phpt | 12 +- ext/oci8/tests/bind_char_2.phpt | 28 +- ext/oci8/tests/bind_char_2_11gR1.phpt | 12 +- ext/oci8/tests/bind_char_3.phpt | 32 +- ext/oci8/tests/bind_char_3_11gR1.phpt | 14 +- ext/oci8/tests/bind_char_4.phpt | 30 +- ext/oci8/tests/bind_char_4_11gR1.phpt | 14 +- ext/oci8/tests/bind_long.phpt | 32 +- ext/oci8/tests/bind_long_raw.phpt | 5 +- ext/oci8/tests/bind_misccoltypes.phpt | 369 +++++++++ ext/oci8/tests/bind_misccoltypes_errs.phpt | 169 ++++ ext/oci8/tests/bind_number.phpt | 220 +++++ ext/oci8/tests/bind_query.phpt | 78 ++ ext/oci8/tests/bind_raw.phpt | 5 +- ext/oci8/tests/bind_rowid.phpt | 16 +- ext/oci8/tests/bind_sqltafc.phpt | 208 +++++ ext/oci8/tests/bind_sqltchr_1.phpt | 228 ++++++ ext/oci8/tests/bind_sqltchr_2.phpt | 50 ++ ext/oci8/tests/bind_sqltint.phpt | 227 ++++++ ext/oci8/tests/bind_sqltnum.phpt | 278 +++++++ ext/oci8/tests/bind_unsupported_1.phpt | 58 ++ ext/oci8/tests/bind_unsupported_2.phpt | 39 + ext/oci8/tests/bind_unsupported_3.phpt | 45 ++ ext/oci8/tests/bug26133.phpt | 25 +- ext/oci8/tests/bug27303_1.phpt | 46 +- ext/oci8/tests/bug27303_1_11gR1.phpt | 32 +- ext/oci8/tests/bug27303_2.phpt | 44 +- ext/oci8/tests/bug27303_2_11gR1.phpt | 28 +- ext/oci8/tests/bug27303_4.phpt | 16 +- ext/oci8/tests/bug32325.phpt | 23 +- ext/oci8/tests/bug35973.phpt | 5 +- ext/oci8/tests/bug36010.phpt | 5 +- ext/oci8/tests/bug36096.phpt | 4 +- ext/oci8/tests/bug36403.phpt | 34 +- ext/oci8/tests/bug37220.phpt | 15 +- ext/oci8/tests/bug37581.phpt | 5 +- ext/oci8/tests/bug38173.phpt | 5 +- ext/oci8/tests/bug40078.phpt | 5 +- ext/oci8/tests/bug40415.phpt | 5 +- ext/oci8/tests/bug41069.phpt | 20 +- ext/oci8/tests/bug42134.phpt | 5 +- ext/oci8/tests/bug42173.phpt | 5 +- ext/oci8/tests/bug42496_1.phpt | 18 +- ext/oci8/tests/bug42496_2.phpt | 18 +- ext/oci8/tests/bug42841.phpt | 157 ++-- ext/oci8/tests/bug43492.phpt | 17 +- ext/oci8/tests/bug43492_2.phpt | 17 +- ext/oci8/tests/bug43497.phpt | 12 +- ext/oci8/tests/bug43497_92.phpt | 14 +- ext/oci8/tests/bug44008.phpt | 19 +- ext/oci8/tests/bug44113.phpt | 16 +- ext/oci8/tests/bug44206.phpt | 5 +- ext/oci8/tests/bug45458.phpt | 14 +- ext/oci8/tests/bug46994.phpt | 15 +- ext/oci8/tests/bug47189.phpt | 11 +- ext/oci8/tests/bug47281.phpt | 28 +- ext/oci8/tests/bug47281_tt.phpt | 59 ++ ext/oci8/tests/bug51253.phpt | 5 +- ext/oci8/tests/bug51291_1.phpt | 394 +++++++++ ext/oci8/tests/bug51291_2.phpt | 56 ++ ext/oci8/tests/coll_001.phpt | 5 +- ext/oci8/tests/coll_002.phpt | 5 +- ext/oci8/tests/coll_002_func.phpt | 5 +- ext/oci8/tests/coll_003.phpt | 5 +- ext/oci8/tests/coll_003_func.phpt | 5 +- ext/oci8/tests/coll_004.phpt | 5 +- ext/oci8/tests/coll_004_func.phpt | 5 +- ext/oci8/tests/coll_005.phpt | 5 +- ext/oci8/tests/coll_006.phpt | 5 +- ext/oci8/tests/coll_006_func.phpt | 5 +- ext/oci8/tests/coll_007.phpt | 5 +- ext/oci8/tests/coll_008.phpt | 5 +- ext/oci8/tests/coll_009.phpt | 5 +- ext/oci8/tests/coll_009_func.phpt | 5 +- ext/oci8/tests/coll_010.phpt | 5 +- ext/oci8/tests/coll_010_func.phpt | 5 +- ext/oci8/tests/coll_011.phpt | 5 +- ext/oci8/tests/coll_011_func.phpt | 5 +- ext/oci8/tests/coll_012.phpt | 5 +- ext/oci8/tests/coll_012_func.phpt | 5 +- ext/oci8/tests/coll_013.phpt | 5 +- ext/oci8/tests/coll_013_func.phpt | 5 +- ext/oci8/tests/coll_014.phpt | 5 +- ext/oci8/tests/coll_014_func.phpt | 5 +- ext/oci8/tests/coll_015.phpt | 5 +- ext/oci8/tests/coll_015_func.phpt | 5 +- ext/oci8/tests/coll_016.phpt | 5 +- ext/oci8/tests/coll_016_func.phpt | 5 +- ext/oci8/tests/coll_017.phpt | 5 +- ext/oci8/tests/coll_017_func.phpt | 5 +- ext/oci8/tests/coll_018.phpt | 5 +- ext/oci8/tests/coll_019.phpt | 8 +- ext/oci8/tests/commit_001.phpt | 5 +- ext/oci8/tests/commit_002.phpt | 28 +- ext/oci8/tests/commit_old.phpt | 5 +- ext/oci8/tests/conn_attr_1.phpt | 21 +- ext/oci8/tests/conn_attr_2.phpt | 24 +- ext/oci8/tests/conn_attr_3.phpt | 23 +- ext/oci8/tests/conn_attr_4.phpt | 27 +- ext/oci8/tests/conn_attr_5.phpt | 23 +- ext/oci8/tests/connect.inc | 5 +- ext/oci8/tests/connect_scope1.phpt | 10 +- ext/oci8/tests/connect_scope2.phpt | 10 +- ext/oci8/tests/connect_scope_try1.phpt | 12 +- ext/oci8/tests/connect_scope_try2.phpt | 12 +- ext/oci8/tests/connect_scope_try3.phpt | 12 +- ext/oci8/tests/connect_scope_try4.phpt | 12 +- ext/oci8/tests/connect_scope_try5.phpt | 12 +- ext/oci8/tests/connect_scope_try6.phpt | 12 +- .../tests/connect_without_oracle_home_11.phpt | 5 +- .../connect_without_oracle_home_old.phpt | 5 +- .../connect_without_oracle_home_old_11.phpt | 5 +- ext/oci8/tests/create_table.inc | 20 +- ext/oci8/tests/cursor_bind.phpt | 70 +- ext/oci8/tests/cursor_bind_err.phpt | 28 +- ext/oci8/tests/cursors.phpt | 5 +- ext/oci8/tests/cursors_old.phpt | 28 +- ext/oci8/tests/dbmsoutput.phpt | 750 ++++++++++++++++++ ext/oci8/tests/default_prefetch.phpt | 24 +- ext/oci8/tests/default_prefetch0.phpt | 53 ++ ext/oci8/tests/default_prefetch1.phpt | 23 +- ext/oci8/tests/default_prefetch2.phpt | 23 +- ext/oci8/tests/define.phpt | 18 +- ext/oci8/tests/define0.phpt | 61 ++ ext/oci8/tests/define1.phpt | 18 +- ext/oci8/tests/define2.phpt | 19 +- ext/oci8/tests/define3.phpt | 17 +- ext/oci8/tests/define4.phpt | 18 +- ext/oci8/tests/define5.phpt | 18 +- ext/oci8/tests/define6.phpt | 138 ++++ ext/oci8/tests/define_old.phpt | 19 +- ext/oci8/tests/descriptors.phpt | 5 +- ext/oci8/tests/details.inc | 109 ++- ext/oci8/tests/drcp_connect1.phpt | 22 +- ext/oci8/tests/drcp_functions.inc | 2 +- ext/oci8/tests/drcp_privileged.phpt | 17 +- ext/oci8/tests/driver_name.phpt | 18 +- ext/oci8/tests/dupcolnames.phpt | 102 +++ ext/oci8/tests/edition_1.phpt | 28 +- ext/oci8/tests/edition_2.phpt | 17 +- ext/oci8/tests/error.phpt | 15 +- ext/oci8/tests/error1.phpt | 4 +- ext/oci8/tests/error2.phpt | 10 +- ext/oci8/tests/error_bind.phpt | 2 +- ext/oci8/tests/error_old.phpt | 13 +- ext/oci8/tests/error_parse.phpt | 16 +- ext/oci8/tests/exec_fetch.phpt | 4 +- ext/oci8/tests/fetch.phpt | 24 +- ext/oci8/tests/fetch_all.phpt | 18 +- ext/oci8/tests/fetch_all1.phpt | 94 +++ ext/oci8/tests/fetch_all2.phpt | 5 +- ext/oci8/tests/fetch_all3.phpt | 27 +- ext/oci8/tests/fetch_all4.phpt | 23 +- ext/oci8/tests/fetch_all5.phpt | 21 +- ext/oci8/tests/fetch_array.phpt | 70 +- ext/oci8/tests/fetch_assoc.phpt | 59 +- ext/oci8/tests/fetch_into.phpt | 25 +- ext/oci8/tests/fetch_into1.phpt | 5 +- ext/oci8/tests/fetch_into2.phpt | 5 +- ext/oci8/tests/fetch_object.phpt | 52 +- ext/oci8/tests/fetch_object_1.phpt | 123 +++ ext/oci8/tests/fetch_object_2.phpt | 82 +- ext/oci8/tests/fetch_row.phpt | 23 +- ext/oci8/tests/field_funcs.phpt | 5 +- ext/oci8/tests/field_funcs0.phpt | 108 +++ ext/oci8/tests/field_funcs1.phpt | 39 +- ext/oci8/tests/field_funcs3.phpt | 99 +++ ext/oci8/tests/field_funcs_old.phpt | 5 +- ext/oci8/tests/lob_001.phpt | Bin 1305 -> 2152 bytes ext/oci8/tests/lob_002.phpt | 43 +- ext/oci8/tests/lob_003.phpt | Bin 1628 -> 1698 bytes ext/oci8/tests/lob_004.phpt | 5 +- ext/oci8/tests/lob_005.phpt | 5 +- ext/oci8/tests/lob_006.phpt | Bin 1694 -> 1766 bytes ext/oci8/tests/lob_007.phpt | 5 +- ext/oci8/tests/lob_008.phpt | 5 +- ext/oci8/tests/lob_009.phpt | 5 +- ext/oci8/tests/lob_010.phpt | 5 +- ext/oci8/tests/lob_011.phpt | 5 +- ext/oci8/tests/lob_012.phpt | 5 +- ext/oci8/tests/lob_013.phpt | 5 +- ext/oci8/tests/lob_014.phpt | 5 +- ext/oci8/tests/lob_015.phpt | 7 +- ext/oci8/tests/lob_016.phpt | 5 +- ext/oci8/tests/lob_017.phpt | 5 +- ext/oci8/tests/lob_018.phpt | 70 +- ext/oci8/tests/lob_019.phpt | Bin 1548 -> 1618 bytes ext/oci8/tests/lob_020.phpt | Bin 3076 -> 3146 bytes ext/oci8/tests/lob_021.phpt | 5 +- ext/oci8/tests/lob_022.phpt | 5 +- ext/oci8/tests/lob_023.phpt | 5 +- ext/oci8/tests/lob_024.phpt | 5 +- ext/oci8/tests/lob_025.phpt | 5 +- ext/oci8/tests/lob_026.phpt | 5 +- ext/oci8/tests/lob_027.phpt | 5 +- ext/oci8/tests/lob_028.phpt | 5 +- ext/oci8/tests/lob_029.phpt | 15 +- ext/oci8/tests/lob_030.phpt | 5 +- ext/oci8/tests/lob_031.phpt | 5 +- ext/oci8/tests/lob_032.phpt | 5 +- ext/oci8/tests/lob_033.phpt | 5 +- ext/oci8/tests/lob_034.phpt | 5 +- ext/oci8/tests/lob_035.phpt | 5 +- ext/oci8/tests/lob_036.phpt | 5 +- ext/oci8/tests/lob_037.phpt | 5 +- ext/oci8/tests/lob_038.phpt | 5 +- ext/oci8/tests/lob_039.phpt | 5 +- ext/oci8/tests/lob_040.phpt | 5 +- ext/oci8/tests/lob_041.phpt | 17 +- ext/oci8/tests/lob_042.phpt | 5 +- ext/oci8/tests/lob_043.phpt | 26 +- ext/oci8/tests/lob_044.phpt | 73 ++ ext/oci8/tests/lob_aliases.phpt | 5 +- ext/oci8/tests/lob_null.phpt | 5 +- ext/oci8/tests/lob_temp.phpt | 5 +- ext/oci8/tests/lob_temp1.phpt | 5 +- ext/oci8/tests/null_byte_2.phpt | 27 +- ext/oci8/tests/null_byte_3.phpt | 42 + ext/oci8/tests/num.phpt | 23 +- ext/oci8/tests/oci_execute_segfault.phpt | 5 +- ext/oci8/tests/password.phpt | 41 +- ext/oci8/tests/password_2.phpt | 40 +- ext/oci8/tests/password_new.phpt | 17 +- ext/oci8/tests/password_old.phpt | 19 +- ext/oci8/tests/pecl_bug10194.phpt | 5 +- ext/oci8/tests/pecl_bug10194_blob.phpt | 20 +- ext/oci8/tests/pecl_bug10194_blob_64.phpt | 3 +- ext/oci8/tests/pecl_bug16035.phpt | 5 +- ext/oci8/tests/pecl_bug16842.phpt | 29 +- ext/oci8/tests/pecl_bug8816.phpt | 5 +- ext/oci8/tests/prefetch.phpt | 23 +- ext/oci8/tests/prefetch_old.phpt | 23 +- ext/oci8/tests/refcur_prefetch_1.phpt | 143 ++-- ext/oci8/tests/refcur_prefetch_2.phpt | 171 +--- ext/oci8/tests/refcur_prefetch_3.phpt | 40 +- ext/oci8/tests/refcur_prefetch_4.phpt | 176 ++++ ext/oci8/tests/select_null.phpt | 4 +- ext/oci8/tests/serverversion.phpt | 4 +- ext/oci8/tests/skipif.inc | 18 +- ext/oci8/tests/statement_cache.phpt | 11 +- ext/oci8/tests/xmltype_01.phpt | 26 +- ext/oci8/tests/xmltype_02.phpt | 113 ++- 266 files changed, 5940 insertions(+), 2107 deletions(-) create mode 100644 ext/oci8/tests/bind_misccoltypes.phpt create mode 100644 ext/oci8/tests/bind_misccoltypes_errs.phpt create mode 100644 ext/oci8/tests/bind_number.phpt create mode 100644 ext/oci8/tests/bind_query.phpt create mode 100644 ext/oci8/tests/bind_sqltafc.phpt create mode 100644 ext/oci8/tests/bind_sqltchr_1.phpt create mode 100644 ext/oci8/tests/bind_sqltchr_2.phpt create mode 100644 ext/oci8/tests/bind_sqltint.phpt create mode 100644 ext/oci8/tests/bind_sqltnum.phpt create mode 100644 ext/oci8/tests/bind_unsupported_1.phpt create mode 100644 ext/oci8/tests/bind_unsupported_2.phpt create mode 100644 ext/oci8/tests/bind_unsupported_3.phpt create mode 100644 ext/oci8/tests/bug47281_tt.phpt create mode 100644 ext/oci8/tests/bug51291_1.phpt create mode 100644 ext/oci8/tests/bug51291_2.phpt create mode 100644 ext/oci8/tests/dbmsoutput.phpt create mode 100644 ext/oci8/tests/default_prefetch0.phpt create mode 100644 ext/oci8/tests/define0.phpt create mode 100644 ext/oci8/tests/define6.phpt create mode 100644 ext/oci8/tests/dupcolnames.phpt create mode 100644 ext/oci8/tests/fetch_all1.phpt create mode 100644 ext/oci8/tests/fetch_object_1.phpt create mode 100644 ext/oci8/tests/field_funcs0.phpt create mode 100644 ext/oci8/tests/field_funcs3.phpt create mode 100644 ext/oci8/tests/lob_044.phpt create mode 100644 ext/oci8/tests/null_byte_3.phpt create mode 100644 ext/oci8/tests/refcur_prefetch_4.phpt diff --git a/ext/oci8/tests/array_bind_001.phpt b/ext/oci8/tests/array_bind_001.phpt index 1310325ad4..6a3746c2d5 100644 --- a/ext/oci8/tests/array_bind_001.phpt +++ b/ext/oci8/tests/array_bind_001.phpt @@ -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) "" diff --git a/ext/oci8/tests/array_bind_002.phpt b/ext/oci8/tests/array_bind_002.phpt index 4c76df42f9..82b57dc731 100644 --- a/ext/oci8/tests/array_bind_002.phpt +++ b/ext/oci8/tests/array_bind_002.phpt @@ -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" diff --git a/ext/oci8/tests/array_bind_003.phpt b/ext/oci8/tests/array_bind_003.phpt index 497e46e496..94bce02e31 100644 --- a/ext/oci8/tests/array_bind_003.phpt +++ b/ext/oci8/tests/array_bind_003.phpt @@ -1,7 +1,10 @@ --TEST-- oci_bind_array_by_name() and invalid values 3 --SKIPIF-- - + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- int(1) diff --git a/ext/oci8/tests/array_bind_008.phpt b/ext/oci8/tests/array_bind_008.phpt index c44304c11c..df2c35ccb2 100644 --- a/ext/oci8/tests/array_bind_008.phpt +++ b/ext/oci8/tests/array_bind_008.phpt @@ -1,7 +1,10 @@ --TEST-- oci_bind_array_by_name() and invalid values 8 --SKIPIF-- - + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- --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" diff --git a/ext/oci8/tests/array_bind_010.phpt b/ext/oci8/tests/array_bind_010.phpt index a77ed913ea..ede82c97fc 100644 --- a/ext/oci8/tests/array_bind_010.phpt +++ b/ext/oci8/tests/array_bind_010.phpt @@ -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); diff --git a/ext/oci8/tests/array_bind_011.phpt b/ext/oci8/tests/array_bind_011.phpt index e8e00a8091..9f43d1ac9c 100644 --- a/ext/oci8/tests/array_bind_011.phpt +++ b/ext/oci8/tests/array_bind_011.phpt @@ -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 diff --git a/ext/oci8/tests/array_bind_012.phpt b/ext/oci8/tests/array_bind_012.phpt index 2208f0b3b9..38e1701a4b 100644 --- a/ext/oci8/tests/array_bind_012.phpt +++ b/ext/oci8/tests/array_bind_012.phpt @@ -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(); diff --git a/ext/oci8/tests/array_bind_014.phpt b/ext/oci8/tests/array_bind_014.phpt index bd9fdf1335..9ab0236359 100644 --- a/ext/oci8/tests/array_bind_014.phpt +++ b/ext/oci8/tests/array_bind_014.phpt @@ -1,7 +1,10 @@ --TEST-- oci_bind_array_by_name() and NUMBERs --SKIPIF-- - + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- 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"; diff --git a/ext/oci8/tests/bind_char_1_11gR1.phpt b/ext/oci8/tests/bind_char_1_11gR1.phpt index 60b7142ff1..55973a61b6 100644 --- a/ext/oci8/tests/bind_char_1_11gR1.phpt +++ b/ext/oci8/tests/bind_char_1_11gR1.phpt @@ -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"; diff --git a/ext/oci8/tests/bind_char_2.phpt b/ext/oci8/tests/bind_char_2.phpt index fa2e547dbe..da34230dc7 100644 --- a/ext/oci8/tests/bind_char_2.phpt +++ b/ext/oci8/tests/bind_char_2.phpt @@ -4,18 +4,10 @@ SELECT oci_bind_by_name with SQLT_AFC aka CHAR and dates 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"; diff --git a/ext/oci8/tests/bind_char_2_11gR1.phpt b/ext/oci8/tests/bind_char_2_11gR1.phpt index 68a872fc46..357a716e6d 100644 --- a/ext/oci8/tests/bind_char_2_11gR1.phpt +++ b/ext/oci8/tests/bind_char_2_11gR1.phpt @@ -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"; diff --git a/ext/oci8/tests/bind_char_3.phpt b/ext/oci8/tests/bind_char_3.phpt index 052981acea..8ae5096273 100644 --- a/ext/oci8/tests/bind_char_3.phpt +++ b/ext/oci8/tests/bind_char_3.phpt @@ -4,18 +4,10 @@ PL/SQL oci_bind_by_name with SQLT_AFC aka CHAR to CHAR parameter 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"; diff --git a/ext/oci8/tests/bind_char_3_11gR1.phpt b/ext/oci8/tests/bind_char_3_11gR1.phpt index aaa5371195..1e7da47edc 100644 --- a/ext/oci8/tests/bind_char_3_11gR1.phpt +++ b/ext/oci8/tests/bind_char_3_11gR1.phpt @@ -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"; diff --git a/ext/oci8/tests/bind_char_4.phpt b/ext/oci8/tests/bind_char_4.phpt index fd38d902cc..30e4c3be60 100644 --- a/ext/oci8/tests/bind_char_4.phpt +++ b/ext/oci8/tests/bind_char_4.phpt @@ -4,18 +4,10 @@ PL/SQL oci_bind_by_name with SQLT_AFC aka CHAR to VARCHAR2 parameter 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"; diff --git a/ext/oci8/tests/bind_char_4_11gR1.phpt b/ext/oci8/tests/bind_char_4_11gR1.phpt index c4f7968e14..87b7daba88 100644 --- a/ext/oci8/tests/bind_char_4_11gR1.phpt +++ b/ext/oci8/tests/bind_char_4_11gR1.phpt @@ -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"; diff --git a/ext/oci8/tests/bind_long.phpt b/ext/oci8/tests/bind_long.phpt index ba6bd4d044..40c579992d 100644 --- a/ext/oci8/tests/bind_long.phpt +++ b/ext/oci8/tests/bind_long.phpt @@ -1,7 +1,10 @@ --TEST-- bind LONG field --SKIPIF-- - + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- --EXPECT-- +Test 1 string(32) "5c7c34abf7ea51936785062dbfcaeddc" int(394) +Test 2 - test multi chunk fetch +string(32) "ee2e98b977341cfb8e037066e5fcb909" +int(236400) Done diff --git a/ext/oci8/tests/bind_long_raw.phpt b/ext/oci8/tests/bind_long_raw.phpt index 2a9962eace..e48bbd33ee 100644 --- a/ext/oci8/tests/bind_long_raw.phpt +++ b/ext/oci8/tests/bind_long_raw.phpt @@ -1,7 +1,10 @@ --TEST-- bind LONG RAW field --SKIPIF-- - + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- 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-- + +===DONE=== + +--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 index 0000000000..20401fb8ea --- /dev/null +++ b/ext/oci8/tests/bind_misccoltypes_errs.phpt @@ -0,0 +1,169 @@ +--TEST-- +Bind miscellaneous column types and generating errors +--SKIPIF-- + +--FILE-- + +===DONE=== + +--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 index 0000000000..6412b5f82e --- /dev/null +++ b/ext/oci8/tests/bind_number.phpt @@ -0,0 +1,220 @@ +--TEST-- +Bind with NUMBER column variants +--SKIPIF-- + +--INI-- +precision = 14 +--FILE-- + +===DONE=== + +--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 index 0000000000..e4edc93299 --- /dev/null +++ b/ext/oci8/tests/bind_query.phpt @@ -0,0 +1,78 @@ +--TEST-- +Bind with various WHERE conditions +--SKIPIF-- + +--FILE-- + :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=== + +--EXPECTF-- +Test 1 +array(1) { + [0]=> + string(6) "MILLER" +} +Test 2 +string(4) "FORD" +string(6) "MILLER" +Test 3 +string(4) "FORD" +===DONE=== diff --git a/ext/oci8/tests/bind_raw.phpt b/ext/oci8/tests/bind_raw.phpt index c9087e552b..c2e8e08768 100644 --- a/ext/oci8/tests/bind_raw.phpt +++ b/ext/oci8/tests/bind_raw.phpt @@ -1,7 +1,10 @@ --TEST-- bind RAW field --SKIPIF-- - + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- +--FILE-- + +===DONE=== + +--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 index 0000000000..aabf9bda5c --- /dev/null +++ b/ext/oci8/tests/bind_sqltchr_1.phpt @@ -0,0 +1,228 @@ +--TEST-- +Bind with SQLT_CHR +--SKIPIF-- + +--FILE-- + +===DONE=== + +--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 index 0000000000..47d08d2bc3 --- /dev/null +++ b/ext/oci8/tests/bind_sqltchr_2.phpt @@ -0,0 +1,50 @@ +--TEST-- +PL/SQL bind with SQLT_CHR +--SKIPIF-- + +--FILE-- + +===DONE=== + +--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 index 0000000000..f01791d3b1 --- /dev/null +++ b/ext/oci8/tests/bind_sqltint.phpt @@ -0,0 +1,227 @@ +--TEST-- +Bind with SQLT_INT +--SKIPIF-- + +--FILE-- + +===DONE=== + +--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 index 0000000000..d3828b73ee --- /dev/null +++ b/ext/oci8/tests/bind_sqltnum.phpt @@ -0,0 +1,278 @@ +--TEST-- +Bind with SQLT_NUM +--SKIPIF-- + +--FILE-- + +===DONE=== + +--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 index 0000000000..544b446788 --- /dev/null +++ b/ext/oci8/tests/bind_unsupported_1.phpt @@ -0,0 +1,58 @@ +--TEST-- +Bind with various unsupported bind types +--SKIPIF-- + +--FILE-- + 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=== + +--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 index 0000000000..d3e5375df6 --- /dev/null +++ b/ext/oci8/tests/bind_unsupported_2.phpt @@ -0,0 +1,39 @@ +--TEST-- +Bind with various unsupported 10g+ bind types +--SKIPIF-- + +--FILE-- + 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=== + +--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 index 0000000000..5c9dec3729 --- /dev/null +++ b/ext/oci8/tests/bind_unsupported_3.phpt @@ -0,0 +1,45 @@ +--TEST-- +Bind with various bind types not supported by TimesTen +--SKIPIF-- + false, 'timesten' => true); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> +--FILE-- + 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=== + +--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=== diff --git a/ext/oci8/tests/bug26133.phpt b/ext/oci8/tests/bug26133.phpt index 2463e70c76..59f8a17f38 100644 --- a/ext/oci8/tests/bug26133.phpt +++ b/ext/oci8/tests/bug26133.phpt @@ -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"; ?> diff --git a/ext/oci8/tests/bug27303_1.phpt b/ext/oci8/tests/bug27303_1.phpt index 6d491966a7..c4550244aa 100644 --- a/ext/oci8/tests/bug27303_1.phpt +++ b/ext/oci8/tests/bug27303_1.phpt @@ -4,35 +4,25 @@ Bug #27303 (OCIBindByName binds numeric PHP values as characters) 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-- diff --git a/ext/oci8/tests/bug27303_1_11gR1.phpt b/ext/oci8/tests/bug27303_1_11gR1.phpt index fe5c17c3ee..20097613f4 100644 --- a/ext/oci8/tests/bug27303_1_11gR1.phpt +++ b/ext/oci8/tests/bug27303_1_11gR1.phpt @@ -13,18 +13,16 @@ if ($sv !== 1) { --FILE-- diff --git a/ext/oci8/tests/bug27303_2.phpt b/ext/oci8/tests/bug27303_2.phpt index 3d0c087703..d7df23ba24 100644 --- a/ext/oci8/tests/bug27303_2.phpt +++ b/ext/oci8/tests/bug27303_2.phpt @@ -4,18 +4,10 @@ Bug #27303 (OCIBindByName binds numeric PHP values as characters) 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"; ?> diff --git a/ext/oci8/tests/bug27303_2_11gR1.phpt b/ext/oci8/tests/bug27303_2_11gR1.phpt index e1daef0537..c2b5c433c4 100644 --- a/ext/oci8/tests/bug27303_2_11gR1.phpt +++ b/ext/oci8/tests/bug27303_2_11gR1.phpt @@ -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"; ?> diff --git a/ext/oci8/tests/bug27303_4.phpt b/ext/oci8/tests/bug27303_4.phpt index 20dec54dac..86b1a8ba5e 100644 --- a/ext/oci8/tests/bug27303_4.phpt +++ b/ext/oci8/tests/bug27303_4.phpt @@ -4,18 +4,10 @@ Bug #27303 (OCIBindByName binds numeric PHP values as characters) 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-- diff --git a/ext/oci8/tests/bug32325.phpt b/ext/oci8/tests/bug32325.phpt index 257c6977b8..854e5c1590 100644 --- a/ext/oci8/tests/bug32325.phpt +++ b/ext/oci8/tests/bug32325.phpt @@ -1,7 +1,10 @@ --TEST-- Bug #32325 (Cannot retrieve collection using OCI8) --SKIPIF-- - + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- diff --git a/ext/oci8/tests/bug35973.phpt b/ext/oci8/tests/bug35973.phpt index 81e1e58ba2..3f4299ea29 100644 --- a/ext/oci8/tests/bug35973.phpt +++ b/ext/oci8/tests/bug35973.phpt @@ -1,7 +1,10 @@ --TEST-- Bug #35973 (Error ORA-24806 occurs when trying to fetch a NCLOB field) --SKIPIF-- - + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- ---EXPECT-- +--EXPECTF-- bool(false) bool(false) -string(5) "'ABC'" +string(%r[53]%r) "%r('ABC'|EXP)%r" string(4) "CHAR" Done diff --git a/ext/oci8/tests/bug36403.phpt b/ext/oci8/tests/bug36403.phpt index 68c5f7b0a1..53dae694ec 100644 --- a/ext/oci8/tests/bug36403.phpt +++ b/ext/oci8/tests/bug36403.phpt @@ -1,7 +1,12 @@ --TEST-- Bug #36403 (oci_execute no longer supports OCI_DESCRIBE_ONLY) --SKIPIF-- - + --FILE-- ===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=== diff --git a/ext/oci8/tests/bug37220.phpt b/ext/oci8/tests/bug37220.phpt index 6743165b70..8d59644b8e 100644 --- a/ext/oci8/tests/bug37220.phpt +++ b/ext/oci8/tests/bug37220.phpt @@ -1,7 +1,10 @@ --TEST-- Bug #37220 (LOB Type mismatch when using windows & oci8.dll) --SKIPIF-- - + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- '))" ); -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"; diff --git a/ext/oci8/tests/bug37581.phpt b/ext/oci8/tests/bug37581.phpt index ec86c51959..1c00f68d31 100644 --- a/ext/oci8/tests/bug37581.phpt +++ b/ext/oci8/tests/bug37581.phpt @@ -1,7 +1,10 @@ --TEST-- Bug #37581 (oci_bind_array_by_name clobbers input array when using SQLT_AFC, AVC) --SKIPIF-- - + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- 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"; diff --git a/ext/oci8/tests/bug42134.phpt b/ext/oci8/tests/bug42134.phpt index 2b0e3707d6..10b7ef160d 100644 --- a/ext/oci8/tests/bug42134.phpt +++ b/ext/oci8/tests/bug42134.phpt @@ -1,7 +1,10 @@ --TEST-- Bug #42134 (Collection error for invalid collection name) --SKIPIF-- - + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + 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-- --EXPECTF-- diff --git a/ext/oci8/tests/bug42496_2.phpt b/ext/oci8/tests/bug42496_2.phpt index e2800bbd8a..8c4b791415 100644 --- a/ext/oci8/tests/bug42496_2.phpt +++ b/ext/oci8/tests/bug42496_2.phpt @@ -1,7 +1,11 @@ --TEST-- Bug #42496 (LOB fetch leaks cursors, eventually failing with ORA-1000 maximum open cursors reached) --SKIPIF-- - + 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-- --EXPECTF-- diff --git a/ext/oci8/tests/bug42841.phpt b/ext/oci8/tests/bug42841.phpt index 921c8149dd..a86d1ca847 100644 --- a/ext/oci8/tests/bug42841.phpt +++ b/ext/oci8/tests/bug42841.phpt @@ -1,7 +1,10 @@ --TEST-- Bug #42841 (REF CURSOR and oci_new_cursor PHP crash) --SKIPIF-- - + 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"; diff --git a/ext/oci8/tests/bug43492.phpt b/ext/oci8/tests/bug43492.phpt index d28aabfced..e84fa42556 100644 --- a/ext/oci8/tests/bug43492.phpt +++ b/ext/oci8/tests/bug43492.phpt @@ -1,7 +1,10 @@ --TEST-- Bug #43492 (Nested cursor leaks) --SKIPIF-- - + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- --EXPECT-- diff --git a/ext/oci8/tests/bug43492_2.phpt b/ext/oci8/tests/bug43492_2.phpt index fcf96e984e..61511cf6d2 100644 --- a/ext/oci8/tests/bug43492_2.phpt +++ b/ext/oci8/tests/bug43492_2.phpt @@ -1,7 +1,10 @@ --TEST-- Bug #43492 (Nested cursor leaks after related bug #44206 fixed) --SKIPIF-- - + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- --EXPECT-- diff --git a/ext/oci8/tests/bug43497.phpt b/ext/oci8/tests/bug43497.phpt index 1ea46b40d7..600fb047bf 100644 --- a/ext/oci8/tests/bug43497.phpt +++ b/ext/oci8/tests/bug43497.phpt @@ -2,13 +2,11 @@ Bug #43497 (OCI8 XML/getClobVal aka temporary LOBs leak UGA memory) --SKIPIF-- 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-- diff --git a/ext/oci8/tests/bug43497_92.phpt b/ext/oci8/tests/bug43497_92.phpt index e2cb1ce486..932a863d7a 100644 --- a/ext/oci8/tests/bug43497_92.phpt +++ b/ext/oci8/tests/bug43497_92.phpt @@ -1,14 +1,12 @@ --TEST-- Bug #43497 (OCI8 XML/getClobVal aka temporary LOBs leak UGA memory) --SKIPIF-- - 9.2/', $phpinfo); -if ($ov !== 1) { - die ("skip expected output only valid for Oracle 9.2 clients"); + 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-- diff --git a/ext/oci8/tests/bug44008.phpt b/ext/oci8/tests/bug44008.phpt index fd10b26b8b..faacdc6254 100644 --- a/ext/oci8/tests/bug44008.phpt +++ b/ext/oci8/tests/bug44008.phpt @@ -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-- - + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- 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"; diff --git a/ext/oci8/tests/bug44206.phpt b/ext/oci8/tests/bug44206.phpt index e5771e4182..63805bf6e3 100644 --- a/ext/oci8/tests/bug44206.phpt +++ b/ext/oci8/tests/bug44206.phpt @@ -1,7 +1,10 @@ --TEST-- Bug #44206 (Test if selecting ref cursors leads to ORA-1000 maximum open cursors reached) --SKIPIF-- - + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- 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" diff --git a/ext/oci8/tests/bug46994.phpt b/ext/oci8/tests/bug46994.phpt index 0504952f69..604b57f262 100644 --- a/ext/oci8/tests/bug46994.phpt +++ b/ext/oci8/tests/bug46994.phpt @@ -1,7 +1,10 @@ --TEST-- Bug #46994 (CLOB size does not update when using CLOB IN OUT param in stored procedure) --SKIPIF-- - + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs: different error handling for this undefined behavior +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- --EXPECTF-- +Test 1 array(1) { [0]=> array(1) { @@ -34,6 +42,7 @@ array(1) { } array(0) { } +Test 2 array(1) { [0]=> array(1) { diff --git a/ext/oci8/tests/bug47281.phpt b/ext/oci8/tests/bug47281.phpt index 710246738e..6b94bdef21 100644 --- a/ext/oci8/tests/bug47281.phpt +++ b/ext/oci8/tests/bug47281.phpt @@ -1,7 +1,10 @@ --TEST-- Bug #47281 ($php_errormsg is limited in size of characters) --SKIPIF-- - + 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 index 0000000000..4b4e92ede6 --- /dev/null +++ b/ext/oci8/tests/bug47281_tt.phpt @@ -0,0 +1,59 @@ +--TEST-- +Bug #47281 ($php_errormsg is limited in size of characters) +--SKIPIF-- + false, 'timesten' => true); // test runs on these DBs: shorter message length in TimesTen +require(dirname(__FILE__).'/skipif.inc'); +?> +--ENV-- +NLS_LANG=.AL32UTF8 +--FILE-- + +===DONE=== + +--EXPECTF-- +Test 1 +ORA-57000: TT8507: ORA-20000: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +Test 2 +oci_execute(): ORA-57000: TT8507: ORA-20000: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +===DONE=== diff --git a/ext/oci8/tests/bug51253.phpt b/ext/oci8/tests/bug51253.phpt index fea3333ccf..a97272f65f 100644 --- a/ext/oci8/tests/bug51253.phpt +++ b/ext/oci8/tests/bug51253.phpt @@ -1,7 +1,10 @@ --TEST-- Bug #51253 (oci_bind_array_by_name() array references) --SKIPIF-- - + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- +--FILE-- + +===DONE=== + +--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 index 0000000000..d5dbf6f82b --- /dev/null +++ b/ext/oci8/tests/bug51291_2.phpt @@ -0,0 +1,56 @@ +--TEST-- +Bug #51291 (oci_error() doesn't report last error when called two times) +--SKIPIF-- + true, 'timesten' => false); // test runs on these DBs: different error messages from TimesTen +require(dirname(__FILE__).'/skipif.inc'); +?> +--FILE-- + +===DONE=== + +--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=== diff --git a/ext/oci8/tests/coll_001.phpt b/ext/oci8/tests/coll_001.phpt index 57d3cf1b47..625d71a295 100644 --- a/ext/oci8/tests/coll_001.phpt +++ b/ext/oci8/tests/coll_001.phpt @@ -1,7 +1,10 @@ --TEST-- oci_new_collection() --SKIPIF-- - + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + 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-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- 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=== diff --git a/ext/oci8/tests/commit_old.phpt b/ext/oci8/tests/commit_old.phpt index 196e0650cc..012fc02372 100644 --- a/ext/oci8/tests/commit_old.phpt +++ b/ext/oci8/tests/commit_old.phpt @@ -1,7 +1,10 @@ --TEST-- ocicommit()/ocirollback() --SKIPIF-- - + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- 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"); } ?> diff --git a/ext/oci8/tests/conn_attr_2.phpt b/ext/oci8/tests/conn_attr_2.phpt index 4765d5eb7b..1072503529 100644 --- a/ext/oci8/tests/conn_attr_2.phpt +++ b/ext/oci8/tests/conn_attr_2.phpt @@ -1,25 +1,19 @@ --TEST-- Set and get of connection attributes across persistent connections and sysdba connection. --SKIPIF-- - 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 diff --git a/ext/oci8/tests/conn_attr_3.phpt b/ext/oci8/tests/conn_attr_3.phpt index 8b6d921230..be8d3306de 100644 --- a/ext/oci8/tests/conn_attr_3.phpt +++ b/ext/oci8/tests/conn_attr_3.phpt @@ -1,24 +1,17 @@ --TEST-- Set and get of connection attributes with oci_close(). --SKIPIF-- - 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-- diff --git a/ext/oci8/tests/conn_attr_4.phpt b/ext/oci8/tests/conn_attr_4.phpt index 9f55f53263..b1a22858a8 100644 --- a/ext/oci8/tests/conn_attr_4.phpt +++ b/ext/oci8/tests/conn_attr_4.phpt @@ -1,29 +1,25 @@ --TEST-- Set and get of connection attributes with errors. --SKIPIF-- - 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-- 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 !!!!!'); diff --git a/ext/oci8/tests/conn_attr_5.phpt b/ext/oci8/tests/conn_attr_5.phpt index 9f6b6c7247..d694ec06a5 100644 --- a/ext/oci8/tests/conn_attr_5.phpt +++ b/ext/oci8/tests/conn_attr_5.phpt @@ -1,24 +1,17 @@ --TEST-- Set and get connection attributes with scope end. --SKIPIF-- - 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-- diff --git a/ext/oci8/tests/connect.inc b/ext/oci8/tests/connect.inc index 5e340cf6fa..06d1348568 100644 --- a/ext/oci8/tests/connect.inc +++ b/ext/oci8/tests/connect.inc @@ -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); } ?> diff --git a/ext/oci8/tests/connect_scope1.phpt b/ext/oci8/tests/connect_scope1.phpt index d6d16f17ee..d265d1da9f 100644 --- a/ext/oci8/tests/connect_scope1.phpt +++ b/ext/oci8/tests/connect_scope1.phpt @@ -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"; diff --git a/ext/oci8/tests/connect_scope2.phpt b/ext/oci8/tests/connect_scope2.phpt index 7017493f5a..7d05c11411 100644 --- a/ext/oci8/tests/connect_scope2.phpt +++ b/ext/oci8/tests/connect_scope2.phpt @@ -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"; diff --git a/ext/oci8/tests/connect_scope_try1.phpt b/ext/oci8/tests/connect_scope_try1.phpt index a881ea6ead..7f26d4334d 100644 --- a/ext/oci8/tests/connect_scope_try1.phpt +++ b/ext/oci8/tests/connect_scope_try1.phpt @@ -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"]=> diff --git a/ext/oci8/tests/connect_scope_try2.phpt b/ext/oci8/tests/connect_scope_try2.phpt index 9e6b5ce2e0..94adb85e93 100644 --- a/ext/oci8/tests/connect_scope_try2.phpt +++ b/ext/oci8/tests/connect_scope_try2.phpt @@ -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"]=> diff --git a/ext/oci8/tests/connect_scope_try3.phpt b/ext/oci8/tests/connect_scope_try3.phpt index 1cd44b0218..e7891a1073 100644 --- a/ext/oci8/tests/connect_scope_try3.phpt +++ b/ext/oci8/tests/connect_scope_try3.phpt @@ -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"]=> diff --git a/ext/oci8/tests/connect_scope_try4.phpt b/ext/oci8/tests/connect_scope_try4.phpt index 9b4cd1f278..40369c67ba 100644 --- a/ext/oci8/tests/connect_scope_try4.phpt +++ b/ext/oci8/tests/connect_scope_try4.phpt @@ -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"]=> diff --git a/ext/oci8/tests/connect_scope_try5.phpt b/ext/oci8/tests/connect_scope_try5.phpt index 121fb33dc5..3afc87b915 100644 --- a/ext/oci8/tests/connect_scope_try5.phpt +++ b/ext/oci8/tests/connect_scope_try5.phpt @@ -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"]=> diff --git a/ext/oci8/tests/connect_scope_try6.phpt b/ext/oci8/tests/connect_scope_try6.phpt index 3347543ab8..d7b4edfdbe 100644 --- a/ext/oci8/tests/connect_scope_try6.phpt +++ b/ext/oci8/tests/connect_scope_try6.phpt @@ -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"]=> diff --git a/ext/oci8/tests/connect_without_oracle_home_11.phpt b/ext/oci8/tests/connect_without_oracle_home_11.phpt index be99a8bd6e..1620803dbb 100644 --- a/ext/oci8/tests/connect_without_oracle_home_11.phpt +++ b/ext/oci8/tests/connect_without_oracle_home_11.phpt @@ -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-- diff --git a/ext/oci8/tests/connect_without_oracle_home_old.phpt b/ext/oci8/tests/connect_without_oracle_home_old.phpt index 602d55ff8f..5a731337af 100644 --- a/ext/oci8/tests/connect_without_oracle_home_old.phpt +++ b/ext/oci8/tests/connect_without_oracle_home_old.phpt @@ -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-- diff --git a/ext/oci8/tests/connect_without_oracle_home_old_11.phpt b/ext/oci8/tests/connect_without_oracle_home_old_11.phpt index 9bb42e75a4..c7cfecf396 100644 --- a/ext/oci8/tests/connect_without_oracle_home_old_11.phpt +++ b/ext/oci8/tests/connect_without_oracle_home_old_11.phpt @@ -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-- diff --git a/ext/oci8/tests/create_table.inc b/ext/oci8/tests/create_table.inc index afd1fceb9b..7335980682 100644 --- a/ext/oci8/tests/create_table.inc +++ b/ext/oci8/tests/create_table.inc @@ -1,11 +1,13 @@ diff --git a/ext/oci8/tests/cursor_bind.phpt b/ext/oci8/tests/cursor_bind.phpt index c2ce15cb38..740402e7e0 100644 --- a/ext/oci8/tests/cursor_bind.phpt +++ b/ext/oci8/tests/cursor_bind.phpt @@ -1,54 +1,34 @@ --TEST-- bind and fetch cursor from a statement --SKIPIF-- - + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- ---EXPECT-- +===DONE=== + +--EXPECT-- array(2) { [0]=> string(1) "1" @@ -96,4 +76,4 @@ array(2) { string(1) "1" } bool(false) -Done +===DONE=== diff --git a/ext/oci8/tests/cursor_bind_err.phpt b/ext/oci8/tests/cursor_bind_err.phpt index 33bd04b6d2..197aad1d19 100644 --- a/ext/oci8/tests/cursor_bind_err.phpt +++ b/ext/oci8/tests/cursor_bind_err.phpt @@ -1,7 +1,10 @@ --TEST-- binding a cursor (with errors) --SKIPIF-- - + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> +--FILE-- += $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=== + +--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=== diff --git a/ext/oci8/tests/default_prefetch.phpt b/ext/oci8/tests/default_prefetch.phpt index 47191c8585..cc70c6ecb3 100644 --- a/ext/oci8/tests/default_prefetch.phpt +++ b/ext/oci8/tests/default_prefetch.phpt @@ -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 index 0000000000..cc70c6ecb3 --- /dev/null +++ b/ext/oci8/tests/default_prefetch0.phpt @@ -0,0 +1,53 @@ +--TEST-- +oci8.default_prefetch ini option +--SKIPIF-- + +--INI-- +oci8.default_prefetch=20 +--FILE-- + +--EXPECT-- +bool(true) +int(1) +Done diff --git a/ext/oci8/tests/default_prefetch1.phpt b/ext/oci8/tests/default_prefetch1.phpt index bcd66fa381..bc78829365 100644 --- a/ext/oci8/tests/default_prefetch1.phpt +++ b/ext/oci8/tests/default_prefetch1.phpt @@ -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"; ?> diff --git a/ext/oci8/tests/default_prefetch2.phpt b/ext/oci8/tests/default_prefetch2.phpt index 7b3f29f296..d8a76dbb07 100644 --- a/ext/oci8/tests/default_prefetch2.phpt +++ b/ext/oci8/tests/default_prefetch2.phpt @@ -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"; ?> diff --git a/ext/oci8/tests/define.phpt b/ext/oci8/tests/define.phpt index d99bc7e1a6..c6ce7bd9b3 100644 --- a/ext/oci8/tests/define.phpt +++ b/ext/oci8/tests/define.phpt @@ -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 index 0000000000..f2f06e3152 --- /dev/null +++ b/ext/oci8/tests/define0.phpt @@ -0,0 +1,61 @@ +--TEST-- +oci_define_by_name() +--SKIPIF-- + +--FILE-- + +===DONE=== + +--EXPECTF-- +Test 1 +string(%d) "some" +Test 2 +string(%d) "some" +===DONE=== diff --git a/ext/oci8/tests/define1.phpt b/ext/oci8/tests/define1.phpt index 341bc9ed83..6e4b74e3ba 100644 --- a/ext/oci8/tests/define1.phpt +++ b/ext/oci8/tests/define1.phpt @@ -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"; diff --git a/ext/oci8/tests/define2.phpt b/ext/oci8/tests/define2.phpt index 46e11bf886..c53bebd2e1 100644 --- a/ext/oci8/tests/define2.phpt +++ b/ext/oci8/tests/define2.phpt @@ -1,7 +1,10 @@ --TEST-- Test oci_define_by_name types --SKIPIF-- - + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- diff --git a/ext/oci8/tests/define3.phpt b/ext/oci8/tests/define3.phpt index 892e8e3809..77714a92f0 100644 --- a/ext/oci8/tests/define3.phpt +++ b/ext/oci8/tests/define3.phpt @@ -1,7 +1,10 @@ --TEST-- Test oci_define_by_name() LOB descriptor --SKIPIF-- - + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- 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"; diff --git a/ext/oci8/tests/define4.phpt b/ext/oci8/tests/define4.phpt index 8d83f73ac3..266fd7edd7 100644 --- a/ext/oci8/tests/define4.phpt +++ b/ext/oci8/tests/define4.phpt @@ -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"; diff --git a/ext/oci8/tests/define5.phpt b/ext/oci8/tests/define5.phpt index 63541ce9dd..68fa01d09a 100644 --- a/ext/oci8/tests/define5.phpt +++ b/ext/oci8/tests/define5.phpt @@ -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 index 0000000000..50e23ecf45 --- /dev/null +++ b/ext/oci8/tests/define6.phpt @@ -0,0 +1,138 @@ +--TEST-- +oci_define_by_name tests with REF CURSORs +--SKIPIF-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> +--FILE-- + +===DONE=== + +--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=== diff --git a/ext/oci8/tests/define_old.phpt b/ext/oci8/tests/define_old.phpt index 618f9d5f57..f65e6b8080 100644 --- a/ext/oci8/tests/define_old.phpt +++ b/ext/oci8/tests/define_old.phpt @@ -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"; diff --git a/ext/oci8/tests/descriptors.phpt b/ext/oci8/tests/descriptors.phpt index 8be4f3a06d..9193fdddeb 100644 --- a/ext/oci8/tests/descriptors.phpt +++ b/ext/oci8/tests/descriptors.phpt @@ -1,7 +1,10 @@ --TEST-- commit connection after destroying the descriptor --SKIPIF-- - + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- diff --git a/ext/oci8/tests/drcp_connect1.phpt b/ext/oci8/tests/drcp_connect1.phpt index bf619a4efd..25395dc187 100644 --- a/ext/oci8/tests/drcp_connect1.phpt +++ b/ext/oci8/tests/drcp_connect1.phpt @@ -1,7 +1,10 @@ --TEST-- DRCP: oci_connect() --SKIPIF-- - + 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 diff --git a/ext/oci8/tests/drcp_functions.inc b/ext/oci8/tests/drcp_functions.inc index 26adb21f35..f6b24446c9 100644 --- a/ext/oci8/tests/drcp_functions.inc +++ b/ext/oci8/tests/drcp_functions.inc @@ -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); } diff --git a/ext/oci8/tests/drcp_privileged.phpt b/ext/oci8/tests/drcp_privileged.phpt index 9af20625ed..45b5ee4bdb 100644 --- a/ext/oci8/tests/drcp_privileged.phpt +++ b/ext/oci8/tests/drcp_privileged.phpt @@ -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 diff --git a/ext/oci8/tests/driver_name.phpt b/ext/oci8/tests/driver_name.phpt index 187d7e1862..bf86e66e7b 100644 --- a/ext/oci8/tests/driver_name.phpt +++ b/ext/oci8/tests/driver_name.phpt @@ -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 index 0000000000..bf07497178 --- /dev/null +++ b/ext/oci8/tests/dupcolnames.phpt @@ -0,0 +1,102 @@ +--TEST-- +SELECT tests with duplicate column anmes +--SKIPIF-- + +--FILE-- + +===DONE=== + +--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=== diff --git a/ext/oci8/tests/edition_1.phpt b/ext/oci8/tests/edition_1.phpt index 9a4b0f3b61..b9c8fd817e 100644 --- a/ext/oci8/tests/edition_1.phpt +++ b/ext/oci8/tests/edition_1.phpt @@ -4,26 +4,17 @@ Basic test for setting Oracle 11gR2 "edition" attribute (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-- (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"); } ?> diff --git a/ext/oci8/tests/error.phpt b/ext/oci8/tests/error.phpt index 743820f901..7fedd0ddad 100644 --- a/ext/oci8/tests/error.phpt +++ b/ext/oci8/tests/error.phpt @@ -1,17 +1,20 @@ --TEST-- -oci_error() +oci_error() error message for parsing error --SKIPIF-- - + true, 'timesten' => false); // test runs on these DBs: different error messages from TimesTen +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- int(900) ["message"]=> - string(32) "ORA-00900: invalid SQL statement" + string(%d) "ORA-00900: %s" ["offset"]=> int(0) ["sqltext"]=> diff --git a/ext/oci8/tests/error1.phpt b/ext/oci8/tests/error1.phpt index 25a3f09e92..c6fba2e83b 100644 --- a/ext/oci8/tests/error1.phpt +++ b/ext/oci8/tests/error1.phpt @@ -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"]=> diff --git a/ext/oci8/tests/error2.phpt b/ext/oci8/tests/error2.phpt index 13ea6cebe2..12eab61a6a 100644 --- a/ext/oci8/tests/error2.phpt +++ b/ext/oci8/tests/error2.phpt @@ -1,11 +1,15 @@ --TEST-- Exercise error code for SUCCESS_WITH_INFO --SKIPIF-- - + 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-- --EXPECTF-- -ORA-24344: success with compilation error +ORA-24344: %s Done diff --git a/ext/oci8/tests/error_bind.phpt b/ext/oci8/tests/error_bind.phpt index ad66ad59fe..6ee26ee825 100644 --- a/ext/oci8/tests/error_bind.phpt +++ b/ext/oci8/tests/error_bind.phpt @@ -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 diff --git a/ext/oci8/tests/error_old.phpt b/ext/oci8/tests/error_old.phpt index a6889c897a..c6f9cd300d 100644 --- a/ext/oci8/tests/error_old.phpt +++ b/ext/oci8/tests/error_old.phpt @@ -1,17 +1,20 @@ --TEST-- ocierror() --SKIPIF-- - + true, 'timesten' => false); // test runs on these DBs: different error messages from TimesTen +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- int(900) ["message"]=> - string(32) "ORA-00900: invalid SQL statement" + string(%d) "ORA-00900: %s" ["offset"]=> int(0) ["sqltext"]=> diff --git a/ext/oci8/tests/error_parse.phpt b/ext/oci8/tests/error_parse.phpt index 8100e31706..458df8715a 100644 --- a/ext/oci8/tests/error_parse.phpt +++ b/ext/oci8/tests/error_parse.phpt @@ -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 diff --git a/ext/oci8/tests/exec_fetch.phpt b/ext/oci8/tests/exec_fetch.phpt index 83aae69f7d..52d515ffc4 100644 --- a/ext/oci8/tests/exec_fetch.phpt +++ b/ext/oci8/tests/exec_fetch.phpt @@ -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 diff --git a/ext/oci8/tests/fetch.phpt b/ext/oci8/tests/fetch.phpt index 5206324940..e48aeefd87 100644 --- a/ext/oci8/tests/fetch.phpt +++ b/ext/oci8/tests/fetch.phpt @@ -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"; ?> diff --git a/ext/oci8/tests/fetch_all.phpt b/ext/oci8/tests/fetch_all.phpt index a007bac830..4fc41daad4 100644 --- a/ext/oci8/tests/fetch_all.phpt +++ b/ext/oci8/tests/fetch_all.phpt @@ -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 index 0000000000..4fc41daad4 --- /dev/null +++ b/ext/oci8/tests/fetch_all1.phpt @@ -0,0 +1,94 @@ +--TEST-- +oci_fetch_all() +--SKIPIF-- + +--FILE-- + +--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 diff --git a/ext/oci8/tests/fetch_all2.phpt b/ext/oci8/tests/fetch_all2.phpt index ff44cac70d..483e51573d 100644 --- a/ext/oci8/tests/fetch_all2.phpt +++ b/ext/oci8/tests/fetch_all2.phpt @@ -1,7 +1,10 @@ --TEST-- oci_fetch_all() - 2 --SKIPIF-- - + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- diff --git a/ext/oci8/tests/fetch_all4.phpt b/ext/oci8/tests/fetch_all4.phpt index 9b82262e3f..1d3c9677ee 100644 --- a/ext/oci8/tests/fetch_all4.phpt +++ b/ext/oci8/tests/fetch_all4.phpt @@ -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=== diff --git a/ext/oci8/tests/fetch_all5.phpt b/ext/oci8/tests/fetch_all5.phpt index bb9061a445..a6bb3c3f18 100644 --- a/ext/oci8/tests/fetch_all5.phpt +++ b/ext/oci8/tests/fetch_all5.phpt @@ -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); diff --git a/ext/oci8/tests/fetch_array.phpt b/ext/oci8/tests/fetch_array.phpt index e2f32483d5..db5c6c554b 100644 --- a/ext/oci8/tests/fetch_array.phpt +++ b/ext/oci8/tests/fetch_array.phpt @@ -1,7 +1,10 @@ --TEST-- oci_fetch_array() --SKIPIF-- - + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- --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 + diff --git a/ext/oci8/tests/fetch_assoc.phpt b/ext/oci8/tests/fetch_assoc.phpt index 7dacf2e5b2..5c4c91e1d8 100644 --- a/ext/oci8/tests/fetch_assoc.phpt +++ b/ext/oci8/tests/fetch_assoc.phpt @@ -1,30 +1,23 @@ --TEST-- oci_fetch_assoc() --SKIPIF-- - + --FILE-- --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 diff --git a/ext/oci8/tests/fetch_into.phpt b/ext/oci8/tests/fetch_into.phpt index 17e06e1cf8..45a6a8132e 100644 --- a/ext/oci8/tests/fetch_into.phpt +++ b/ext/oci8/tests/fetch_into.phpt @@ -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-- diff --git a/ext/oci8/tests/fetch_into1.phpt b/ext/oci8/tests/fetch_into1.phpt index 263590d140..8f7a6bdeb8 100644 --- a/ext/oci8/tests/fetch_into1.phpt +++ b/ext/oci8/tests/fetch_into1.phpt @@ -1,7 +1,10 @@ --TEST-- various ocifetchinto() tests --SKIPIF-- - + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- 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 index 0000000000..4f14a5ec04 --- /dev/null +++ b/ext/oci8/tests/fetch_object_1.phpt @@ -0,0 +1,123 @@ +--TEST-- +oci_fetch_object() +--SKIPIF-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> +--FILE-- +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=== + +--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=== diff --git a/ext/oci8/tests/fetch_object_2.phpt b/ext/oci8/tests/fetch_object_2.phpt index b078ebb1d3..1814446aa8 100644 --- a/ext/oci8/tests/fetch_object_2.phpt +++ b/ext/oci8/tests/fetch_object_2.phpt @@ -1,7 +1,10 @@ --TEST-- oci_fetch_object() with CLOB and NULL --SKIPIF-- - + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- ===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 diff --git a/ext/oci8/tests/fetch_row.phpt b/ext/oci8/tests/fetch_row.phpt index c6084d4fe2..2b28634ab3 100644 --- a/ext/oci8/tests/fetch_row.phpt +++ b/ext/oci8/tests/fetch_row.phpt @@ -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"; diff --git a/ext/oci8/tests/field_funcs.phpt b/ext/oci8/tests/field_funcs.phpt index 18143f6f1b..92b77187a8 100644 --- a/ext/oci8/tests/field_funcs.phpt +++ b/ext/oci8/tests/field_funcs.phpt @@ -1,7 +1,10 @@ --TEST-- oci_field_*() family --SKIPIF-- - + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> +--FILE-- + $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 diff --git a/ext/oci8/tests/field_funcs1.phpt b/ext/oci8/tests/field_funcs1.phpt index 0b4ad76b39..c14ee8957e 100644 --- a/ext/oci8/tests/field_funcs1.phpt +++ b/ext/oci8/tests/field_funcs1.phpt @@ -1,5 +1,5 @@ --TEST-- -oci_field_*() family +oci_field_*() family: error cases --SKIPIF-- --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 index 0000000000..e51949cf21 --- /dev/null +++ b/ext/oci8/tests/field_funcs3.phpt @@ -0,0 +1,99 @@ +--TEST-- +oci_field_*() family: basic column types +--SKIPIF-- + +--FILE-- + $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=== + +--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=== diff --git a/ext/oci8/tests/field_funcs_old.phpt b/ext/oci8/tests/field_funcs_old.phpt index e0d24cd7b7..629c5508f1 100644 --- a/ext/oci8/tests/field_funcs_old.phpt +++ b/ext/oci8/tests/field_funcs_old.phpt @@ -1,7 +1,10 @@ --TEST-- ocicolumn*() family --SKIPIF-- - + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- Y_}+ic6Kl)3SiV|+SmaGtOKEkbInyERgy}Y7X9u$ zijJ*3AX|&QnBUmu9eKa|-|-m7t7N%~<3Qztmn!3zT3C!2q_Tju7AOl7#PRa={O$aN z+dN zTw`kSt`QW^NoUV<#Zas z>Cv3e_-t`HgG|Wcy$s2N{3&{c(h{z#U!7{>j|zn}s4WO-RhQah9nH#6+`CmC-qF`%a@>zTWFNIr;s3vFb)^&!L5`dSkEF zj;QsCr@qlcSBcO?x^1^umZZmBgF*ZljfS3KnIy0I(fQeZj@t;vYEtvw80)ezn>I+B zXs)VCSd#Kq22Zc+eYegAOKNIYsu4V$QNgn{T+k%01(g zJ4;sQXK!3ZmoC4qsLx>eZn5$m8Kn~F7NrK(N_Xq`U-#~FdZ5lxVIK?C>K#|6zd244e!Kg0d33jdl+ zX-T6|jm|N8Trf~;uvayLn^!Mj@5_R3KJYl8Sr|QI*I%8m&hVUh5dX&cEl&e~oyJ>) zp^xk5K{OsRXs6FFyU%t~w79d;7W1Fow}k)xN_I7K@S`Dn5S8p6b=#r$0^V`@)-COK D)ApFt literal 1305 zcmah|Yj4vq6y+=a6_=2yw$zkvLTI9_(;g|RR@$i#gapV+lUo{=+L`TctI+;Cw)@)H zI`Spb^||NV$GK57j0eLgA~MZ+A;mU}FWW5(`*d7ROUNfc z-{74=p>rv0UXo!(E0*K1!Wd*Z(m-G3B?t*F2pep`8gSgSjIDMjUh|RHMB(*3S7=j} zNM=YmcL2^=t@19FLSSlYxkxLGmyrq+gWM$J0#|SnN|kVZUBD3p?d~A%524*1_6R)x z1+`G8Q=BEW(9>{NPAvdBw$oudvc8^lM)3eB&Puc34oTTAY(E~3`rUT-^A4^}S&n80 z#x(#RZ@dx&4MIX~Y~wQ&# zy;F;H4C7p6e7x}e(=C5BSm_2;@PyT9-{+q4(`_=|VLG=ydXNWRAa0$EIzuZ#ZW6__ z`K+X#1vnUa$E&LF+SVrzi zE)0Fo*1xfo1vP4p%g6^td}NXo+J=_h9;`&`OQq%J=s}%<_sOfxx7w*M&>3@8+W!;o IiJJoX3nQ3( + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- 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=== + --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=== diff --git a/ext/oci8/tests/lob_003.phpt b/ext/oci8/tests/lob_003.phpt index 8a492d16ca9b89dede69c4f8dc5eed4fb1748030..4775444e27911340f56100b7d7606161d6309e9f 100644 GIT binary patch delta 147 zcmW;AF$%&k6adgkkf3+?gOC=aS=>r1hzf#t2xQHP`F%;m4+%3@~xw^-u(omEj6mbb!{D3SN{@1#mG0g#t0r@ph3=Crc tIUyr#H>?P+(Gw<(r{D%mtlb}uJ8RQS8$SDsZ!;gJwN7)jF5wkFlP^9?FpU5J delta 76 zcmZ3)dxvL&iK9Yhnu3O6YDGzEUU6oAUVKh|VoGX?hI)Q-riHqurb0?)s)kZ=c4mP> WUcLfIPyw!1Nz+=v-frXW=d1wZ{2DL- diff --git a/ext/oci8/tests/lob_004.phpt b/ext/oci8/tests/lob_004.phpt index 32de4a0120..3f583c67a2 100644 --- a/ext/oci8/tests/lob_004.phpt +++ b/ext/oci8/tests/lob_004.phpt @@ -1,7 +1,10 @@ --TEST-- oci_lob_seek()/rewind()/append() --SKIPIF-- - + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- %SFDhqr%;lSTAZrj;#AC4lv-GtS(K_V w@t}xcadu`wW}04RUb4ETHJ81e!o*rhMxc!7#5LU9KoNvmRYuK?&vvi^0B2-19RL6T delta 120 zcmaFHJCApQO^`xnnu3O6YDGzEUU6oAUVKh|VoGX?hI)Q-riHqurb0?)s)kZ=c4mP> zUcLfIPyw!1Nz+=v-i}LG*Ui(%RackG#=anOV diff --git a/ext/oci8/tests/lob_007.phpt b/ext/oci8/tests/lob_007.phpt index 1fe63092c6..1ca236ea28 100644 --- a/ext/oci8/tests/lob_007.phpt +++ b/ext/oci8/tests/lob_007.phpt @@ -1,7 +1,10 @@ --TEST-- oci_lob_write()/size()/load() --SKIPIF-- - + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- resource(%d) of type (oci8 descriptor) diff --git a/ext/oci8/tests/lob_016.phpt b/ext/oci8/tests/lob_016.phpt index 642e7195ef..e0f78e6a9f 100644 --- a/ext/oci8/tests/lob_016.phpt +++ b/ext/oci8/tests/lob_016.phpt @@ -1,7 +1,10 @@ --TEST-- returning multiple lobs --SKIPIF-- - + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- 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=== + --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=== diff --git a/ext/oci8/tests/lob_019.phpt b/ext/oci8/tests/lob_019.phpt index fb9a3c8188b9ea5013543e111b8111f0ec75250f..19c21f4a78d0cb26292e830e523c3ae2a81a98d9 100644 GIT binary patch delta 147 zcmW;AI|{-;5CG6hkdQ-6A?yYudw`G#{y^{!%O;uVVzSYh*}}@k!otFWmaazc2Co=~@*f*Vjl(IPRy*-;@gO+iC3wW1_7uQ)S5FFq$fF(oxcLp?t^(?VTSQz0cYRYR#bJF`F` WFJA#9r~p^1q-m{SZ@2MO12+KRpBdBu diff --git a/ext/oci8/tests/lob_021.phpt b/ext/oci8/tests/lob_021.phpt index 0ae6b377ab..b7489271b9 100644 --- a/ext/oci8/tests/lob_021.phpt +++ b/ext/oci8/tests/lob_021.phpt @@ -1,7 +1,10 @@ --TEST-- oci_lob_free()/close() --SKIPIF-- - + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- 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-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- read(), LOB->seek() and LOB->tell() with nul bytes in data --SKIPIF-- - + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- write() for multiple inserts --SKIPIF-- - + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- diff --git a/ext/oci8/tests/lob_042.phpt b/ext/oci8/tests/lob_042.phpt index 25309d6fc0..264c610455 100644 --- a/ext/oci8/tests/lob_042.phpt +++ b/ext/oci8/tests/lob_042.phpt @@ -1,7 +1,10 @@ --TEST-- Check various LOB error messages --SKIPIF-- - + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- 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 index 0000000000..28599cc33b --- /dev/null +++ b/ext/oci8/tests/lob_044.phpt @@ -0,0 +1,73 @@ +--TEST-- +oci_lob_truncate() with default parameter value +--SKIPIF-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> +--FILE-- +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=== + +--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=== diff --git a/ext/oci8/tests/lob_aliases.phpt b/ext/oci8/tests/lob_aliases.phpt index faa59bf12d..3ece9a5895 100644 --- a/ext/oci8/tests/lob_aliases.phpt +++ b/ext/oci8/tests/lob_aliases.phpt @@ -1,7 +1,10 @@ --TEST-- LOB method aliases --SKIPIF-- - + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- + 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 index 0000000000..73d5c26c0b --- /dev/null +++ b/ext/oci8/tests/null_byte_3.phpt @@ -0,0 +1,42 @@ +--TEST-- +Null bytes in SQL statements +--SKIPIF-- + +--INI-- +display_errors = On +error_reporting = E_WARNING +--FILE-- + +===DONE=== + +--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=== diff --git a/ext/oci8/tests/num.phpt b/ext/oci8/tests/num.phpt index e9dc6a8ac2..0fe85ccddc 100644 --- a/ext/oci8/tests/num.phpt +++ b/ext/oci8/tests/num.phpt @@ -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"; diff --git a/ext/oci8/tests/oci_execute_segfault.phpt b/ext/oci8/tests/oci_execute_segfault.phpt index 9ba7d770fd..59eb8013e9 100644 --- a/ext/oci8/tests/oci_execute_segfault.phpt +++ b/ext/oci8/tests/oci_execute_segfault.phpt @@ -1,7 +1,10 @@ --TEST-- oci_execute() segfault after repeated bind of LOB descriptor --SKIPIF-- - + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- +--CLEAN-- + --EXPECTF-- diff --git a/ext/oci8/tests/password_2.phpt b/ext/oci8/tests/password_2.phpt index 71423e717b..ceba0bba80 100644 --- a/ext/oci8/tests/password_2.phpt +++ b/ext/oci8/tests/password_2.phpt @@ -11,20 +11,15 @@ if ($test_drcp) die("skip password change not supported in DRCP Mode"); --FILE-- +--CLEAN-- + --EXPECTF-- diff --git a/ext/oci8/tests/password_new.phpt b/ext/oci8/tests/password_new.phpt index ba6baa964b..8041699f92 100644 --- a/ext/oci8/tests/password_new.phpt +++ b/ext/oci8/tests/password_new.phpt @@ -2,23 +2,16 @@ oci_password_change() --SKIPIF-- 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-- diff --git a/ext/oci8/tests/password_old.phpt b/ext/oci8/tests/password_old.phpt index abcaeb1e56..3ff726d2b7 100644 --- a/ext/oci8/tests/password_old.phpt +++ b/ext/oci8/tests/password_old.phpt @@ -2,24 +2,19 @@ ocipasswordchange() --SKIPIF-- 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-- + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --INI-- memory_limit=10M --FILE-- diff --git a/ext/oci8/tests/pecl_bug10194_blob.phpt b/ext/oci8/tests/pecl_bug10194_blob.phpt index 4c6aa4f1c9..38f6d9ed2f 100644 --- a/ext/oci8/tests/pecl_bug10194_blob.phpt +++ b/ext/oci8/tests/pecl_bug10194_blob.phpt @@ -1,22 +1,22 @@ --TEST-- PECL Bug #10194 (segfault in Instant Client when memory_limit is reached inside the callback) --SKIPIF-- - 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-- 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 diff --git a/ext/oci8/tests/pecl_bug10194_blob_64.phpt b/ext/oci8/tests/pecl_bug10194_blob_64.phpt index 433d586a4e..9ffc03d320 100644 --- a/ext/oci8/tests/pecl_bug10194_blob_64.phpt +++ b/ext/oci8/tests/pecl_bug10194_blob_64.phpt @@ -2,7 +2,8 @@ PECL Bug #10194 (segfault in Instant Client when memory_limit is reached inside the callback) --SKIPIF-- 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-- diff --git a/ext/oci8/tests/pecl_bug16035.phpt b/ext/oci8/tests/pecl_bug16035.phpt index fc91bc91bc..29ff6439d1 100644 --- a/ext/oci8/tests/pecl_bug16035.phpt +++ b/ext/oci8/tests/pecl_bug16035.phpt @@ -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-- --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=== diff --git a/ext/oci8/tests/pecl_bug16842.phpt b/ext/oci8/tests/pecl_bug16842.phpt index d796d2506e..dbf7e6bb83 100644 --- a/ext/oci8/tests/pecl_bug16842.phpt +++ b/ext/oci8/tests/pecl_bug16842.phpt @@ -1,7 +1,10 @@ --TEST-- PECL Bug #16842 (NO_DATA_FOUND exception is a warning) --SKIPIF-- - + 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=== diff --git a/ext/oci8/tests/pecl_bug8816.phpt b/ext/oci8/tests/pecl_bug8816.phpt index c369711fcf..71771b2100 100644 --- a/ext/oci8/tests/pecl_bug8816.phpt +++ b/ext/oci8/tests/pecl_bug8816.phpt @@ -1,7 +1,10 @@ --TEST-- PECL Bug #8816 (issue in php_oci_statement_fetch with more than one piecewise column) --SKIPIF-- - + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- diff --git a/ext/oci8/tests/prefetch_old.phpt b/ext/oci8/tests/prefetch_old.phpt index c2ac8fe841..ac43771c6b 100644 --- a/ext/oci8/tests/prefetch_old.phpt +++ b/ext/oci8/tests/prefetch_old.phpt @@ -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"; ?> diff --git a/ext/oci8/tests/refcur_prefetch_1.phpt b/ext/oci8/tests/refcur_prefetch_1.phpt index c603fdd5bb..ea09fbcd97 100644 --- a/ext/oci8/tests/refcur_prefetch_1.phpt +++ b/ext/oci8/tests/refcur_prefetch_1.phpt @@ -4,19 +4,10 @@ Prefetch with REF cursor. Test different values for prefetch with oci_set_prefet (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 diff --git a/ext/oci8/tests/refcur_prefetch_2.phpt b/ext/oci8/tests/refcur_prefetch_2.phpt index 78ce051756..8d65251077 100644 --- a/ext/oci8/tests/refcur_prefetch_2.phpt +++ b/ext/oci8/tests/refcur_prefetch_2.phpt @@ -4,19 +4,10 @@ Prefetch with REF cursor. Test No 2 (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 diff --git a/ext/oci8/tests/refcur_prefetch_3.phpt b/ext/oci8/tests/refcur_prefetch_3.phpt index 0666a96e90..8c0414042b 100644 --- a/ext/oci8/tests/refcur_prefetch_3.phpt +++ b/ext/oci8/tests/refcur_prefetch_3.phpt @@ -6,19 +6,10 @@ oci8.default_prefetch=5 (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 index 0000000000..d24398c00e --- /dev/null +++ b/ext/oci8/tests/refcur_prefetch_4.phpt @@ -0,0 +1,176 @@ +--TEST-- +Prefetch with REF cursor. Test No 4 +--SKIPIF-- + +--FILE-- + +--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 diff --git a/ext/oci8/tests/select_null.phpt b/ext/oci8/tests/select_null.phpt index 87c5b815fd..450c81a877 100644 --- a/ext/oci8/tests/select_null.phpt +++ b/ext/oci8/tests/select_null.phpt @@ -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 diff --git a/ext/oci8/tests/serverversion.phpt b/ext/oci8/tests/serverversion.phpt index bf32fe4b54..6cbb5aaad0 100644 --- a/ext/oci8/tests/serverversion.phpt +++ b/ext/oci8/tests/serverversion.phpt @@ -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 diff --git a/ext/oci8/tests/skipif.inc b/ext/oci8/tests/skipif.inc index ed0992c8d9..0ae2876e22 100644 --- a/ext/oci8/tests/skipif.inc +++ b/ext/oci8/tests/skipif.inc @@ -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"); + ?> diff --git a/ext/oci8/tests/statement_cache.phpt b/ext/oci8/tests/statement_cache.phpt index 19e69d4c21..4c48d3f1dd 100644 --- a/ext/oci8/tests/statement_cache.phpt +++ b/ext/oci8/tests/statement_cache.phpt @@ -1,10 +1,15 @@ --TEST-- statement cache --SKIPIF-- - + true, 'timesten' => true); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- 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 diff --git a/ext/oci8/tests/xmltype_01.phpt b/ext/oci8/tests/xmltype_01.phpt index a9458c83d4..21aca6cc12 100644 --- a/ext/oci8/tests/xmltype_01.phpt +++ b/ext/oci8/tests/xmltype_01.phpt @@ -1,8 +1,10 @@ --TEST-- Basic XMLType test --SKIPIF-- - - + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); --FILE-- '))" ); -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"; diff --git a/ext/oci8/tests/xmltype_02.phpt b/ext/oci8/tests/xmltype_02.phpt index 9b6fa8ad32..83b4123067 100644 --- a/ext/oci8/tests/xmltype_02.phpt +++ b/ext/oci8/tests/xmltype_02.phpt @@ -1,7 +1,10 @@ --TEST-- Basic XMLType test #2 --SKIPIF-- - + true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- 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) " +string(331) " 1 Southlake, Texas -- 2.40.0