summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Jones <sixd@php.net>2011-06-10 19:16:35 +0000
committerChristopher Jones <sixd@php.net>2011-06-10 19:16:35 +0000
commitc7a8bd6a4c4bb36657d3d8e313935032283a5e73 (patch)
treec81801cb7ff83c9667d98afbc7063c60dc61e3fb
parentf4009b52a31544ca188dd9679478f273e335de54 (diff)
downloadphp-git-c7a8bd6a4c4bb36657d3d8e313935032283a5e73.tar.gz
Add new OCI8 tests. Refactor skipifs. Sync 5.3/5.4/trunk branches
-rw-r--r--ext/oci8/tests/array_bind_001.phpt2
-rw-r--r--ext/oci8/tests/array_bind_002.phpt2
-rw-r--r--ext/oci8/tests/array_bind_003.phpt5
-rw-r--r--ext/oci8/tests/array_bind_004.phpt5
-rw-r--r--ext/oci8/tests/array_bind_005.phpt5
-rw-r--r--ext/oci8/tests/array_bind_006.phpt5
-rw-r--r--ext/oci8/tests/array_bind_007.phpt2
-rw-r--r--ext/oci8/tests/array_bind_008.phpt11
-rw-r--r--ext/oci8/tests/array_bind_010.phpt2
-rw-r--r--ext/oci8/tests/array_bind_011.phpt2
-rw-r--r--ext/oci8/tests/array_bind_012.phpt2
-rw-r--r--ext/oci8/tests/array_bind_014.phpt5
-rw-r--r--ext/oci8/tests/array_bind_date.phpt5
-rw-r--r--ext/oci8/tests/array_bind_date1.phpt5
-rw-r--r--ext/oci8/tests/array_bind_float.phpt5
-rw-r--r--ext/oci8/tests/array_bind_float1.phpt5
-rw-r--r--ext/oci8/tests/array_bind_int.phpt5
-rw-r--r--ext/oci8/tests/array_bind_int1.phpt5
-rw-r--r--ext/oci8/tests/array_bind_str.phpt7
-rw-r--r--ext/oci8/tests/array_bind_str1.phpt7
-rw-r--r--ext/oci8/tests/b47243_1.phpt5
-rw-r--r--ext/oci8/tests/b47243_2.phpt5
-rw-r--r--ext/oci8/tests/b47243_3.phpt5
-rw-r--r--ext/oci8/tests/bind_char_1.phpt28
-rw-r--r--ext/oci8/tests/bind_char_1_11gR1.phpt12
-rw-r--r--ext/oci8/tests/bind_char_2.phpt28
-rw-r--r--ext/oci8/tests/bind_char_2_11gR1.phpt12
-rw-r--r--ext/oci8/tests/bind_char_3.phpt32
-rw-r--r--ext/oci8/tests/bind_char_3_11gR1.phpt14
-rw-r--r--ext/oci8/tests/bind_char_4.phpt30
-rw-r--r--ext/oci8/tests/bind_char_4_11gR1.phpt14
-rw-r--r--ext/oci8/tests/bind_long.phpt32
-rw-r--r--ext/oci8/tests/bind_long_raw.phpt5
-rw-r--r--ext/oci8/tests/bind_misccoltypes.phpt369
-rw-r--r--ext/oci8/tests/bind_misccoltypes_errs.phpt169
-rw-r--r--ext/oci8/tests/bind_number.phpt220
-rw-r--r--ext/oci8/tests/bind_query.phpt78
-rw-r--r--ext/oci8/tests/bind_raw.phpt5
-rw-r--r--ext/oci8/tests/bind_rowid.phpt16
-rw-r--r--ext/oci8/tests/bind_sqltafc.phpt208
-rw-r--r--ext/oci8/tests/bind_sqltchr_1.phpt228
-rw-r--r--ext/oci8/tests/bind_sqltchr_2.phpt50
-rw-r--r--ext/oci8/tests/bind_sqltint.phpt227
-rw-r--r--ext/oci8/tests/bind_sqltnum.phpt278
-rw-r--r--ext/oci8/tests/bind_unsupported_1.phpt58
-rw-r--r--ext/oci8/tests/bind_unsupported_2.phpt39
-rw-r--r--ext/oci8/tests/bind_unsupported_3.phpt45
-rw-r--r--ext/oci8/tests/bug26133.phpt25
-rw-r--r--ext/oci8/tests/bug27303_1.phpt46
-rw-r--r--ext/oci8/tests/bug27303_1_11gR1.phpt32
-rw-r--r--ext/oci8/tests/bug27303_2.phpt44
-rw-r--r--ext/oci8/tests/bug27303_2_11gR1.phpt28
-rw-r--r--ext/oci8/tests/bug27303_4.phpt16
-rw-r--r--ext/oci8/tests/bug32325.phpt23
-rw-r--r--ext/oci8/tests/bug35973.phpt5
-rw-r--r--ext/oci8/tests/bug36010.phpt5
-rw-r--r--ext/oci8/tests/bug36096.phpt4
-rw-r--r--ext/oci8/tests/bug36403.phpt34
-rw-r--r--ext/oci8/tests/bug37220.phpt15
-rw-r--r--ext/oci8/tests/bug37581.phpt5
-rw-r--r--ext/oci8/tests/bug38173.phpt5
-rw-r--r--ext/oci8/tests/bug40078.phpt5
-rw-r--r--ext/oci8/tests/bug40415.phpt5
-rw-r--r--ext/oci8/tests/bug41069.phpt20
-rw-r--r--ext/oci8/tests/bug42134.phpt5
-rw-r--r--ext/oci8/tests/bug42173.phpt5
-rw-r--r--ext/oci8/tests/bug42496_1.phpt18
-rw-r--r--ext/oci8/tests/bug42496_2.phpt18
-rw-r--r--ext/oci8/tests/bug42841.phpt157
-rw-r--r--ext/oci8/tests/bug43492.phpt17
-rw-r--r--ext/oci8/tests/bug43492_2.phpt17
-rw-r--r--ext/oci8/tests/bug43497.phpt12
-rw-r--r--ext/oci8/tests/bug43497_92.phpt14
-rw-r--r--ext/oci8/tests/bug44008.phpt19
-rw-r--r--ext/oci8/tests/bug44113.phpt16
-rw-r--r--ext/oci8/tests/bug44206.phpt5
-rw-r--r--ext/oci8/tests/bug45458.phpt14
-rw-r--r--ext/oci8/tests/bug46994.phpt15
-rw-r--r--ext/oci8/tests/bug47189.phpt11
-rw-r--r--ext/oci8/tests/bug47281.phpt28
-rw-r--r--ext/oci8/tests/bug47281_tt.phpt59
-rw-r--r--ext/oci8/tests/bug51253.phpt5
-rw-r--r--ext/oci8/tests/bug51291_1.phpt (renamed from ext/oci8/tests/bug51291.phpt)104
-rw-r--r--ext/oci8/tests/bug51291_2.phpt56
-rw-r--r--ext/oci8/tests/coll_001.phpt5
-rw-r--r--ext/oci8/tests/coll_002.phpt5
-rw-r--r--ext/oci8/tests/coll_002_func.phpt5
-rw-r--r--ext/oci8/tests/coll_003.phpt5
-rw-r--r--ext/oci8/tests/coll_003_func.phpt5
-rw-r--r--ext/oci8/tests/coll_004.phpt5
-rw-r--r--ext/oci8/tests/coll_004_func.phpt5
-rw-r--r--ext/oci8/tests/coll_005.phpt5
-rw-r--r--ext/oci8/tests/coll_006.phpt5
-rw-r--r--ext/oci8/tests/coll_006_func.phpt5
-rw-r--r--ext/oci8/tests/coll_007.phpt5
-rw-r--r--ext/oci8/tests/coll_008.phpt5
-rw-r--r--ext/oci8/tests/coll_009.phpt5
-rw-r--r--ext/oci8/tests/coll_009_func.phpt5
-rw-r--r--ext/oci8/tests/coll_010.phpt5
-rw-r--r--ext/oci8/tests/coll_010_func.phpt5
-rw-r--r--ext/oci8/tests/coll_011.phpt5
-rw-r--r--ext/oci8/tests/coll_011_func.phpt5
-rw-r--r--ext/oci8/tests/coll_012.phpt5
-rw-r--r--ext/oci8/tests/coll_012_func.phpt5
-rw-r--r--ext/oci8/tests/coll_013.phpt5
-rw-r--r--ext/oci8/tests/coll_013_func.phpt5
-rw-r--r--ext/oci8/tests/coll_014.phpt5
-rw-r--r--ext/oci8/tests/coll_014_func.phpt5
-rw-r--r--ext/oci8/tests/coll_015.phpt5
-rw-r--r--ext/oci8/tests/coll_015_func.phpt5
-rw-r--r--ext/oci8/tests/coll_016.phpt5
-rw-r--r--ext/oci8/tests/coll_016_func.phpt5
-rw-r--r--ext/oci8/tests/coll_017.phpt5
-rw-r--r--ext/oci8/tests/coll_017_func.phpt5
-rw-r--r--ext/oci8/tests/coll_018.phpt5
-rw-r--r--ext/oci8/tests/coll_019.phpt8
-rw-r--r--ext/oci8/tests/commit_001.phpt5
-rw-r--r--ext/oci8/tests/commit_002.phpt28
-rw-r--r--ext/oci8/tests/commit_old.phpt5
-rw-r--r--ext/oci8/tests/conn_attr_1.phpt21
-rw-r--r--ext/oci8/tests/conn_attr_2.phpt24
-rw-r--r--ext/oci8/tests/conn_attr_3.phpt23
-rw-r--r--ext/oci8/tests/conn_attr_4.phpt27
-rw-r--r--ext/oci8/tests/conn_attr_5.phpt23
-rw-r--r--ext/oci8/tests/connect.inc5
-rw-r--r--ext/oci8/tests/connect_scope1.phpt10
-rw-r--r--ext/oci8/tests/connect_scope2.phpt10
-rw-r--r--ext/oci8/tests/connect_scope_try1.phpt12
-rw-r--r--ext/oci8/tests/connect_scope_try2.phpt12
-rw-r--r--ext/oci8/tests/connect_scope_try3.phpt12
-rw-r--r--ext/oci8/tests/connect_scope_try4.phpt12
-rw-r--r--ext/oci8/tests/connect_scope_try5.phpt12
-rw-r--r--ext/oci8/tests/connect_scope_try6.phpt12
-rw-r--r--ext/oci8/tests/connect_without_oracle_home_11.phpt5
-rw-r--r--ext/oci8/tests/connect_without_oracle_home_old.phpt5
-rw-r--r--ext/oci8/tests/connect_without_oracle_home_old_11.phpt5
-rw-r--r--ext/oci8/tests/create_table.inc20
-rw-r--r--ext/oci8/tests/cursor_bind.phpt70
-rw-r--r--ext/oci8/tests/cursor_bind_err.phpt28
-rw-r--r--ext/oci8/tests/cursors.phpt5
-rw-r--r--ext/oci8/tests/cursors_old.phpt28
-rw-r--r--ext/oci8/tests/dbmsoutput.phpt750
-rw-r--r--ext/oci8/tests/default_prefetch.phpt24
-rw-r--r--ext/oci8/tests/default_prefetch0.phpt53
-rw-r--r--ext/oci8/tests/default_prefetch1.phpt23
-rw-r--r--ext/oci8/tests/default_prefetch2.phpt23
-rw-r--r--ext/oci8/tests/define.phpt18
-rw-r--r--ext/oci8/tests/define0.phpt61
-rw-r--r--ext/oci8/tests/define1.phpt18
-rw-r--r--ext/oci8/tests/define2.phpt19
-rw-r--r--ext/oci8/tests/define3.phpt17
-rw-r--r--ext/oci8/tests/define4.phpt18
-rw-r--r--ext/oci8/tests/define5.phpt18
-rw-r--r--ext/oci8/tests/define6.phpt138
-rw-r--r--ext/oci8/tests/define_old.phpt19
-rw-r--r--ext/oci8/tests/descriptors.phpt5
-rw-r--r--ext/oci8/tests/details.inc109
-rw-r--r--ext/oci8/tests/drcp_connect1.phpt22
-rw-r--r--ext/oci8/tests/drcp_functions.inc2
-rw-r--r--ext/oci8/tests/drcp_privileged.phpt17
-rw-r--r--ext/oci8/tests/driver_name.phpt18
-rw-r--r--ext/oci8/tests/dupcolnames.phpt102
-rw-r--r--ext/oci8/tests/edition_1.phpt28
-rw-r--r--ext/oci8/tests/edition_2.phpt17
-rw-r--r--ext/oci8/tests/error.phpt15
-rw-r--r--ext/oci8/tests/error1.phpt4
-rw-r--r--ext/oci8/tests/error2.phpt10
-rw-r--r--ext/oci8/tests/error_bind.phpt2
-rw-r--r--ext/oci8/tests/error_old.phpt13
-rw-r--r--ext/oci8/tests/error_parse.phpt16
-rw-r--r--ext/oci8/tests/exec_fetch.phpt4
-rw-r--r--ext/oci8/tests/fetch.phpt24
-rw-r--r--ext/oci8/tests/fetch_all.phpt18
-rw-r--r--ext/oci8/tests/fetch_all1.phpt94
-rw-r--r--ext/oci8/tests/fetch_all2.phpt5
-rw-r--r--ext/oci8/tests/fetch_all3.phpt27
-rw-r--r--ext/oci8/tests/fetch_all4.phpt23
-rw-r--r--ext/oci8/tests/fetch_all5.phpt21
-rw-r--r--ext/oci8/tests/fetch_array.phpt70
-rw-r--r--ext/oci8/tests/fetch_assoc.phpt59
-rw-r--r--ext/oci8/tests/fetch_into.phpt25
-rw-r--r--ext/oci8/tests/fetch_into1.phpt5
-rw-r--r--ext/oci8/tests/fetch_into2.phpt5
-rw-r--r--ext/oci8/tests/fetch_object.phpt52
-rw-r--r--ext/oci8/tests/fetch_object_1.phpt123
-rw-r--r--ext/oci8/tests/fetch_object_2.phpt82
-rw-r--r--ext/oci8/tests/fetch_row.phpt23
-rw-r--r--ext/oci8/tests/field_funcs.phpt5
-rw-r--r--ext/oci8/tests/field_funcs0.phpt108
-rw-r--r--ext/oci8/tests/field_funcs1.phpt39
-rw-r--r--ext/oci8/tests/field_funcs3.phpt99
-rw-r--r--ext/oci8/tests/field_funcs_old.phpt5
-rw-r--r--ext/oci8/tests/lob_001.phptbin1305 -> 2152 bytes
-rw-r--r--ext/oci8/tests/lob_002.phpt43
-rw-r--r--ext/oci8/tests/lob_003.phptbin1628 -> 1698 bytes
-rw-r--r--ext/oci8/tests/lob_004.phpt5
-rw-r--r--ext/oci8/tests/lob_005.phpt5
-rw-r--r--ext/oci8/tests/lob_006.phptbin1694 -> 1766 bytes
-rw-r--r--ext/oci8/tests/lob_007.phpt5
-rw-r--r--ext/oci8/tests/lob_008.phpt5
-rw-r--r--ext/oci8/tests/lob_009.phpt5
-rw-r--r--ext/oci8/tests/lob_010.phpt5
-rw-r--r--ext/oci8/tests/lob_011.phpt5
-rw-r--r--ext/oci8/tests/lob_012.phpt5
-rw-r--r--ext/oci8/tests/lob_013.phpt5
-rw-r--r--ext/oci8/tests/lob_014.phpt5
-rw-r--r--ext/oci8/tests/lob_015.phpt7
-rw-r--r--ext/oci8/tests/lob_016.phpt5
-rw-r--r--ext/oci8/tests/lob_017.phpt5
-rw-r--r--ext/oci8/tests/lob_018.phpt70
-rw-r--r--ext/oci8/tests/lob_019.phptbin1548 -> 1618 bytes
-rw-r--r--ext/oci8/tests/lob_020.phptbin3076 -> 3146 bytes
-rw-r--r--ext/oci8/tests/lob_021.phpt5
-rw-r--r--ext/oci8/tests/lob_022.phpt5
-rw-r--r--ext/oci8/tests/lob_023.phpt5
-rw-r--r--ext/oci8/tests/lob_024.phpt5
-rw-r--r--ext/oci8/tests/lob_025.phpt5
-rw-r--r--ext/oci8/tests/lob_026.phpt5
-rw-r--r--ext/oci8/tests/lob_027.phpt5
-rw-r--r--ext/oci8/tests/lob_028.phpt5
-rw-r--r--ext/oci8/tests/lob_029.phpt15
-rw-r--r--ext/oci8/tests/lob_030.phpt5
-rw-r--r--ext/oci8/tests/lob_031.phpt5
-rw-r--r--ext/oci8/tests/lob_032.phpt5
-rw-r--r--ext/oci8/tests/lob_033.phpt5
-rw-r--r--ext/oci8/tests/lob_034.phpt5
-rw-r--r--ext/oci8/tests/lob_035.phpt5
-rw-r--r--ext/oci8/tests/lob_036.phpt5
-rw-r--r--ext/oci8/tests/lob_037.phpt5
-rw-r--r--ext/oci8/tests/lob_038.phpt5
-rw-r--r--ext/oci8/tests/lob_039.phpt5
-rw-r--r--ext/oci8/tests/lob_040.phpt5
-rw-r--r--ext/oci8/tests/lob_041.phpt17
-rw-r--r--ext/oci8/tests/lob_042.phpt5
-rw-r--r--ext/oci8/tests/lob_043.phpt26
-rw-r--r--ext/oci8/tests/lob_044.phpt73
-rw-r--r--ext/oci8/tests/lob_aliases.phpt5
-rw-r--r--ext/oci8/tests/lob_null.phpt5
-rw-r--r--ext/oci8/tests/lob_temp.phpt5
-rw-r--r--ext/oci8/tests/lob_temp1.phpt5
-rw-r--r--ext/oci8/tests/null_byte_2.phpt27
-rw-r--r--ext/oci8/tests/null_byte_3.phpt42
-rw-r--r--ext/oci8/tests/num.phpt23
-rw-r--r--ext/oci8/tests/oci_execute_segfault.phpt5
-rw-r--r--ext/oci8/tests/password.phpt41
-rw-r--r--ext/oci8/tests/password_2.phpt40
-rw-r--r--ext/oci8/tests/password_new.phpt17
-rw-r--r--ext/oci8/tests/password_old.phpt19
-rw-r--r--ext/oci8/tests/pecl_bug10194.phpt5
-rw-r--r--ext/oci8/tests/pecl_bug10194_blob.phpt20
-rw-r--r--ext/oci8/tests/pecl_bug10194_blob_64.phpt3
-rw-r--r--ext/oci8/tests/pecl_bug16035.phpt5
-rw-r--r--ext/oci8/tests/pecl_bug16842.phpt29
-rw-r--r--ext/oci8/tests/pecl_bug8816.phpt5
-rw-r--r--ext/oci8/tests/prefetch.phpt23
-rw-r--r--ext/oci8/tests/prefetch_old.phpt23
-rw-r--r--ext/oci8/tests/refcur_prefetch_1.phpt139
-rw-r--r--ext/oci8/tests/refcur_prefetch_2.phpt171
-rw-r--r--ext/oci8/tests/refcur_prefetch_3.phpt40
-rw-r--r--ext/oci8/tests/refcur_prefetch_4.phpt176
-rw-r--r--ext/oci8/tests/select_null.phpt4
-rw-r--r--ext/oci8/tests/serverversion.phpt4
-rw-r--r--ext/oci8/tests/skipif.inc18
-rw-r--r--ext/oci8/tests/statement_cache.phpt11
-rw-r--r--ext/oci8/tests/xmltype_01.phpt26
-rw-r--r--ext/oci8/tests/xmltype_02.phpt113
266 files changed, 5576 insertions, 2177 deletions
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--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/array_bind_004.phpt b/ext/oci8/tests/array_bind_004.phpt
index 1ddf85149b..1eb1fc7fac 100644
--- a/ext/oci8/tests/array_bind_004.phpt
+++ b/ext/oci8/tests/array_bind_004.phpt
@@ -1,7 +1,10 @@
--TEST--
oci_bind_array_by_name() and invalid values 4
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/array_bind_005.phpt b/ext/oci8/tests/array_bind_005.phpt
index 58dadc20ca..eaa3c4ea2e 100644
--- a/ext/oci8/tests/array_bind_005.phpt
+++ b/ext/oci8/tests/array_bind_005.phpt
@@ -1,7 +1,10 @@
--TEST--
oci_bind_array_by_name() and invalid values 5
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/array_bind_006.phpt b/ext/oci8/tests/array_bind_006.phpt
index e229dd8722..f13aca3997 100644
--- a/ext/oci8/tests/array_bind_006.phpt
+++ b/ext/oci8/tests/array_bind_006.phpt
@@ -1,7 +1,10 @@
--TEST--
oci_bind_array_by_name(), SQLT_CHR and default max_length
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/array_bind_007.phpt b/ext/oci8/tests/array_bind_007.phpt
index 10c92a8e7d..c926bc0abd 100644
--- a/ext/oci8/tests/array_bind_007.phpt
+++ b/ext/oci8/tests/array_bind_007.phpt
@@ -61,7 +61,7 @@ echo "Done\n";
--EXPECTF--
Warning: oci_bind_array_by_name(): Unknown or unsupported datatype given: -1 in %s on line %d
-Warning: oci_execute(): ORA-01008: not all variables bound in %s on line %d
+Warning: oci_execute(): ORA-%r(01008|57000)%r: %s in %s on line %d
array(5) {
[0]=>
int(1)
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--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
@@ -60,9 +63,9 @@ echo "Done\n";
?>
--EXPECTF--
Warning: oci_execute(): ORA-06550: line %d, column %d:
-PLS-00418: array bind type must match PL/SQL table row type
-ORA-06550: line %d, column %d:
-PL/SQL: Statement ignored in %s on line %d
+PLS-00418: %s
+ORA-06550: %s
+PL/SQL: %s
array(5) {
[0]=>
string(1) "1"
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--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/array_bind_date.phpt b/ext/oci8/tests/array_bind_date.phpt
index 63da558f91..926d7cfaba 100644
--- a/ext/oci8/tests/array_bind_date.phpt
+++ b/ext/oci8/tests/array_bind_date.phpt
@@ -1,7 +1,10 @@
--TEST--
oci_bind_array_by_name() and SQLT_ODT
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/array_bind_date1.phpt b/ext/oci8/tests/array_bind_date1.phpt
index ebf767570b..c8c1f1a5e9 100644
--- a/ext/oci8/tests/array_bind_date1.phpt
+++ b/ext/oci8/tests/array_bind_date1.phpt
@@ -1,7 +1,10 @@
--TEST--
oci_bind_array_by_name() and SQLT_ODT
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/array_bind_float.phpt b/ext/oci8/tests/array_bind_float.phpt
index 1aafb24317..5246f63805 100644
--- a/ext/oci8/tests/array_bind_float.phpt
+++ b/ext/oci8/tests/array_bind_float.phpt
@@ -1,7 +1,10 @@
--TEST--
oci_bind_array_by_name() and SQLT_FLT
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/array_bind_float1.phpt b/ext/oci8/tests/array_bind_float1.phpt
index ead85890fa..53b551f1c1 100644
--- a/ext/oci8/tests/array_bind_float1.phpt
+++ b/ext/oci8/tests/array_bind_float1.phpt
@@ -1,7 +1,10 @@
--TEST--
oci_bind_array_by_name() and SQLT_FLT
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/array_bind_int.phpt b/ext/oci8/tests/array_bind_int.phpt
index 3c8bfd4f57..2f34979f23 100644
--- a/ext/oci8/tests/array_bind_int.phpt
+++ b/ext/oci8/tests/array_bind_int.phpt
@@ -1,7 +1,10 @@
--TEST--
oci_bind_array_by_name() and SQLT_INT
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/array_bind_int1.phpt b/ext/oci8/tests/array_bind_int1.phpt
index 5e06de876b..49fea2aa03 100644
--- a/ext/oci8/tests/array_bind_int1.phpt
+++ b/ext/oci8/tests/array_bind_int1.phpt
@@ -1,7 +1,10 @@
--TEST--
oci_bind_array_by_name() and SQLT_INT
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/array_bind_str.phpt b/ext/oci8/tests/array_bind_str.phpt
index c8e1e0cdb5..87291bd172 100644
--- a/ext/oci8/tests/array_bind_str.phpt
+++ b/ext/oci8/tests/array_bind_str.phpt
@@ -1,7 +1,10 @@
--TEST--
-oci_bind_array_by_name() and SQLT_AVC
+oci_bind_array_by_name() and SQLT_CHR
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/array_bind_str1.phpt b/ext/oci8/tests/array_bind_str1.phpt
index af4dbfe220..3f60ee8c28 100644
--- a/ext/oci8/tests/array_bind_str1.phpt
+++ b/ext/oci8/tests/array_bind_str1.phpt
@@ -1,7 +1,10 @@
--TEST--
-oci_bind_array_by_name() and SQLT_AVC
+oci_bind_array_by_name() and SQLT_CHR
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/b47243_1.phpt b/ext/oci8/tests/b47243_1.phpt
index 9f04f302cb..2911229175 100644
--- a/ext/oci8/tests/b47243_1.phpt
+++ b/ext/oci8/tests/b47243_1.phpt
@@ -1,7 +1,10 @@
--TEST--
Bug #47243 (Crash on exit with ZTS mode)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/b47243_2.phpt b/ext/oci8/tests/b47243_2.phpt
index 08f5f528c3..ae96953d7b 100644
--- a/ext/oci8/tests/b47243_2.phpt
+++ b/ext/oci8/tests/b47243_2.phpt
@@ -1,7 +1,10 @@
--TEST--
Bug #47243 (Crash on exit with ZTS mode)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/b47243_3.phpt b/ext/oci8/tests/b47243_3.phpt
index 0decb34872..cc57c20d63 100644
--- a/ext/oci8/tests/b47243_3.phpt
+++ b/ext/oci8/tests/b47243_3.phpt
@@ -1,7 +1,10 @@
--TEST--
Bug #47243 (Crash on exit with ZTS mode)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/bind_char_1.phpt b/ext/oci8/tests/bind_char_1.phpt
index 24ab1fc825..a5b059ed1d 100644
--- a/ext/oci8/tests/bind_char_1.phpt
+++ b/ext/oci8/tests/bind_char_1.phpt
@@ -4,18 +4,10 @@ SELECT oci_bind_by_name with SQLT_AFC aka CHAR
<?php
if (!extension_loaded('oci8')) die ("skip no oci8 extension");
require(dirname(__FILE__)."/connect.inc");
-$sv = oci_server_version($c);
-$sv = preg_match('/Release 1[01]\.2\./', $sv, $matches);
-if ($sv !== 1) {
- die ("skip expected output only valid when using Oracle 10gR2 or 11gR2 databases");
-} else {
- ob_start();
- phpinfo(INFO_MODULES);
- $phpinfo = ob_get_clean();
- $iv = preg_match('/Oracle .*Version => 1[1]\./', $phpinfo);
- if ($iv != 1) {
- die ("skip test expected to work only with Oracle 11g or greater version of client");
- }
+if (preg_match('/Release 1[01]\.2\./', oci_server_version($c), $matches) !== 1) {
+ die("skip expected output only valid when using Oracle 10gR2 or 11gR2 databases");
+} else if (preg_match('/^11\./', oci_client_version()) != 1) {
+ die("skip test expected to work only with Oracle 11g or greater version of client");
}
?>
--FILE--
@@ -33,10 +25,7 @@ $stmtarray = array(
"insert into bind_char_tab values (3, NULL, 'abc ')"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
// Run Test
@@ -206,12 +195,7 @@ $stmtarray = array(
"drop table bind_char_tab"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
-
-oci_close($c);
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
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
<?php
if (!extension_loaded('oci8')) die ("skip no oci8 extension");
require(dirname(__FILE__)."/connect.inc");
-$sv = oci_server_version($c);
-$sv = preg_match('/Release 1[01]\.2\./', $sv, $matches);
-if ($sv !== 1) {
- die ("skip expected output only valid when using Oracle 10gR2 or 11gR2 databases");
-} else {
- ob_start();
- phpinfo(INFO_MODULES);
- $phpinfo = ob_get_clean();
- $iv = preg_match('/Oracle .*Version => 1[1]\./', $phpinfo);
- if ($iv != 1) {
- die ("skip test expected to work only with Oracle 11g or greater version of client");
- }
+if (preg_match('/Release 1[01]\.2\./', oci_server_version($c), $matches) !== 1) {
+ die("skip expected output only valid when using Oracle 10gR2 or 11gR2 databases");
+} else if (preg_match('/^11\./', oci_client_version()) != 1) {
+ die("skip test expected to work only with Oracle 11g or greater version of client");
}
?>
--FILE--
@@ -32,10 +24,7 @@ $stmtarray = array(
"insert into bind_char_tab values (1, '2008-04-20')",
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
// Run Test
@@ -95,12 +84,7 @@ $stmtarray = array(
"drop table bind_char_tab"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
-
-oci_close($c);
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
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
<?php
if (!extension_loaded('oci8')) die ("skip no oci8 extension");
require(dirname(__FILE__)."/connect.inc");
-$sv = oci_server_version($c);
-$sv = preg_match('/Release 1[01]\.2\./', $sv, $matches);
-if ($sv !== 1) {
- die ("skip expected output only valid when using Oracle 10gR2 11gR2 databases");
-} else {
- ob_start();
- phpinfo(INFO_MODULES);
- $phpinfo = ob_get_clean();
- $iv = preg_match('/Oracle .*Version => 1[1]\./', $phpinfo);
- if ($iv != 1) {
- die ("skip test expected to work only with Oracle 11g or greater version of client");
- }
+if (preg_match('/Release 1[01]\.2\./', oci_server_version($c), $matches) !== 1) {
+ die("skip expected output only valid when using Oracle 10gR2 or 11gR2 databases");
+} else if (preg_match('/^11\./', oci_client_version()) != 1) {
+ die("skip test expected to work only with Oracle 11g or greater version of client");
}
?>
--FILE--
@@ -28,11 +20,8 @@ require(dirname(__FILE__).'/connect.inc');
$stmtarray = array(
"create or replace function bind_char_3_fn(p1 char) return char as begin return p1; end;",
);
-
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- @oci_execute($s);
-}
+
+oci8_test_sql_execute($c, $stmtarray);
// Run Test
@@ -243,18 +232,11 @@ function do_e($s)
// Cleanup
-//require(dirname(__FILE__).'/drop_table.inc');
-
$stmtarray = array(
"drop function bind_char_3_fn"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
-
-oci_close($c);
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
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
<?php
if (!extension_loaded('oci8')) die ("skip no oci8 extension");
require(dirname(__FILE__)."/connect.inc");
-$sv = oci_server_version($c);
-$sv = preg_match('/Release 1[01]\.2\./', $sv, $matches);
-if ($sv !== 1) {
- die ("skip expected output only valid when using Oracle 10gR2 or 11gR2 databases");
-} else {
- ob_start();
- phpinfo(INFO_MODULES);
- $phpinfo = ob_get_clean();
- $iv = preg_match('/Oracle .*Version => 1[1]\./', $phpinfo);
- if ($iv != 1) {
- die ("skip test expected to work only with Oracle 11g or greater version of client");
- }
+if (preg_match('/Release 1[01]\.2\./', oci_server_version($c), $matches) !== 1) {
+ die("skip expected output only valid when using Oracle 10gR2 or 11gR2 databases");
+} else if (preg_match('/^11\./', oci_client_version()) != 1) {
+ die("skip test expected to work only with Oracle 11g or greater version of client");
}
?>
--FILE--
@@ -31,10 +23,7 @@ $stmtarray = array(
"create or replace function bind_char_3_fn(p1 varchar2) return varchar2 as begin return p1; end;",
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
// Run Test
@@ -245,18 +234,11 @@ function do_e($s)
// Cleanup
-//require(dirname(__FILE__).'/drop_table.inc');
-
$stmtarray = array(
"drop function bind_char_3_fn"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
-
-oci_close($c);
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
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--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
@@ -13,16 +16,37 @@ $stmt = oci_parse($c, "drop table phptestlng");
$stmt = oci_parse($c, "create table phptestlng( id number(10), filetxt long)");
oci_execute($stmt);
+echo "Test 1\n";
+
$stmt = oci_parse ($c, "insert into phptestlng (id, filetxt) values (:id, :filetxt)");
$i=1;
$filetxt = file_get_contents( dirname(__FILE__)."/test.txt");
+
+oci_bind_by_name( $stmt, ":id", $i, -1);
+oci_bind_by_name( $stmt, ":filetxt", $filetxt, -1, SQLT_LNG);
+oci_execute($stmt, OCI_DEFAULT);
+oci_commit($c);
+
+$stmt = oci_parse($c, "SELECT filetxt FROM phptestlng where id = 1");
+oci_execute($stmt);
+
+$row = oci_fetch_row($stmt);
+var_dump(md5($row[0]));
+var_dump(strlen($row[0]));
+
+echo "Test 2 - test multi chunk fetch\n";
+
+$stmt = oci_parse ($c, "insert into phptestlng (id, filetxt) values (:id, :filetxt)");
+$i=2;
+$filetxt = str_repeat($filetxt, 600);
+
oci_bind_by_name( $stmt, ":id", $i, -1);
oci_bind_by_name( $stmt, ":filetxt", $filetxt, -1, SQLT_LNG);
oci_execute($stmt, OCI_DEFAULT);
oci_commit($c);
-$stmt = oci_parse($c, "SELECT filetxt FROM phptestlng");
+$stmt = oci_parse($c, "SELECT filetxt FROM phptestlng where id = 2");
oci_execute($stmt);
$row = oci_fetch_row($stmt);
@@ -36,6 +60,10 @@ echo "Done\n";
?>
--EXPECT--
+Test 1
string(32) "5c7c34abf7ea51936785062dbfcaeddc"
int(394)
+Test 2 - test multi chunk fetch
+string(32) "ee2e98b977341cfb8e037066e5fcb909"
+int(236400)
Done
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--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/bind_misccoltypes.phpt b/ext/oci8/tests/bind_misccoltypes.phpt
new file mode 100644
index 0000000000..0da8c8bf88
--- /dev/null
+++ b/ext/oci8/tests/bind_misccoltypes.phpt
@@ -0,0 +1,369 @@
+--TEST--
+Bind miscellaneous column types using default types
+--SKIPIF--
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+if (preg_match('/^1[012]\./', oci_client_version()) != 1) {
+ die("skip test expected to work only with Oracle 10g or greater version of client");
+}
+?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+
+ "alter session set nls_date_format = 'DD-MON-YY'",
+
+ "drop table bind_misccoltypes_tab",
+
+ "create table bind_misccoltypes_tab (
+ id number,
+ char_t char(1),
+ char_t10 char(10),
+ varchar2_t10 varchar2(10),
+ number_t number,
+ number_t92 number(9,2),
+ number_t6 number(6),
+ date_t date,
+ timestamp_t timestamp,
+ float_t float,
+ binary_float_t binary_float,
+ binary_double_t binary_double,
+ decimal_t decimal,
+ integer_t integer,
+ nchar_t nchar(10),
+ nvarchar2_t10 nvarchar2(10),
+ varchar_t10 varchar(10) )",
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+function check_col($c, $colname, $id)
+{
+ $s = oci_parse($c, "select $colname from bind_misccoltypes_tab where id = :id");
+ oci_bind_by_name($s, ":id", $id);
+ oci_execute($s);
+ oci_fetch_all($s, $r);
+ var_dump($r);
+}
+
+// Tests
+
+echo "\nTEST86 insert all ORATYPE values\n";
+
+$insert_sql = "INSERT INTO bind_misccoltypes_tab ( id, "
+ . " char_t, "
+ . " char_t10, "
+ . " varchar2_t10, "
+ . " number_t, "
+ . " number_t92, "
+ . " number_t6, "
+ . " date_t, "
+ . " timestamp_t, "
+ . " float_t, "
+ . " binary_float_t, "
+ . " binary_double_t, "
+ . " decimal_t, "
+ . " integer_t, "
+ . " nchar_t, "
+ . " nvarchar2_t10, "
+ . " varchar_t10) "
+ . " VALUES (:n1, "
+ . " :c1, "
+ . " :c2, "
+ . " :c3, "
+ . " :n2, "
+ . " :n3, "
+ . " :n4, "
+ . " to_date(:d1, 'YYYY-MM-DD HH24:MI:SS'), "
+ . " to_timestamp(:d1, 'YYYY-MM-DD HH24:MI:SS'), "
+ . " :n5, "
+ . " :n5, "
+ . " :n5, "
+ . " :n1, "
+ . " :n1, "
+ . " :c4, "
+ . " :c5, "
+ . " :c6) ";
+
+
+$n1 = "86";
+$c1 = "C";
+$c2 = "char10";
+$c3 = "varchar210";
+$n2 = "-123.456";
+$n3 = "789.346";
+$n4 = "123456.023";
+$n5 = "12345678901234567890123456789012345678.723";
+$d1 = "2010-03-29 13:09:15";
+$c4 = "nchar10";
+$c5 = "nvarchar2x";
+$c6 = "varchar";
+
+$s = oci_parse($c, $insert_sql);
+oci_bind_by_name($s, ":n1", $n1);
+oci_bind_by_name($s, ":c1", $c1);
+oci_bind_by_name($s, ":c2", $c2);
+oci_bind_by_name($s, ":c3", $c3);
+oci_bind_by_name($s, ":n2", $n2);
+oci_bind_by_name($s, ":n3", $n3);
+oci_bind_by_name($s, ":n4", $n4);
+oci_bind_by_name($s, ":d1", $d1);
+oci_bind_by_name($s, ":n5", $n5);
+oci_bind_by_name($s, ":c4", $c4);
+oci_bind_by_name($s, ":c5", $c5);
+oci_bind_by_name($s, ":c6", $c6);
+
+oci_execute($s);
+
+echo "\nTEST87 SELECT all values using DEFINEs\n";
+$select_sql = "select "
+ . "id, "
+ . "char_t, "
+ . "char_t10, "
+ . "varchar2_t10, "
+ . "number_t, "
+ . "number_t92, "
+ . "number_t6, "
+ . "date_t, "
+ . "timestamp_t, "
+ . "float_t, "
+ . "binary_float_t, "
+ . "binary_double_t, "
+ . "decimal_t, "
+ . "integer_t, "
+ . "nchar_t, "
+ . "nvarchar2_t10, "
+ . "varchar_t10 "
+ . "from bind_misccoltypes_tab where id = 86";
+
+$s = oci_parse($c, $select_sql);
+
+oci_define_by_name($s, "ID", $ID);
+oci_define_by_name($s, "CHAR_T", $CHAR_T);
+oci_define_by_name($s, "CHAR_T10", $CHAR_T10);
+oci_define_by_name($s, "VARCHAR2_T10", $VARCHAR2_T10);
+oci_define_by_name($s, "NUMBER_T", $NUMBER_T);
+oci_define_by_name($s, "NUMBER_T92", $NUMBER_T92);
+oci_define_by_name($s, "NUMBER_T6", $NUMBER_T6);
+oci_define_by_name($s, "DATE_T", $DATE_T);
+oci_define_by_name($s, "TIMESTAMP_T", $TIMESTAMP_T);
+oci_define_by_name($s, "FLOAT_T", $FLOAT_T);
+oci_define_by_name($s, "BINARY_FLOAT_T", $BINARY_FLOAT_T);
+oci_define_by_name($s, "BINARY_DOUBLE_T", $BINARY_DOUBLE_T);
+oci_define_by_name($s, "DECIMAL_T", $DECIMAL_T);
+oci_define_by_name($s, "INTEGER_T", $INTEGER_T);
+oci_define_by_name($s, "NCHAR_T", $NCHAR_T);
+oci_define_by_name($s, "NVARCHAR2_T10", $NVARCHAR2_T10);
+oci_define_by_name($s, "VARCHAR_T10", $VARCHAR_T10);
+
+oci_execute($s);
+
+while (oci_fetch($s)) {
+ echo "ID is " . "$ID\n";
+ echo "CHAR_T is " . "$CHAR_T\n";
+ echo "CHAR_T10 is " . "$CHAR_T10\n";
+ echo "VARCHAR2_T10 is " . "$VARCHAR2_T10\n";
+ echo "NUMBER_T is " . "$NUMBER_T\n";
+ echo "NUMBER_T92 is " . "$NUMBER_T92\n";
+ echo "NUMBER_T6 is " . "$NUMBER_T6\n";
+ echo "DATE_T is " . "$DATE_T\n";
+ echo "TIMESTAMP_T is " . "$TIMESTAMP_T\n";
+ echo "FLOAT_T is " . "$FLOAT_T\n";
+ echo "BINARY_FLOAT_T is " . "$BINARY_FLOAT_T\n";
+ echo "BINARY_DOUBLE_T is " . "$BINARY_DOUBLE_T\n";
+ echo "DECIMAL_T is " . "$DECIMAL_T\n";
+ echo "INTEGER_T is " . "$INTEGER_T\n";
+ echo "NCHAR_T is " . "$NCHAR_T\n";
+ echo "NVARCHAR2_T10 is " . "$NVARCHAR2_T10\n";
+ echo "VARCHAR_T10 is " . "$VARCHAR_T10\n";
+}
+
+echo "\nTEST52 insert numbers\n";
+
+$s = oci_parse($c, "INSERT INTO bind_misccoltypes_tab (id, number_t92) VALUES (52, :n1)");
+$n1 = 3;
+oci_bind_by_name($s, ":n1", $n1);
+oci_execute($s);
+
+check_col($c, 'number_t92', 52);
+
+
+echo "\nTEST53 insert numbers \n";
+
+$s = oci_parse($c, "INSERT INTO bind_misccoltypes_tab (id, number_t92) VALUES (53, :n1)");
+$n1 = 8.67;
+oci_bind_by_name($s, ":n1", $n1);
+oci_execute($s);
+
+check_col($c, 'number_t92', 53);
+
+
+echo "\nTEST54 insert numbers \n";
+
+$s = oci_parse($c, "INSERT INTO bind_misccoltypes_tab (id, number_t) VALUES (54, :n1)");
+$n1 = 4.67;
+oci_bind_by_name($s, ":n1", $n1);
+oci_execute($s);
+
+check_col($c, 'number_t', 54);
+
+echo "\nTEST55 insert numbers \n";
+
+$s = oci_parse($c, "INSERT INTO bind_misccoltypes_tab (id, number_t) VALUES (55, :n1)");
+$n1 = "7.67";
+oci_bind_by_name($s, ":n1", $n1);
+oci_execute($s);
+
+check_col($c, 'number_t', 55);
+
+echo "\nTEST56 insert numbers \n";
+
+$n1 = -5.67;
+
+$s = oci_parse($c, "INSERT INTO bind_misccoltypes_tab (id, number_t) VALUES (56, :n1)");
+oci_bind_by_name($s, ":n1", $n1);
+oci_execute($s);
+
+check_col($c, 'number_t', 56);
+
+echo "\nTEST58 insert a VARCHAR2\n";
+
+$s = oci_parse($c, "INSERT INTO bind_misccoltypes_tab (id, varchar2_t10) VALUES (58, :c2)");
+$c2 = "Hood";
+oci_bind_by_name($s, ":c2", $c2);
+oci_execute($s);
+
+check_col($c, 'varchar2_t10', 58);
+
+echo "\nTEST59 insert a VARCHAR2\n";
+
+$s = oci_parse($c, "INSERT INTO bind_misccoltypes_tab (id, char_t10) VALUES (59, :c2)");
+$c2 = "Hood";
+oci_bind_by_name($s, ":c2", $c2);
+oci_execute($s);
+
+check_col($c, 'char_t10', 59);
+
+echo "\nTEST60 insert a date\n";
+
+$s = oci_parse($c, "INSERT INTO bind_misccoltypes_tab (id, date_t) VALUES (60, to_date(:c2, 'YYYY-MM-DD'))");
+$c2 = '2010-04-09';
+oci_bind_by_name($s, ":c2", $c2);
+oci_execute($s);
+
+check_col($c, 'date_t', 60);
+
+
+// Clean up
+
+$stmtarray = array(
+ "drop table bind_misccoltypes_tab"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+oci_close($c);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+TEST86 insert all ORATYPE values
+
+TEST87 SELECT all values using DEFINEs
+ID is 86
+CHAR_T is C
+CHAR_T10 is char10
+VARCHAR2_T10 is varchar210
+NUMBER_T is -123.456
+NUMBER_T92 is 789.35
+NUMBER_T6 is 123456
+DATE_T is 29-MAR-10
+TIMESTAMP_T is 29-MAR-10 01.09.15.000000 PM
+FLOAT_T is 12345678901234567890123456789012345679
+BINARY_FLOAT_T is 1.23456784E+037
+BINARY_DOUBLE_T is 1.2345678901234568E+037
+DECIMAL_T is 86
+INTEGER_T is 86
+NCHAR_T is nchar10
+NVARCHAR2_T10 is nvarchar2x
+VARCHAR_T10 is varchar
+
+TEST52 insert numbers
+array(1) {
+ ["NUMBER_T92"]=>
+ array(1) {
+ [0]=>
+ string(1) "3"
+ }
+}
+
+TEST53 insert numbers
+array(1) {
+ ["NUMBER_T92"]=>
+ array(1) {
+ [0]=>
+ string(4) "8.67"
+ }
+}
+
+TEST54 insert numbers
+array(1) {
+ ["NUMBER_T"]=>
+ array(1) {
+ [0]=>
+ string(4) "4.67"
+ }
+}
+
+TEST55 insert numbers
+array(1) {
+ ["NUMBER_T"]=>
+ array(1) {
+ [0]=>
+ string(4) "7.67"
+ }
+}
+
+TEST56 insert numbers
+array(1) {
+ ["NUMBER_T"]=>
+ array(1) {
+ [0]=>
+ string(5) "-5.67"
+ }
+}
+
+TEST58 insert a VARCHAR2
+array(1) {
+ ["VARCHAR2_T10"]=>
+ array(1) {
+ [0]=>
+ string(4) "Hood"
+ }
+}
+
+TEST59 insert a VARCHAR2
+array(1) {
+ ["CHAR_T10"]=>
+ array(1) {
+ [0]=>
+ string(10) "Hood "
+ }
+}
+
+TEST60 insert a date
+array(1) {
+ ["DATE_T"]=>
+ array(1) {
+ [0]=>
+ string(9) "09-APR-10"
+ }
+}
+===DONE===
diff --git a/ext/oci8/tests/bind_misccoltypes_errs.phpt b/ext/oci8/tests/bind_misccoltypes_errs.phpt
new file mode 100644
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--
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+ "drop table bind_misccoltypes_errs_tab",
+
+ "create table bind_misccoltypes_errs_tab (
+ id number,
+ char_t char(1),
+ char_t10 char(10),
+ varchar2_t10 varchar2(10),
+ number_t number,
+ number_t92 number(9,2),
+ number_t6 number(6),
+ date_t date,
+ timestamp_t timestamp,
+ float_t float,
+ binary_float_t binary_float,
+ binary_double_t binary_double,
+ decimal_t decimal,
+ integer_t integer,
+ nchar_t nchar(10),
+ nvarchar2_t10 nvarchar2(10),
+ varchar_t10 varchar(10) )",
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+function check_col($c, $colname, $id)
+{
+ $s = oci_parse($c, "select $colname from bind_misccoltypes_errs_tab where id = :id");
+ oci_bind_by_name($s, ":id", $id);
+ oci_execute($s);
+ oci_fetch_all($s, $r);
+ var_dump($r);
+}
+
+// Tests
+
+echo "\nTest 1 insert numbers \n";
+
+$n1 = -23253245.3432467;
+
+$s = oci_parse($c, "INSERT INTO bind_misccoltypes_errs_tab (id, number_t6) VALUES (1, :n1)");
+oci_bind_by_name($s, ":n1", $n1);
+oci_execute($s);
+
+check_col($c, 'number_t6', 57);
+
+echo "\nTest 2 insert numbers \n";
+
+$n1 = "Hello";
+
+$s = oci_parse($c, "INSERT INTO bind_misccoltypes_errs_tab (id, number_t6) VALUES (2, :n1)");
+oci_bind_by_name($s, ":n1", $n1);
+oci_execute($s);
+
+check_col($c, 'number_t6', 57);
+
+echo "\nTest 3 - too long CHAR\n";
+
+$s = oci_parse($c, "INSERT INTO bind_misccoltypes_errs_tab (id, char_t) VALUES (3, :c2)");
+$c2 = "AB";
+oci_bind_by_name($s, ":c2", $c2, -1, SQLT_AFC);
+oci_execute($s);
+
+echo "\nTest 4 - too long VARCHAR2\n";
+
+$s = oci_parse($c, "INSERT INTO bind_misccoltypes_errs_tab (id, varchar2_t10) VALUES (4, :c2)");
+$c2 = "AAAAAAAAAAB";
+oci_bind_by_name($s, ":c2", $c2, -1, SQLT_AFC);
+oci_execute($s);
+
+echo "\nTest 5 - invalid number\n";
+
+$s = oci_parse($c, "INSERT INTO bind_misccoltypes_errs_tab (id, number_t) VALUES (5, :c2)");
+$c2 = "ABC";
+oci_bind_by_name($s, ":c2", $c2, -1, SQLT_AFC);
+oci_execute($s);
+
+echo "\nTest 6 - insert a VARCHAR2 with SQLT_BIN\n";
+
+$s = oci_parse($c, "INSERT INTO bind_misccoltypes_errs_tab (id, varchar2_t10) VALUES (6, :c2)");
+$c2 = "Hood 6";
+oci_bind_by_name($s, ":c2", $c2, -1, SQLT_BIN);
+oci_execute($s);
+
+check_col($c, 'varchar2_t10', 6);
+
+echo "\nTest 7 - insert a VARCHAR2 with SQLT_LBI\n";
+
+$s = oci_parse($c, "INSERT INTO bind_misccoltypes_errs_tab (id, varchar2_t10) VALUES (7, :c2)");
+$c2 = "Hood 7";
+oci_bind_by_name($s, ":c2", $c2, -1, SQLT_LBI);
+oci_execute($s);
+
+check_col($c, 'varchar2_t10', 7);
+
+
+// Clean up
+
+$stmtarray = array(
+ "drop table bind_misccoltypes_errs_tab"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+oci_close($c);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1 insert numbers
+
+Warning: oci_execute(): ORA-01438: %s in %sbind_misccoltypes_errs.php on line %d
+array(1) {
+ ["NUMBER_T6"]=>
+ array(0) {
+ }
+}
+
+Test 2 insert numbers
+
+Warning: oci_execute(): ORA-01722: %s in %sbind_misccoltypes_errs.php on line %d
+array(1) {
+ ["NUMBER_T6"]=>
+ array(0) {
+ }
+}
+
+Test 3 - too long CHAR
+
+Warning: oci_execute(): ORA-12899: %r(%s "%s"."BIND_MISCCOLTYPES_ERRS_TAB"."CHAR_T" \(%s: 2, %s: 1\)|String data right truncation)%r in %sbind_misccoltypes_errs.php on line %d
+
+Test 4 - too long VARCHAR2
+
+Warning: oci_execute(): ORA-12899: %r(%s "%s"."BIND_MISCCOLTYPES_ERRS_TAB"."VARCHAR2_T10" \(%s: 11, %s: 10\)|%s data right truncation)%r in %sbind_misccoltypes_errs.php on line %d
+
+Test 5 - invalid number
+
+Warning: oci_execute(): ORA-01722: %s in %sbind_misccoltypes_errs.php on line %d
+
+Test 6 - insert a VARCHAR2 with SQLT_BIN
+
+Warning: oci_execute(): ORA-12899: %r(%s "%s"."BIND_MISCCOLTYPES_ERRS_TAB"."VARCHAR2_T10" \(%s: 12, %s: 10\)|String data right truncation)%r in %sbind_misccoltypes_errs.php on line %d
+array(1) {
+ ["VARCHAR2_T10"]=>
+ array(0) {
+ }
+}
+
+Test 7 - insert a VARCHAR2 with SQLT_LBI
+
+Warning: oci_execute(): ORA-12899: %r(%s "%s"."BIND_MISCCOLTYPES_ERRS_TAB"."VARCHAR2_T10" \(%s: 12, %s: 10\)|String data right truncation)%r in %sbind_misccoltypes_errs.php on line %d
+array(1) {
+ ["VARCHAR2_T10"]=>
+ array(0) {
+ }
+}
+===DONE===
diff --git a/ext/oci8/tests/bind_number.phpt b/ext/oci8/tests/bind_number.phpt
new file mode 100644
index 0000000000..6412b5f82e
--- /dev/null
+++ b/ext/oci8/tests/bind_number.phpt
@@ -0,0 +1,220 @@
+--TEST--
+Bind with NUMBER column variants
+--SKIPIF--
+<?php
+if (!extension_loaded('oci8')) die("skip no oci8 extension");
+if (preg_match('/^1[012]\./', oci_client_version()) != 1) {
+ die("skip test expected to work only with Oracle 10g or greater version of client");
+}
+?>
+--INI--
+precision = 14
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+ "drop table bind_number_tab",
+ "create table bind_number_tab (
+ id number,
+ number_t6 number(6),
+ float_t float,
+ binary_float_t binary_float,
+ binary_double_t binary_double,
+ decimal_t decimal,
+ integer_t integer)"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+function check_col($c, $colname, $id)
+{
+ $s = oci_parse($c, "select $colname from bind_number_tab where id = :id");
+ oci_bind_by_name($s, ":id", $id);
+ oci_execute($s);
+ oci_fetch_all($s, $r);
+ var_dump($r);
+}
+
+// Run Test
+
+echo "Test 1 - invalid number\n";
+
+$s = oci_parse($c, "INSERT INTO bind_number_tab (id, number_t6) VALUES (1, :n1)");
+$n1 = "Hello";
+oci_bind_by_name($s, ":n1", $n1);
+oci_execute($s);
+
+check_col($c, "number_t6", 1);
+
+echo "\nTEST66 insert a float\n";
+
+$s = oci_parse($c, "INSERT INTO bind_number_tab (id, float_t) VALUES (66, :f1)");
+$f1 = 123.456;
+oci_bind_by_name($s, ":f1", $f1);
+oci_execute($s);
+
+check_col($c, 'float_t', 66);
+
+echo "\nTEST67 insert a binary float\n";
+
+$s = oci_parse($c, "INSERT INTO bind_number_tab (id, binary_float_t) VALUES (67, :f1)");
+$f1 = 567.456;
+oci_bind_by_name($s, ":f1", $f1);
+oci_execute($s);
+
+check_col($c, 'binary_float_t', 67);
+
+echo "\nTEST69 insert a binary double\n";
+
+$s = oci_parse($c, "INSERT INTO bind_number_tab (id, binary_double_t) VALUES (69, :f1)");
+$f1 = 567.456;
+oci_bind_by_name($s, ":f1", $f1);
+oci_execute($s);
+
+check_col($c, 'binary_double_t', 69);
+
+echo "\nTEST71 insert a decimal\n";
+
+$s = oci_parse($c, "INSERT INTO bind_number_tab (id, decimal_t) VALUES (71, :f1)");
+$f1 = 123.789;
+oci_bind_by_name($s, ":f1", $f1);
+oci_execute($s);
+
+check_col($c, 'decimal_t', 71);
+
+echo "\nTEST72 insert a decimal\n";
+
+$s = oci_parse($c, "INSERT INTO bind_number_tab (id, decimal_t) VALUES (72, :f1)");
+$f1 = 123.789;
+oci_bind_by_name($s, ":f1", $f1, -1, SQLT_NUM);
+oci_execute($s);
+
+check_col($c, 'decimal_t', 72);
+
+echo "\nTEST73 insert a double\n";
+
+$s = oci_parse($c, "INSERT INTO bind_number_tab (id, binary_double_t) VALUES (73, :f1)");
+$f1 = 483.589;
+oci_bind_by_name($s, ":f1", $f1);
+oci_execute($s);
+
+check_col($c, 'binary_double_t', 73);
+
+echo "\nTEST75 insert a INTEGER\n";
+
+$s = oci_parse($c, "INSERT INTO bind_number_tab (id, integer_t) VALUES (75, :f1)");
+$f1 = 589;
+oci_bind_by_name($s, ":f1", $f1);
+oci_execute($s);
+
+check_col($c, 'integer_t', 75);
+
+echo "\nTEST76 insert a INTEGER\n";
+
+$s = oci_parse($c, "INSERT INTO bind_number_tab (id, integer_t) VALUES (76, :f1)");
+$f1 = 42;
+oci_bind_by_name($s, ":f1", $f1, -1, SQLT_INT);
+oci_execute($s);
+
+check_col($c, 'integer_t', 76);
+
+
+// Clean up
+
+$stmtarray = array(
+ "drop table bind_number_tab"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1 - invalid number
+
+Warning: oci_execute(): ORA-01722: %s in %sbind_number.php on line %d
+array(1) {
+ ["NUMBER_T6"]=>
+ array(0) {
+ }
+}
+
+TEST66 insert a float
+array(1) {
+ ["FLOAT_T"]=>
+ array(1) {
+ [0]=>
+ string(7) "123.456"
+ }
+}
+
+TEST67 insert a binary float
+array(1) {
+ ["BINARY_FLOAT_T"]=>
+ array(1) {
+ [0]=>
+ string(%r15|8%r) "%r(5.67455994E\+002|567.4560)%r"
+ }
+}
+
+TEST69 insert a binary double
+array(1) {
+ ["BINARY_DOUBLE_T"]=>
+ array(1) {
+ [0]=>
+ string(%r23|16%r) "%r(5.6745600000000002E\+002|567.456000000000)%r"
+ }
+}
+
+TEST71 insert a decimal
+array(1) {
+ ["DECIMAL_T"]=>
+ array(1) {
+ [0]=>
+ string(3) "124"
+ }
+}
+
+TEST72 insert a decimal
+array(1) {
+ ["DECIMAL_T"]=>
+ array(1) {
+ [0]=>
+ string(1) "0"
+ }
+}
+
+TEST73 insert a double
+array(1) {
+ ["BINARY_DOUBLE_T"]=>
+ array(1) {
+ [0]=>
+ string(%r12|16%r) "%r(4.83589E\+002|483.589000000000)%r"
+ }
+}
+
+TEST75 insert a INTEGER
+array(1) {
+ ["INTEGER_T"]=>
+ array(1) {
+ [0]=>
+ string(3) "589"
+ }
+}
+
+TEST76 insert a INTEGER
+array(1) {
+ ["INTEGER_T"]=>
+ array(1) {
+ [0]=>
+ string(2) "42"
+ }
+}
+===DONE===
+
+
diff --git a/ext/oci8/tests/bind_query.phpt b/ext/oci8/tests/bind_query.phpt
new file mode 100644
index 0000000000..e4edc93299
--- /dev/null
+++ b/ext/oci8/tests/bind_query.phpt
@@ -0,0 +1,78 @@
+--TEST--
+Bind with various WHERE conditions
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+ "drop table bind_query_tab",
+ "create table bind_query_tab (empno number(4), ename varchar2(10), sal number(7,2))",
+ "insert into bind_query_tab values (7934, 'MILLER', 1300)",
+ "insert into bind_query_tab values (7902, 'FORD', 3000)"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+// Run Test
+
+echo "Test 1\n";
+
+$e = 7934;
+
+$s = oci_parse($c, "select ename from bind_query_tab where empno = :eno");
+oci_bind_by_name( $s, ":eno", $e, -1, SQLT_INT);
+oci_execute($s);
+var_dump(oci_fetch_row($s));
+
+echo "Test 2\n";
+
+$v = 1000;
+$s = oci_parse($c, 'select ename from bind_query_tab where sal > :v order by ename');
+oci_bind_by_name( $s, ":v", $v);
+oci_define_by_name($s, "ENAME", $ename, 20);
+oci_execute($s);
+while (oci_fetch($s)) {
+ var_dump($ename);
+}
+
+
+echo "Test 3\n";
+
+$s = oci_parse($c, 'select ename from bind_query_tab where sal > :v order by ename');
+oci_bind_by_name( $s, ":v", $v);
+$v = 2000;
+oci_define_by_name($s, "ENAME", $ename, 20);
+oci_execute($s);
+while (oci_fetch($s)) {
+ var_dump($ename);
+}
+
+
+// Clean up
+
+$stmtarray = array(
+ "drop table bind_query_tab"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1
+array(1) {
+ [0]=>
+ string(6) "MILLER"
+}
+Test 2
+string(4) "FORD"
+string(6) "MILLER"
+Test 3
+string(4) "FORD"
+===DONE===
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--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/bind_rowid.phpt b/ext/oci8/tests/bind_rowid.phpt
index f15d8f8bbb..122ad5e18e 100644
--- a/ext/oci8/tests/bind_rowid.phpt
+++ b/ext/oci8/tests/bind_rowid.phpt
@@ -17,17 +17,14 @@ function do_query($c)
}
}
-$stmts = array(
+$stmtarray = array(
"drop table rid_tab",
"create table rid_tab (id number, address varchar2(40))",
"insert into rid_tab (id, address) values (1, 'original text #1')",
"insert into rid_tab (id, address) values (2, 'original text #2')"
);
-foreach ($stmts as $q) {
- $s = oci_parse($c, $q);
- @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
echo "Initial Data\n";
do_query($c);
@@ -54,12 +51,11 @@ do_query($c);
// Cleanup
-$stmts = array("drop table rid_tab");
+$stmtarray = array(
+ "drop table rid_tab"
+);
-foreach ($stmts as $q) {
- $s = oci_parse($c, $q);
- @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
diff --git a/ext/oci8/tests/bind_sqltafc.phpt b/ext/oci8/tests/bind_sqltafc.phpt
new file mode 100644
index 0000000000..8d2ce2ae61
--- /dev/null
+++ b/ext/oci8/tests/bind_sqltafc.phpt
@@ -0,0 +1,208 @@
+--TEST--
+Bind tests with SQLT_AFC
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+ "drop table bind_sqltafc_tab",
+ "create table bind_sqltafc_tab (id number, char_t char(1), char_t10 char(10), varchar2_t10 varchar2(10), number_t number)",
+ "insert into bind_sqltafc_tab values (0, 'a', 'abcd', 'efghij', 1.1)"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+// Run Test
+
+function q($c, $id)
+{
+ $s = oci_parse($c, "select * from bind_sqltafc_tab where id = $id");
+ oci_execute($s);
+ oci_fetch_all($s, $r);
+ var_dump($r);
+}
+
+echo "Test 0 - base table creation without binds\n";
+
+q($c, 0);
+
+echo "\nTest 1 - successful insert\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltafc_tab (id, char_t, char_t10, varchar2_t10, number_t) VALUES (1, :c2, :c3, :c4, :c5)");
+$c2 = "H";
+$c3 = "AAAAAAAAAA"; // max length allowed in column
+$c4 = "BBBBBBBBBB"; // max length allowed in column
+$c5 = "123.45";
+oci_bind_by_name($s, ":c2", $c2, -1, SQLT_AFC);
+oci_bind_by_name($s, ":c3", $c3, -1, SQLT_AFC);
+oci_bind_by_name($s, ":c4", $c4, -1, SQLT_AFC);
+oci_bind_by_name($s, ":c5", $c5, -1, SQLT_AFC);
+oci_execute($s);
+
+q($c, 1);
+
+echo "\nTest 2 - Empty Strings\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltafc_tab (id, char_t, char_t10, varchar2_t10, number_t) VALUES (5, :c2, :c3, :c4, :c5)");
+$c2 = "";
+$c3 = "";
+$c4 = "";
+$c5 = "";
+oci_bind_by_name($s, ":c2", $c2, -1, SQLT_AFC);
+oci_bind_by_name($s, ":c3", $c3, -1, SQLT_AFC);
+oci_bind_by_name($s, ":c4", $c4, -1, SQLT_AFC);
+oci_bind_by_name($s, ":c5", $c5, -1, SQLT_AFC);
+oci_execute($s);
+
+q($c, 5);
+
+echo "\nTest 3 - NULLs\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltafc_tab (id, char_t, char_t10, varchar2_t10, number_t) VALUES (6, :c2, :c3, :c4, :c5)");
+$c2 = null;
+$c3 = null;
+$c4 = null;
+$c5 = null;
+oci_bind_by_name($s, ":c2", $c2, -1, SQLT_AFC);
+oci_bind_by_name($s, ":c3", $c3, -1, SQLT_AFC);
+oci_bind_by_name($s, ":c4", $c4, -1, SQLT_AFC);
+oci_bind_by_name($s, ":c5", $c5, -1, SQLT_AFC);
+oci_execute($s);
+
+q($c, 6);
+
+// Clean up
+
+$stmtarray = array(
+ "drop table bind_sqltafc_tab"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+oci_close($c);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 0 - base table creation without binds
+array(5) {
+ ["ID"]=>
+ array(1) {
+ [0]=>
+ string(1) "0"
+ }
+ ["CHAR_T"]=>
+ array(1) {
+ [0]=>
+ string(1) "a"
+ }
+ ["CHAR_T10"]=>
+ array(1) {
+ [0]=>
+ string(10) "abcd "
+ }
+ ["VARCHAR2_T10"]=>
+ array(1) {
+ [0]=>
+ string(6) "efghij"
+ }
+ ["NUMBER_T"]=>
+ array(1) {
+ [0]=>
+ string(3) "1.1"
+ }
+}
+
+Test 1 - successful insert
+array(5) {
+ ["ID"]=>
+ array(1) {
+ [0]=>
+ string(1) "1"
+ }
+ ["CHAR_T"]=>
+ array(1) {
+ [0]=>
+ string(1) "H"
+ }
+ ["CHAR_T10"]=>
+ array(1) {
+ [0]=>
+ string(10) "AAAAAAAAAA"
+ }
+ ["VARCHAR2_T10"]=>
+ array(1) {
+ [0]=>
+ string(10) "BBBBBBBBBB"
+ }
+ ["NUMBER_T"]=>
+ array(1) {
+ [0]=>
+ string(6) "123.45"
+ }
+}
+
+Test 2 - Empty Strings
+array(5) {
+ ["ID"]=>
+ array(1) {
+ [0]=>
+ string(1) "5"
+ }
+ ["CHAR_T"]=>
+ array(1) {
+ [0]=>
+ NULL
+ }
+ ["CHAR_T10"]=>
+ array(1) {
+ [0]=>
+ NULL
+ }
+ ["VARCHAR2_T10"]=>
+ array(1) {
+ [0]=>
+ NULL
+ }
+ ["NUMBER_T"]=>
+ array(1) {
+ [0]=>
+ NULL
+ }
+}
+
+Test 3 - NULLs
+array(5) {
+ ["ID"]=>
+ array(1) {
+ [0]=>
+ string(1) "6"
+ }
+ ["CHAR_T"]=>
+ array(1) {
+ [0]=>
+ NULL
+ }
+ ["CHAR_T10"]=>
+ array(1) {
+ [0]=>
+ NULL
+ }
+ ["VARCHAR2_T10"]=>
+ array(1) {
+ [0]=>
+ NULL
+ }
+ ["NUMBER_T"]=>
+ array(1) {
+ [0]=>
+ NULL
+ }
+}
+===DONE===
diff --git a/ext/oci8/tests/bind_sqltchr_1.phpt b/ext/oci8/tests/bind_sqltchr_1.phpt
new file mode 100644
index 0000000000..aabf9bda5c
--- /dev/null
+++ b/ext/oci8/tests/bind_sqltchr_1.phpt
@@ -0,0 +1,228 @@
+--TEST--
+Bind with SQLT_CHR
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+ "drop table bind_sqltchr_tab",
+
+ "create table bind_sqltchr_tab (
+ id number,
+ varchar2_t10 varchar2(10),
+ number_t number,
+ number_t92 number(9,2))"
+
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+function check_col($c, $colname, $id)
+{
+ $s = oci_parse($c, "select $colname from bind_sqltchr_tab where id = :id");
+ oci_bind_by_name($s, ":id", $id);
+ oci_execute($s);
+ oci_fetch_all($s, $r);
+ var_dump($r);
+}
+
+// Run Test
+
+echo "\nTEST241 bind SQLT_CHR\n";
+
+$c2 = "Hood241";
+$s = oci_parse($c, "INSERT INTO bind_sqltchr_tab (id, varchar2_t10) VALUES (241, :c2)");
+oci_bind_by_name($s, ":c2", $c2, -1, SQLT_CHR);
+oci_execute($s);
+
+check_col($c, 'varchar2_t10', 241);
+
+
+echo "\nTEST242 insert numbers SQLT_CHR\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltchr_tab (id, number_t) VALUES (242, :n1)");
+$n1 = 42;
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_CHR);
+oci_execute($s);
+
+check_col($c, 'number_t', 242);
+
+echo "\nTEST243 insert numbers, SQLT_CHR\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltchr_tab (id, number_t) VALUES (243, :n1)");
+$n1 = 42.69;
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_CHR);
+oci_execute($s);
+
+check_col($c, 'number_t', 243);
+
+echo "\nTEST244 insert numbers with SQLT_CHR\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltchr_tab (id, number_t) VALUES (244, :n1)");
+$n1 = 0;
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_CHR);
+oci_execute($s);
+
+check_col($c, 'number_t', 244);
+
+echo "\nTEST245 insert numbers with SQLT_CHR\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltchr_tab (id, number_t) VALUES (245, :n1)");
+$n1 = -23;
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_CHR);
+oci_execute($s);
+
+check_col($c, 'number_t', 245);
+
+echo "\nTEST246 insert numbers\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltchr_tab (id, number_t) VALUES (246, :n1)");
+$n1 = "-23";
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_CHR);
+oci_execute($s);
+
+check_col($c, 'number_t', 246);
+
+echo "\nTEST247 insert numbers with SQLT_CHR\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltchr_tab (id, number_t) VALUES (247, :n1)");
+$n1 = "23";
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_CHR);
+oci_execute($s);
+
+check_col($c, 'number_t', 247);
+
+echo "\nTEST248 insert numbers with SQLT_CHR\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltchr_tab (id, number_t92) VALUES (248, :n1)");
+$n1 = 123.56;
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_CHR);
+oci_execute($s);
+
+check_col($c, 'number_t92', 248);
+
+echo "\nTEST249 insert numbers with SQLT_CHR\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltchr_tab (id, number_t92) VALUES (249, :n1)");
+$n1 = "123.56";
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_CHR);
+oci_execute($s);
+
+check_col($c, 'number_t92', 249);
+
+echo "\nTEST250 insert numbers with SQLT_CHR\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltchr_tab (id, number_t92) VALUES (250, :n1)");
+$n1 = "";
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_CHR);
+oci_execute($s);
+
+check_col($c, 'number_t92', 250);
+
+// Clean up
+
+$stmtarray = array(
+ "drop table bind_sqltchr_tab"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+TEST241 bind SQLT_CHR
+array(1) {
+ ["VARCHAR2_T10"]=>
+ array(1) {
+ [0]=>
+ string(7) "Hood241"
+ }
+}
+
+TEST242 insert numbers SQLT_CHR
+array(1) {
+ ["NUMBER_T"]=>
+ array(1) {
+ [0]=>
+ string(2) "42"
+ }
+}
+
+TEST243 insert numbers, SQLT_CHR
+array(1) {
+ ["NUMBER_T"]=>
+ array(1) {
+ [0]=>
+ string(5) "42.69"
+ }
+}
+
+TEST244 insert numbers with SQLT_CHR
+array(1) {
+ ["NUMBER_T"]=>
+ array(1) {
+ [0]=>
+ string(1) "0"
+ }
+}
+
+TEST245 insert numbers with SQLT_CHR
+array(1) {
+ ["NUMBER_T"]=>
+ array(1) {
+ [0]=>
+ string(3) "-23"
+ }
+}
+
+TEST246 insert numbers
+array(1) {
+ ["NUMBER_T"]=>
+ array(1) {
+ [0]=>
+ string(3) "-23"
+ }
+}
+
+TEST247 insert numbers with SQLT_CHR
+array(1) {
+ ["NUMBER_T"]=>
+ array(1) {
+ [0]=>
+ string(2) "23"
+ }
+}
+
+TEST248 insert numbers with SQLT_CHR
+array(1) {
+ ["NUMBER_T92"]=>
+ array(1) {
+ [0]=>
+ string(6) "123.56"
+ }
+}
+
+TEST249 insert numbers with SQLT_CHR
+array(1) {
+ ["NUMBER_T92"]=>
+ array(1) {
+ [0]=>
+ string(6) "123.56"
+ }
+}
+
+TEST250 insert numbers with SQLT_CHR
+array(1) {
+ ["NUMBER_T92"]=>
+ array(1) {
+ [0]=>
+ NULL
+ }
+}
+===DONE===
diff --git a/ext/oci8/tests/bind_sqltchr_2.phpt b/ext/oci8/tests/bind_sqltchr_2.phpt
new file mode 100644
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--
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+ "create or replace procedure bind_sqltchr_proc (msg_in in varchar2, msg_out out varchar2)
+ as
+ begin
+ msg_out := upper(msg_in);
+ end;"
+
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+// Run Test
+
+echo "Test 1 - PL/SQL IN and OUT variables\n";
+
+$stmt = oci_parse($c, "BEGIN bind_sqltchr_proc(:a, :b); END;");
+$msg_in = "Cat got your keyboard?";
+oci_bind_by_name($stmt, ":a", $msg_in, -1, SQLT_CHR);
+oci_bind_by_name($stmt, ":b", $msg_out, 800, SQLT_CHR);
+oci_execute($stmt);
+var_dump($msg_in);
+var_dump($msg_out);
+
+// Clean up
+
+$stmtarray = array(
+ "drop procedure bind_sqltchr_proc"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1 - PL/SQL IN and OUT variables
+string(22) "Cat got your keyboard?"
+string(22) "CAT GOT YOUR KEYBOARD?"
+===DONE===
diff --git a/ext/oci8/tests/bind_sqltint.phpt b/ext/oci8/tests/bind_sqltint.phpt
new file mode 100644
index 0000000000..f01791d3b1
--- /dev/null
+++ b/ext/oci8/tests/bind_sqltint.phpt
@@ -0,0 +1,227 @@
+--TEST--
+Bind with SQLT_INT
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+ "drop table bind_sqltint_tab",
+
+ "create table bind_sqltint_tab (
+ id number,
+ varchar2_t10 varchar2(10),
+ number_t number,
+ number_t92 number(9,2))",
+
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+function check_col($c, $colname, $id)
+{
+ $s = oci_parse($c, "select $colname from bind_sqltint_tab where id = :id");
+ oci_bind_by_name($s, ":id", $id);
+ oci_execute($s);
+ oci_fetch_all($s, $r);
+ var_dump($r);
+}
+
+// Run Test
+
+echo "\nTEST141 wrong bind type SQLT_INT\n";
+
+$c2 = "Hood141";
+$s = oci_parse($c, "INSERT INTO bind_sqltint_tab (id, varchar2_t10) VALUES (141, :c2)");
+oci_bind_by_name($s, ":c2", $c2, -1, SQLT_INT);
+oci_execute($s);
+
+check_col($c, 'varchar2_t10', 141);
+
+echo "\nTEST142 insert numbers SQLT_INT\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltint_tab (id, number_t) VALUES (142, :n1)");
+$n1 = 42;
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_INT);
+oci_execute($s);
+
+check_col($c, 'number_t', 142);
+
+echo "\nTEST143 insert numbers, SQLT_INT\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltint_tab (id, number_t) VALUES (143, :n1)");
+$n1 = 42.69;
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_INT);
+oci_execute($s);
+
+check_col($c, 'number_t', 143);
+
+echo "\nTEST144 insert numbers with SQLT_INT\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltint_tab (id, number_t) VALUES (144, :n1)");
+$n1 = 0;
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_INT);
+oci_execute($s);
+
+check_col($c, 'number_t', 144);
+
+echo "\nTEST145 insert numbers with SQLT_INT\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltint_tab (id, number_t) VALUES (145, :n1)");
+$n1 = -23;
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_INT);
+oci_execute($s);
+
+check_col($c, 'number_t', 145);
+
+echo "\nTEST146 insert numbers\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltint_tab (id, number_t) VALUES (146, :n1)");
+$n1 = "-23";
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_INT);
+oci_execute($s);
+
+check_col($c, 'number_t', 146);
+
+echo "\nTEST147 insert numbers with SQLT_INT\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltint_tab (id, number_t) VALUES (147, :n1)");
+$n1 = "23";
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_INT);
+oci_execute($s);
+
+check_col($c, 'number_t', 147);
+
+echo "\nTEST148 insert numbers with SQLT_INT\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltint_tab (id, number_t92) VALUES (148, :n1)");
+$n1 = 123.56;
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_INT);
+oci_execute($s);
+
+check_col($c, 'number_t92', 148);
+
+echo "\nTEST149 insert numbers with SQLT_INT\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltint_tab (id, number_t92) VALUES (149, :n1)");
+$n1 = "123.56";
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_INT);
+oci_execute($s);
+
+check_col($c, 'number_t92', 149);
+
+echo "\nTEST150 insert numbers with SQLT_INT\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltint_tab (id, number_t92) VALUES (150, :n1)");
+$n1 = "";
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_INT);
+oci_execute($s);
+
+check_col($c, 'number_t92', 150);
+
+// Clean up
+
+$stmtarray = array(
+ "drop table bind_sqltint_tab"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+TEST141 wrong bind type SQLT_INT
+array(1) {
+ ["VARCHAR2_T10"]=>
+ array(1) {
+ [0]=>
+ string(1) "0"
+ }
+}
+
+TEST142 insert numbers SQLT_INT
+array(1) {
+ ["NUMBER_T"]=>
+ array(1) {
+ [0]=>
+ string(2) "42"
+ }
+}
+
+TEST143 insert numbers, SQLT_INT
+array(1) {
+ ["NUMBER_T"]=>
+ array(1) {
+ [0]=>
+ string(2) "42"
+ }
+}
+
+TEST144 insert numbers with SQLT_INT
+array(1) {
+ ["NUMBER_T"]=>
+ array(1) {
+ [0]=>
+ string(1) "0"
+ }
+}
+
+TEST145 insert numbers with SQLT_INT
+array(1) {
+ ["NUMBER_T"]=>
+ array(1) {
+ [0]=>
+ string(3) "-23"
+ }
+}
+
+TEST146 insert numbers
+array(1) {
+ ["NUMBER_T"]=>
+ array(1) {
+ [0]=>
+ string(3) "-23"
+ }
+}
+
+TEST147 insert numbers with SQLT_INT
+array(1) {
+ ["NUMBER_T"]=>
+ array(1) {
+ [0]=>
+ string(2) "23"
+ }
+}
+
+TEST148 insert numbers with SQLT_INT
+array(1) {
+ ["NUMBER_T92"]=>
+ array(1) {
+ [0]=>
+ string(3) "123"
+ }
+}
+
+TEST149 insert numbers with SQLT_INT
+array(1) {
+ ["NUMBER_T92"]=>
+ array(1) {
+ [0]=>
+ string(3) "123"
+ }
+}
+
+TEST150 insert numbers with SQLT_INT
+array(1) {
+ ["NUMBER_T92"]=>
+ array(1) {
+ [0]=>
+ string(1) "0"
+ }
+}
+===DONE===
diff --git a/ext/oci8/tests/bind_sqltnum.phpt b/ext/oci8/tests/bind_sqltnum.phpt
new file mode 100644
index 0000000000..d3828b73ee
--- /dev/null
+++ b/ext/oci8/tests/bind_sqltnum.phpt
@@ -0,0 +1,278 @@
+--TEST--
+Bind with SQLT_NUM
+--SKIPIF--
+<?php
+if (!extension_loaded('oci8')) die("skip no oci8 extension");
+if (preg_match('/^1[012]\./', oci_client_version()) != 1) {
+ die("skip test expected to work only with Oracle 10g or greater version of client");
+}
+?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+ "drop table bind_sqltnum_tab",
+
+ "create table bind_sqltnum_tab (
+ id number,
+ varchar2_t10 varchar2(10),
+ number_t number,
+ number_t92 number(9,2))"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+function check_col($c, $colname, $id)
+{
+ $s = oci_parse($c, "select $colname from bind_sqltnum_tab where id = :id");
+ oci_bind_by_name($s, ":id", $id);
+ oci_execute($s);
+ oci_fetch_all($s, $r);
+ var_dump($r);
+}
+
+
+// Run Test
+
+echo "Test 1 - baseline test\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltnum_tab (id, varchar2_t10) VALUES (100, :c2)");
+$c2 = "Hood";
+$r = oci_bind_by_name($s, ":c2", $c2, -1);
+if (!$r) {
+ $e = oci_error($s);
+ var_dump($e);
+}
+$r = oci_execute($s, OCI_DEFAULT);
+if (!$r) {
+ $e = oci_error($s);
+ var_dump($e);
+}
+
+$s = oci_parse($c, "select id, varchar2_t10 from bind_sqltnum_tab");
+oci_execute($s);
+oci_fetch_all($s, $data);
+var_dump($data);
+
+echo "Test 2 - SQLT_NUM to a VARCHAR2 column\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltnum_tab (id, varchar2_t10) VALUES (100, :c2)");
+$c2 = "Hood";
+$r = oci_bind_by_name($s, ":c2", $c2, -1, SQLT_NUM);
+if (!$r) {
+ $e = oci_error($s);
+ var_dump($e['message']);
+}
+$r = oci_execute($s, OCI_DEFAULT);
+if (!$r) {
+ $e = oci_error($s);
+ var_dump($e['message']);
+}
+
+echo "\nTEST41 wrong bind type SQLT_NUM\n";
+
+$c2 = "Hood41";
+$s = oci_parse($c, "INSERT INTO bind_sqltnum_tab (id, varchar2_t10) VALUES (41, :c2)");
+oci_bind_by_name($s, ":c2", $c2, -1, SQLT_NUM);
+oci_execute($s);
+
+echo "\nTEST42 insert numbers SQLT_NUM\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltnum_tab (id, number_t) VALUES (42, :n1)");
+$n1 = 42;
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_NUM);
+oci_execute($s);
+
+check_col($c, 'number_t', 42);
+
+echo "\nTEST43 insert numbers SQLT_NUM\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltnum_tab (id, number_t) VALUES (43, :n1)");
+$n1 = 42.69;
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_NUM);
+oci_execute($s);
+
+check_col($c, 'number_t', 43);
+
+echo "\nTEST44\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltnum_tab (id, number_t) VALUES (44, :n1)");
+$n1 = 0;
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_NUM);
+oci_execute($s);
+
+check_col($c, 'number_t', 44);
+
+echo "\nTEST45\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltnum_tab (id, number_t) VALUES (45, :n1)");
+$n1 = -23;
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_NUM);
+oci_execute($s);
+
+check_col($c, 'number_t', 45);
+
+echo "\nTEST46 insert numbers\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltnum_tab (id, number_t) VALUES (46, :n1)");
+$n1 = "-23";
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_NUM);
+oci_execute($s);
+
+check_col($c, 'number_t', 46);
+
+echo "\nTEST47\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltnum_tab (id, number_t) VALUES (47, :n1)");
+$n1 = "23";
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_NUM);
+oci_execute($s);
+
+check_col($c, 'number_t', 47);
+
+echo "\nTEST48\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltnum_tab (id, number_t92) VALUES (48, :n1)");
+$n1 = 123.56;
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_NUM);
+oci_execute($s);
+
+check_col($c, 'number_t92', 48);
+
+echo "\nTEST49\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltnum_tab (id, number_t92) VALUES (49, :n1)");
+$n1 = "123.56";
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_NUM);
+oci_execute($s);
+
+check_col($c, 'number_t92', 49);
+
+echo "\nTEST50\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltnum_tab (id, number_t92) VALUES (50, :n1)");
+$n1 = "";
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_NUM);
+oci_execute($s);
+
+check_col($c, 'number_t92', 50);
+
+// Clean up
+
+$stmtarray = array(
+ "drop table bind_sqltnum_tab"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1 - baseline test
+array(2) {
+ ["ID"]=>
+ array(1) {
+ [0]=>
+ string(3) "100"
+ }
+ ["VARCHAR2_T10"]=>
+ array(1) {
+ [0]=>
+ string(4) "Hood"
+ }
+}
+Test 2 - SQLT_NUM to a VARCHAR2 column
+
+Warning: oci_execute(): ORA-12899: %s (%s: 40, %s: 10) in %sbind_sqltnum.php on line %d
+string(%d) "ORA-12899: %s"
+
+TEST41 wrong bind type SQLT_NUM
+
+Warning: oci_execute(): ORA-12899: %s "%s"."BIND_SQLTNUM_TAB"."VARCHAR2_T10" (%s: 40, %s: 10) in %sbind_sqltnum.php on line %d
+
+TEST42 insert numbers SQLT_NUM
+array(1) {
+ ["NUMBER_T"]=>
+ array(1) {
+ [0]=>
+ NULL
+ }
+}
+
+TEST43 insert numbers SQLT_NUM
+array(1) {
+ ["NUMBER_T"]=>
+ array(1) {
+ [0]=>
+ NULL
+ }
+}
+
+TEST44
+array(1) {
+ ["NUMBER_T"]=>
+ array(1) {
+ [0]=>
+ string(127) "-000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
+ }
+}
+
+TEST45
+array(1) {
+ ["NUMBER_T"]=>
+ array(1) {
+ [0]=>
+ NULL
+ }
+}
+
+TEST46 insert numbers
+array(1) {
+ ["NUMBER_T"]=>
+ array(1) {
+ [0]=>
+ NULL
+ }
+}
+
+TEST47
+array(1) {
+ ["NUMBER_T"]=>
+ array(1) {
+ [0]=>
+ NULL
+ }
+}
+
+TEST48
+array(1) {
+ ["NUMBER_T92"]=>
+ array(1) {
+ [0]=>
+ string(1) "0"
+ }
+}
+
+TEST49
+array(1) {
+ ["NUMBER_T92"]=>
+ array(1) {
+ [0]=>
+ string(1) "0"
+ }
+}
+
+TEST50
+
+Warning: oci_execute(): ORA-01438: %s in %sbind_sqltnum.php on line %d
+array(1) {
+ ["NUMBER_T92"]=>
+ array(0) {
+ }
+}
+===DONE===
diff --git a/ext/oci8/tests/bind_unsupported_1.phpt b/ext/oci8/tests/bind_unsupported_1.phpt
new file mode 100644
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--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// These types are defined in oci8.c
+
+$types = array(
+ "SQLT_AVC" => SQLT_AVC,
+ "SQLT_STR" => SQLT_STR,
+ "SQLT_VCS" => SQLT_VCS,
+ "SQLT_AVC" => SQLT_AVC,
+ "SQLT_STR" => SQLT_STR,
+ "SQLT_LVC" => SQLT_LVC,
+ "SQLT_FLT" => SQLT_FLT,
+ "SQLT_UIN" => SQLT_UIN,
+ "SQLT_ODT" => SQLT_ODT,
+);
+
+foreach ($types as $t => $v) {
+
+ echo "Test - $t\n";
+
+ $s = oci_parse($c, "select * from dual where dummy = :c1");
+ $c1 = "Doug";
+ oci_bind_by_name($s, ":c1", $c1, -1, $v);
+}
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test - SQLT_AVC
+
+Warning: oci_bind_by_name(): Unknown or unsupported datatype given: 97 in %sbind_unsupported_1.php on line %d
+Test - SQLT_STR
+
+Warning: oci_bind_by_name(): Unknown or unsupported datatype given: 5 in %sbind_unsupported_1.php on line %d
+Test - SQLT_VCS
+
+Warning: oci_bind_by_name(): Unknown or unsupported datatype given: 9 in %sbind_unsupported_1.php on line %d
+Test - SQLT_LVC
+
+Warning: oci_bind_by_name(): Unknown or unsupported datatype given: 94 in %sbind_unsupported_1.php on line %d
+Test - SQLT_FLT
+
+Warning: oci_bind_by_name(): Unknown or unsupported datatype given: 4 in %sbind_unsupported_1.php on line %d
+Test - SQLT_UIN
+
+Warning: oci_bind_by_name(): Unknown or unsupported datatype given: 68 in %sbind_unsupported_1.php on line %d
+Test - SQLT_ODT
+
+Warning: oci_bind_by_name(): Unknown or unsupported datatype given: 156 in %sbind_unsupported_1.php on line %d
+===DONE===
diff --git a/ext/oci8/tests/bind_unsupported_2.phpt b/ext/oci8/tests/bind_unsupported_2.phpt
new file mode 100644
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--
+<?php
+if (!extension_loaded('oci8')) die("skip no oci8 extension");
+if (preg_match('/^1[01]\./', oci_client_version()) !== 1) {
+ die ("skip expected output only valid for Oracle 10g+ clients");
+}
+?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+$types = array(
+ "SQLT_BDOUBLE" => SQLT_BDOUBLE,
+ "SQLT_BFLOAT" => SQLT_BFLOAT,
+);
+
+foreach ($types as $t => $v) {
+
+ echo "Test - $t\n";
+
+ $s = oci_parse($c, "select * from dual where dummy = :c1");
+ $c1 = "Doug";
+ oci_bind_by_name($s, ":c1", $c1, -1, $v);
+}
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test - SQLT_BDOUBLE
+
+Warning: oci_bind_by_name(): Unknown or unsupported datatype given: 22 in %sbind_unsupported_2.php on line %d
+Test - SQLT_BFLOAT
+
+Warning: oci_bind_by_name(): Unknown or unsupported datatype given: 21 in %sbind_unsupported_2.php on line %d
+===DONE===
diff --git a/ext/oci8/tests/bind_unsupported_3.phpt b/ext/oci8/tests/bind_unsupported_3.phpt
new file mode 100644
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--
+<?php
+$target_dbs = array('oracledb' => false, 'timesten' => true); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+$types = array(
+ "SQLT_CLOB" => SQLT_CLOB,
+ "SQLT_BLOB" => SQLT_BLOB,
+ "OCI_B_CLOB" => OCI_B_CLOB,
+ "OCI_B_BLOB" => OCI_B_BLOB,
+);
+
+foreach ($types as $t => $v) {
+
+ echo "Test - $t\n";
+
+ $s = oci_parse($c, "select * from dual where dummy = :c1");
+ $c1 = "Doug";
+ oci_bind_by_name($s, ":c1", $c1, -1, $v);
+}
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test - SQLT_CLOB
+
+Warning: oci_bind_by_name(): Unable to find descriptor property in %sbind_unsupported_3.php on line %d
+Test - SQLT_BLOB
+
+Warning: oci_bind_by_name(): Unable to find descriptor property in %sbind_unsupported_3.php on line %d
+Test - OCI_B_CLOB
+
+Warning: oci_bind_by_name(): Unable to find descriptor property in %sbind_unsupported_3.php on line %d
+Test - OCI_B_BLOB
+
+Warning: oci_bind_by_name(): Unable to find descriptor property in %sbind_unsupported_3.php on line %d
+===DONE===
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)
<?php
if (!extension_loaded('oci8')) die ("skip no oci8 extension");
require(dirname(__FILE__)."/connect.inc");
-$sv = oci_server_version($c);
-$sv = preg_match('/Release 1[01]\.2\./', $sv, $matches);
-if ($sv !== 1) {
- die ("skip expected output only valid when using Oracle 19gR2 or 11gR2 databases");
-} else {
- ob_start();
- phpinfo(INFO_MODULES);
- $phpinfo = ob_get_clean();
- $iv = preg_match('/Oracle .*Version => 1[1]\./', $phpinfo);
- if ($iv != 1) {
- die ("skip test expected to work only with Oracle 11g or greater version of client");
- }
+if (preg_match('/Release 1[01]\.2\./', oci_server_version($c), $matches) !== 1) {
+ die("skip expected output only valid when using Oracle 10gR2 or 11gR2 databases");
+} else if (preg_match('/^11\./', oci_client_version()) != 1) {
+ die("skip test expected to work only with Oracle 11g or greater version of client");
}
?>
--FILE--
<?php
-require dirname(__FILE__).'/connect.inc';
+require(dirname(__FILE__).'/connect.inc');
-$create_st = array();
-$create_st[] = "drop sequence myseq";
-$create_st[] = "drop table mytab";
-$create_st[] = "create sequence myseq";
-$create_st[] = "create table mytab (mydata varchar2(20), seqcol number)";
+$stmtarray = array(
+ "drop sequence myseq",
+ "drop table mytab",
+ "create sequence myseq",
+ "create table mytab (mydata varchar2(20), seqcol number)"
+);
-foreach ($create_st as $statement) {
- $stmt = oci_parse($c, $statement);
- @oci_execute($stmt);
-}
+oci8_test_sql_execute($c, $stmtarray);
define('MYLIMIT', 200);
@@ -52,14 +42,12 @@ for ($i = 1; $i < MYLIMIT; $i++) {
OCICommit($c);
-$drop_st = array();
-$drop_st[] = "drop sequence myseq";
-$drop_st[] = "drop table mytab";
+$stmtarray = array(
+ "drop sequence myseq",
+ "drop table mytab"
+);
-foreach ($create_st as $statement) {
- $stmt = oci_parse($c, $statement);
- oci_execute($stmt);
-}
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
?>
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--
<?php
-require dirname(__FILE__).'/connect.inc';
-
-$create_st = array();
-$create_st[] = "drop sequence myseq";
-$create_st[] = "drop table mytab";
-$create_st[] = "create sequence myseq";
-$create_st[] = "create table mytab (mydata varchar2(20), seqcol number)";
+require(dirname(__FILE__).'/connect.inc');
-foreach ($create_st as $statement) {
- $stmt = oci_parse($c, $statement);
- @oci_execute($stmt);
-}
+$stmtarray = array(
+ "drop sequence myseq",
+ "drop table mytab",
+ "create sequence myseq",
+ "create table mytab (mydata varchar2(20), seqcol number)"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
define('MYLIMIT', 200);
@@ -44,14 +42,12 @@ for ($i = 1; $i < MYLIMIT; $i++) {
OCICommit($c);
-$drop_st = array();
-$drop_st[] = "drop sequence myseq";
-$drop_st[] = "drop table mytab";
+$stmtarray = array(
+ "drop sequence myseq",
+ "drop table mytab"
+);
-foreach ($create_st as $statement) {
- $stmt = oci_parse($c, $statement);
- oci_execute($stmt);
-}
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
?>
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)
<?php
if (!extension_loaded('oci8')) die ("skip no oci8 extension");
require(dirname(__FILE__)."/connect.inc");
-$sv = oci_server_version($c);
-$sv = preg_match('/Release 1[01]\.2\./', $sv, $matches);
-if ($sv !== 1) {
- die ("skip expected output only valid when using Oracle 10gR2 or 11gR2 database");
-} else {
- ob_start();
- phpinfo(INFO_MODULES);
- $phpinfo = ob_get_clean();
- $iv = preg_match('/Oracle .*Version => 1[1]\./', $phpinfo);
- if ($iv != 1) {
- die ("skip test expected to work only with Oracle 11g or greater version of client");
- }
+if (preg_match('/Release 1[01]\.2\./', oci_server_version($c), $matches) !== 1) {
+ die("skip expected output only valid when using Oracle 10gR2 or 11gR2 databases");
+} else if (preg_match('/^11\./', oci_client_version()) != 1) {
+ die("skip test expected to work only with Oracle 11g or greater version of client");
}
?>
--FILE--
@@ -23,16 +15,14 @@ if ($sv !== 1) {
require dirname(__FILE__).'/connect.inc';
-$create_st = array();
-$create_st[] = "drop sequence myseq";
-$create_st[] = "drop table mytab";
-$create_st[] = "create sequence myseq";
-$create_st[] = "create table mytab (mydata varchar2(20), seqcol number)";
+$stmtarray = array(
+ "drop sequence myseq",
+ "drop table mytab",
+ "create sequence myseq",
+ "create table mytab (mydata varchar2(20), seqcol number)"
+);
-foreach ($create_st as $statement) {
- $stmt = oci_parse($c, $statement);
- oci_execute($stmt);
-}
+oci8_test_sql_execute($c, $stmtarray);
define('MYLIMIT', 200);
define('INITMYBV', 11);
@@ -54,14 +44,12 @@ for ($i = 1; $i < MYLIMIT; $i++) {
OCICommit($c);
-$drop_st = array();
-$drop_st[] = "drop sequence myseq";
-$drop_st[] = "drop table mytab";
+$stmtarray = array(
+ "drop sequence myseq",
+ "drop table mytab"
+);
-foreach ($create_st as $statement) {
- $stmt = oci_parse($c, $statement);
- oci_execute($stmt);
-}
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
?>
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)
<?php
if (!extension_loaded('oci8')) die ("skip no oci8 extension");
require(dirname(__FILE__)."/connect.inc");
-$sv = oci_server_version($c);
-$sv = preg_match('/Release 1[01]\.2\./', $sv, $matches);
-if ($sv !== 1) {
- die ("skip expected output only valid when using Oracle 10gR2 or 11gR2 databases");
-} else {
- ob_start();
- phpinfo(INFO_MODULES);
- $phpinfo = ob_get_clean();
- $iv = preg_match('/Oracle .*Version => 1[1]\./', $phpinfo);
- if ($iv != 1) {
- die ("skip test expected to work only with Oracle 11g or greater version of client");
- }
+if (preg_match('/Release 1[01]\.2\./', oci_server_version($c), $matches) !== 1) {
+ die("skip expected output only valid when using Oracle 10gR2 or 11gR2 databases");
+} else if (preg_match('/^11\./', oci_client_version()) != 1) {
+ die("skip test expected to work only with Oracle 11g or greater version of client");
}
?>
--FILE--
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--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
@@ -13,18 +16,7 @@ $stmtarray = array(
"create or replace type bug32325_t as table of number"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- $r = @oci_execute($s);
- if (!$r) {
- $m = oci_error($s);
- if (!in_array($m['code'], array( // ignore expected errors
- 942 // table or view does not exist
- ))) {
- echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
- }
- }
-}
+oci8_test_sql_execute($c, $stmtarray);
// Run test
@@ -49,10 +41,7 @@ $stmtarray = array(
"drop type bug32325_t"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
?>
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--
-<?php if (!extension_loaded("oci8")) print "skip"; ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/bug36010.phpt b/ext/oci8/tests/bug36010.phpt
index d451f3f2f4..d181046871 100644
--- a/ext/oci8/tests/bug36010.phpt
+++ b/ext/oci8/tests/bug36010.phpt
@@ -1,7 +1,10 @@
--TEST--
Bug #36010 (Crash when executing SQL statment with lob parameter twice)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/bug36096.phpt b/ext/oci8/tests/bug36096.phpt
index 44b3a6ddca..2ec366b46a 100644
--- a/ext/oci8/tests/bug36096.phpt
+++ b/ext/oci8/tests/bug36096.phpt
@@ -20,9 +20,9 @@ if(oci_execute($stmt, OCI_COMMIT_ON_SUCCESS)){
echo "Done\n";
?>
---EXPECT--
+--EXPECTF--
bool(false)
bool(false)
-string(5) "'ABC'"
+string(%r[53]%r) "%r('ABC'|EXP)%r"
string(4) "CHAR"
Done
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--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+<?php
+if (!extension_loaded('oci8')) die ("skip no oci8 extension");
+if (preg_match('/^1[01]\./', oci_client_version()) != 1) {
+ die("skip expected output only valid with Oracle 10g or greater version of client");
+}
+?>
--FILE--
<?php
@@ -14,21 +19,7 @@ $stmtarray = array(
"create table bug36403_tab (c1 number, col2 number, column3 number, col4 number)"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- $r = @oci_execute($s);
- if (!$r) {
- $m = oci_error($s);
- if (!in_array($m['code'], array( // ignore expected errors
- 942 // table or view does not exist
- , 2289 // sequence does not exist
- , 4080 // trigger does not exist
- , 38802 // edition does not exist
- ))) {
- echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
- }
- }
-}
+oci8_test_sql_execute($c, $stmtarray);
// Run Test
@@ -48,18 +39,11 @@ $row = oci_fetch_array($s);
// Clean up
-//require(dirname(__FILE__).'/drop_table.inc');
-
$stmtarray = array(
"drop table bug36403_tab"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
-
-oci_close($c);
+oci8_test_sql_execute($c, $stmtarray);
?>
===DONE===
@@ -72,5 +56,5 @@ COL2
C1
Test 2
-Warning: oci_fetch_array(): ORA-24338: %sbug36403.php on line %d
+Warning: oci_fetch_array(): ORA-%r(24338|01002)%r: %sbug36403.php on line %d
===DONE===
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--
-<?php if (!extension_loaded("oci8")) print "skip"; ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
@@ -14,10 +17,7 @@ $stmtarray = array(
"insert into bug37220_tab values(xmltype('<THETAG myID=\"1234\"></THETAG>'))"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
// Now let's update the row where myId = 1234 and change the tag
// 'THETAG' to 'MYTAG' (mycolumn is an XMLTYPE datatype and
@@ -54,10 +54,7 @@ $stmtarray = array(
"drop table bug37220_tab"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
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--
-<?php if (!extension_loaded("oci8")) print "skip"; ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/bug38173.phpt b/ext/oci8/tests/bug38173.phpt
index b92df9e39e..901f6f7bfc 100644
--- a/ext/oci8/tests/bug38173.phpt
+++ b/ext/oci8/tests/bug38173.phpt
@@ -1,7 +1,10 @@
--TEST--
Bug #38173 (Freeing nested cursors causes OCI8 to segfault)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/bug40078.phpt b/ext/oci8/tests/bug40078.phpt
index 4a234e176d..4070221ee9 100644
--- a/ext/oci8/tests/bug40078.phpt
+++ b/ext/oci8/tests/bug40078.phpt
@@ -1,7 +1,10 @@
--TEST--
Bug #40078 (ORA-01405 when fetching NULL values using oci_bind_array_by_name())
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/bug40415.phpt b/ext/oci8/tests/bug40415.phpt
index 1ebc249d38..fcccfe716f 100644
--- a/ext/oci8/tests/bug40415.phpt
+++ b/ext/oci8/tests/bug40415.phpt
@@ -1,7 +1,10 @@
--TEST--
Bug #40415 (Using oci_fetchall with nested cursors)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/bug41069.phpt b/ext/oci8/tests/bug41069.phpt
index b3a1b9969c..5daa46d6f1 100644
--- a/ext/oci8/tests/bug41069.phpt
+++ b/ext/oci8/tests/bug41069.phpt
@@ -2,8 +2,8 @@
Bug #41069 (Oracle crash with certain data over a DB-link when prefetch memory limit used - Oracle bug 6039623)
--SKIPIF--
<?php
-if (!extension_loaded('oci8')) die ("skip no oci8 extension");
-require(dirname(__FILE__).'/details.inc');
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
if (empty($dbase)) die ("skip requires network connection alias for DB link loopback");
if ($test_drcp) die("skip DRCP does not support shared database links");
?>
@@ -50,12 +50,9 @@ $stmtarray = array(
"insert into bug41069_tab (c1, c2, c3, c4, c5, c6, c7, c9, c10, c12, c15) values
(113, 'aaaaaaa', 'bbbbbbbbbb', 'cccccc', 'e', 'f', 'dddd', '12/04/2006', '12/04/2006', 2224, 'zzzzzzz')"
- );
+);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
// Run Tests
@@ -79,14 +76,9 @@ $c = oci_new_connect($user, $password, $dbase);
$stmtarray = array(
"drop database link bug41069_dblink",
"drop table bug41069_tab"
- );
-
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
+);
-oci_close($c);
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
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--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/bug42173.phpt b/ext/oci8/tests/bug42173.phpt
index 501ed75cd0..d5e2f70c19 100644
--- a/ext/oci8/tests/bug42173.phpt
+++ b/ext/oci8/tests/bug42173.phpt
@@ -1,7 +1,10 @@
--TEST--
Bug #42173 (TIMESTAMP and INTERVAL query and field functions)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/bug42496_1.phpt b/ext/oci8/tests/bug42496_1.phpt
index 4d7e2c5852..abf6cc8c75 100644
--- a/ext/oci8/tests/bug42496_1.phpt
+++ b/ext/oci8/tests/bug42496_1.phpt
@@ -1,7 +1,11 @@
--TEST--
Bug #42496 (LOB fetch leaks cursors, eventually failing with ORA-1000 maximum open cursors reached)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+if ($stress_test !== true) die ('skip Slow test not run when $stress_test is FALSE');
+?>
--FILE--
<?php
@@ -17,10 +21,7 @@ $stmtarray = array(
"INSERT INTO bug42496_tab VALUES('test3', 'test3')"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
// Run Test
@@ -48,12 +49,7 @@ $stmtarray = array(
"DROP table bug42496_tab"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- @oci_execute($s);
-}
-
-oci_close($c);
+oci8_test_sql_execute($c, $stmtarray);
?>
--EXPECTF--
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--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+if ($stress_test !== true) die ('skip Slow test not run when $stress_test is FALSE');
+?>
--FILE--
<?php
@@ -17,10 +21,7 @@ $stmtarray = array(
"INSERT INTO bug42496_tab VALUES('test3', 'test3')"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
// Run Test
@@ -46,12 +47,7 @@ $stmtarray = array(
"DROP table bug42496_tab"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- @oci_execute($s);
-}
-
-oci_close($c);
+oci8_test_sql_execute($c, $stmtarray);
?>
--EXPECTF--
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--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--INI--
oci8.statement_cache_size=20
--FILE--
@@ -15,97 +18,94 @@ $c = oci_connect($user, $password, $dbase);
// Initialization
$stmtarray = array(
- "create or replace procedure bug42841_proc(out_1 out sys_refcursor) is
+ "create or replace procedure bug42841_proc(out_1 out sys_refcursor) is
begin
- open out_1 for select 11 from dual union all select 12 from dual union all select 13 from dual;
+ open out_1 for select 11 from dual union all select 12 from dual union all select 13 from dual;
end bug42841_proc;",
- "create or replace package bug43449_pkg is
- type cursortype is ref Cursor;
- function testcursor return cursortype;
- end bug43449_pkg;",
-
- "create or replace package body bug43449_pkg is
- function testcursor return cursortype is
- retCursor cursorType;
- begin
- Open retCursor For 'select * from dual';
- return retCursor;
- end;
- end bug43449_pkg;"
+ "create or replace package bug43449_pkg is
+ type cursortype is ref Cursor;
+ function testcursor return cursortype;
+ end bug43449_pkg;",
+
+ "create or replace package body bug43449_pkg is
+ function testcursor return cursortype is
+ retCursor cursorType;
+ begin
+ Open retCursor For 'select * from dual';
+ return retCursor;
+ end;
+ end bug43449_pkg;"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
// Main code
function do_bug42841($c)
{
- echo "First attempt\n";
-
- $sql = "BEGIN bug42841_proc(:cursor); END;";
- $stmt = oci_parse($c, $sql);
- $cursor = oci_new_cursor($c);
- oci_bind_by_name($stmt, ":cursor", $cursor, -1, OCI_B_CURSOR);
-
- oci_execute($stmt, OCI_DEFAULT);
- oci_execute($cursor);
-
- while($row = oci_fetch_array($cursor, OCI_ASSOC + OCI_RETURN_LOBS)) {
- $data1[] = $row;
- }
-
- oci_free_statement($stmt);
- oci_free_statement($cursor);
- var_dump($data1);
-
- echo "Second attempt\n";
-
- $sql = "BEGIN bug42841_proc(:cursor); END;";
- $stmt = oci_parse($c, $sql);
- $cursor = oci_new_cursor($c);
- oci_bind_by_name($stmt, ":cursor", $cursor, -1, OCI_B_CURSOR);
-
- oci_execute($stmt, OCI_DEFAULT);
- oci_execute($cursor);
-
- while($row = oci_fetch_array($cursor, OCI_ASSOC + OCI_RETURN_LOBS)) {
- $data2[] = $row;
- }
-
- oci_free_statement($stmt);
- oci_free_statement($cursor);
- var_dump($data2);
+ echo "First attempt\n";
+
+ $sql = "BEGIN bug42841_proc(:cursor); END;";
+ $stmt = oci_parse($c, $sql);
+ $cursor = oci_new_cursor($c);
+ oci_bind_by_name($stmt, ":cursor", $cursor, -1, OCI_B_CURSOR);
+
+ oci_execute($stmt, OCI_DEFAULT);
+ oci_execute($cursor);
+
+ while($row = oci_fetch_array($cursor, OCI_ASSOC + OCI_RETURN_LOBS)) {
+ $data1[] = $row;
+ }
+
+ oci_free_statement($stmt);
+ oci_free_statement($cursor);
+ var_dump($data1);
+
+ echo "Second attempt\n";
+
+ $sql = "BEGIN bug42841_proc(:cursor); END;";
+ $stmt = oci_parse($c, $sql);
+ $cursor = oci_new_cursor($c);
+ oci_bind_by_name($stmt, ":cursor", $cursor, -1, OCI_B_CURSOR);
+
+ oci_execute($stmt, OCI_DEFAULT);
+ oci_execute($cursor);
+
+ while($row = oci_fetch_array($cursor, OCI_ASSOC + OCI_RETURN_LOBS)) {
+ $data2[] = $row;
+ }
+
+ oci_free_statement($stmt);
+ oci_free_statement($cursor);
+ var_dump($data2);
}
function do_bug43449($c)
{
- for ($i = 0; $i < 2; $i++) {
- var_dump(bug43449_getCur($c));
- }
+ for ($i = 0; $i < 2; $i++) {
+ var_dump(bug43449_getCur($c));
+ }
}
function bug43449_getCur($c)
-{
- $cur = oci_new_cursor($c);
- $stmt = oci_parse($c, 'begin :cur := bug43449_pkg.testcursor; end;');
- oci_bind_by_name($stmt, ':cur', $cur, -1, OCI_B_CURSOR);
- oci_execute($stmt, OCI_DEFAULT);
- oci_execute($cur, OCI_DEFAULT);
-
- $ret = array();
-
- while (ocifetchinto($cur, $row, OCI_ASSOC)) {
- $ret[] = $row;
- }
-
- oci_free_statement($cur);
- oci_free_statement($stmt);
- return $ret;
+{
+ $cur = oci_new_cursor($c);
+ $stmt = oci_parse($c, 'begin :cur := bug43449_pkg.testcursor; end;');
+ oci_bind_by_name($stmt, ':cur', $cur, -1, OCI_B_CURSOR);
+ oci_execute($stmt, OCI_DEFAULT);
+ oci_execute($cur, OCI_DEFAULT);
+
+ $ret = array();
+
+ while (ocifetchinto($cur, $row, OCI_ASSOC)) {
+ $ret[] = $row;
+ }
+
+ oci_free_statement($cur);
+ oci_free_statement($stmt);
+ return $ret;
}
echo "Test bug 42841: Procedure with OUT cursor parameter\n";
@@ -119,14 +119,11 @@ do_bug43449($c);
// Cleanup
$stmtarray = array(
- "drop procedure bug42841_proc",
- "drop package bug43449_pkg"
+ "drop procedure bug42841_proc",
+ "drop package bug43449_pkg"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
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--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
@@ -22,10 +25,7 @@ $stmtarray = array(
"INSERT INTO bug43492_tab VALUES ('J')"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
/*
@@ -66,12 +66,7 @@ $stmtarray = array(
"DROP table bug43492_tab"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- @oci_execute($s);
-}
-
-oci_close($c);
+oci8_test_sql_execute($c, $stmtarray);
?>
--EXPECT--
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--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
@@ -26,10 +29,7 @@ $stmtarray = array(
"INSERT INTO bug43492_tab VALUES ('J')"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
function fetch($c, $i) {
$s = ociparse($c, 'select cursor(select * from bug43492_tab) c from bug43492_tab');
@@ -57,12 +57,7 @@ $stmtarray = array(
"DROP table bug43492_tab"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- @oci_execute($s);
-}
-
-oci_close($c);
+oci8_test_sql_execute($c, $stmtarray);
?>
--EXPECT--
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--
<?php
-if (!extension_loaded('oci8')) die ("skip no oci8 extension");
-ob_start();
-phpinfo(INFO_MODULES);
-$phpinfo = ob_get_clean();
-$ov = preg_match('/Oracle Version => 9/', $phpinfo);
-if ($ov === 1) {
- die ("skip expected output only valid for Oracle clients from 10g onwards");
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+if ($stress_test !== true) die ('skip Slow test not run when $stress_test is FALSE');
+if (preg_match('/^1[01]\./', oci_client_version()) != 1) {
+ die("skip expected output only valid with Oracle 10g or greater version of client");
}
?>
--FILE--
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--
-<?php
-if (!extension_loaded('oci8')) die ("skip no oci8 extension");
-ob_start();
-phpinfo(INFO_MODULES);
-$phpinfo = ob_get_clean();
-$ov = preg_match('/Oracle Version => 9.2/', $phpinfo);
-if ($ov !== 1) {
- die ("skip expected output only valid for Oracle 9.2 clients");
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+if ($stress_test !== true) die ('skip Slow test not run when $stress_test is FALSE');
+if (preg_match('/Unknown/', oci_client_version()) != 1) {
+ die("skip expected output only valid with Oracle 9gR2 clients");
}
?>
--FILE--
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--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
@@ -15,10 +18,7 @@ $stmtarray = array(
end;"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
// Run Test
@@ -39,12 +39,7 @@ $stmtarray = array(
"drop procedure bug44008_proc"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
-
-oci_close($c);
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
diff --git a/ext/oci8/tests/bug44113.phpt b/ext/oci8/tests/bug44113.phpt
index eee21c3aef..aa4f2bb8e7 100644
--- a/ext/oci8/tests/bug44113.phpt
+++ b/ext/oci8/tests/bug44113.phpt
@@ -2,8 +2,8 @@
Bug #44113 (New collection creation can fail with OCI-22303)
--SKIPIF--
<?php
-if (!extension_loaded('oci8')) die ("skip no oci8 extension");
-require(dirname(__FILE__).'/details.inc');
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
if ($stress_test !== true) die ('skip Slow test not run when $stress_test is FALSE');
?>
--FILE--
@@ -17,10 +17,7 @@ $stmtarray = array(
"create or replace type bug44113_list_t as table of number"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
// Run Test
// The test can take some time to complete and can exceed PHP's test
@@ -41,12 +38,7 @@ $stmtarray = array(
"drop type bug44113_list_t"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
-
-oci_close($c);
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
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--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/bug45458.phpt b/ext/oci8/tests/bug45458.phpt
index b1dc7720ce..b257f1fc09 100644
--- a/ext/oci8/tests/bug45458.phpt
+++ b/ext/oci8/tests/bug45458.phpt
@@ -11,14 +11,14 @@ require(dirname(__FILE__).'/connect.inc');
echo "Test 1\n";
-$stmt = 'select dummy "a", dummy "20" from dual';
+$stmt = 'select dummy "A", dummy "20" from dual';
$s = oci_parse($c, $stmt);
oci_execute($s);
$r = oci_fetch_all($s, $data, 0, -1, OCI_FETCHSTATEMENT_BY_ROW);
var_dump($data);
var_dump($data[0]);
-var_dump($data[0]["a"]);
+var_dump($data[0]["A"]);
var_dump($data[0]["20"]);
oci_free_statement($s);
@@ -28,9 +28,9 @@ $s = oci_parse($c, $stmt);
oci_execute($s);
$r = oci_fetch_all($s, $data, 0, -1, OCI_ASSOC);
var_dump($data);
-var_dump($data["a"]);
+var_dump($data["A"]);
var_dump($data["20"]);
-var_dump($data["a"][0]);
+var_dump($data["A"][0]);
var_dump($data["20"][0]);
oci_free_statement($s);
@@ -44,14 +44,14 @@ Test 1
array(1) {
[0]=>
array(2) {
- ["a"]=>
+ ["A"]=>
string(1) "X"
[20]=>
string(1) "X"
}
}
array(2) {
- ["a"]=>
+ ["A"]=>
string(1) "X"
[20]=>
string(1) "X"
@@ -60,7 +60,7 @@ string(1) "X"
string(1) "X"
Test 2
array(2) {
- ["a"]=>
+ ["A"]=>
array(1) {
[0]=>
string(1) "X"
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--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
@@ -22,10 +25,7 @@ $stmtarray = array(
end bug46994_proc2;"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
// Run Test
@@ -64,10 +64,7 @@ $stmtarray = array(
"drop procedure bug46994_proc2"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
oci_close($c);
diff --git a/ext/oci8/tests/bug47189.phpt b/ext/oci8/tests/bug47189.phpt
index 073b410fcd..c82d2cd73b 100644
--- a/ext/oci8/tests/bug47189.phpt
+++ b/ext/oci8/tests/bug47189.phpt
@@ -1,12 +1,17 @@
--TEST--
Bug #47189 (Multiple oci_fetch_all calls)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs: different error handling for this undefined behavior
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
require(dirname(__FILE__).'/connect.inc');
+echo "Test 1\n";
+
$s = oci_parse($c, "select * from dual");
oci_execute($s);
oci_fetch_all($s, $rs, 0, -1, OCI_FETCHSTATEMENT_BY_ROW);
@@ -14,6 +19,8 @@ var_dump($rs);
oci_fetch_all($s, $rs1, 0, -1, OCI_FETCHSTATEMENT_BY_ROW);
var_dump($rs1);
+echo "Test 2\n";
+
$s = oci_parse($c, "select * from dual");
oci_execute($s);
oci_fetch_all($s, $rs, 0, 1, OCI_FETCHSTATEMENT_BY_ROW);
@@ -25,6 +32,7 @@ var_dump($rs1);
===DONE===
<?php exit(0); ?>
--EXPECTF--
+Test 1
array(1) {
[0]=>
array(1) {
@@ -34,6 +42,7 @@ array(1) {
}
array(0) {
}
+Test 2
array(1) {
[0]=>
array(1) {
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--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--ENV--
NLS_LANG=.AL32UTF8
--FILE--
@@ -19,21 +22,7 @@ $stmtarray = array(
end;"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- $r = @oci_execute($s);
- if (!$r) {
- $m = oci_error($s);
- if (!in_array($m['code'], array( // ignore expected errors
- 942 // table or view does not exist
- , 2289 // sequence does not exist
- , 4080 // trigger does not exist
- , 38802 // edition does not exist
- ))) {
- echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
- }
- }
-}
+oci8_test_sql_execute($c, $stmtarray);
// Run Test
@@ -54,13 +43,10 @@ echo $php_errormsg. "\n";
// Clean up
$stmtarray = array(
- "drop procedure bug47281_sp"
+ "drop procedure bug47281_sp"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
?>
===DONE===
diff --git a/ext/oci8/tests/bug47281_tt.phpt b/ext/oci8/tests/bug47281_tt.phpt
new file mode 100644
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--
+<?php
+$target_dbs = array('oracledb' => false, 'timesten' => true); // test runs on these DBs: shorter message length in TimesTen
+require(dirname(__FILE__).'/skipif.inc');
+?>
+--ENV--
+NLS_LANG=.AL32UTF8
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+ "create or replace procedure bug47281_sp as
+ begin
+ raise_application_error(-20000,
+ 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaBcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccDeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeFggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggghhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhIjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjKlllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllM');
+ end;"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+// Run Test
+
+echo "Test 1\n";
+
+$s = oci_parse($c, 'begin bug47281_sp; end;');
+$r = @oci_execute($s);
+
+if (!$r) {
+ $m = oci_error($s);
+ echo $m['message'], "\n";
+}
+
+echo "Test 2\n";
+
+echo $php_errormsg. "\n";
+
+// Clean up
+
+$stmtarray = array(
+ "drop procedure bug47281_sp"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1
+ORA-57000: TT8507: ORA-20000: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+Test 2
+oci_execute(): ORA-57000: TT8507: ORA-20000: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+===DONE===
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--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/bug51291.phpt b/ext/oci8/tests/bug51291_1.phpt
index 75851d63b1..789b94ea05 100644
--- a/ext/oci8/tests/bug51291.phpt
+++ b/ext/oci8/tests/bug51291_1.phpt
@@ -138,26 +138,6 @@ if (!$r) {
var_dump(oci_error(), oci_error($c), oci_error($s));
}
-echo "\nTest 10 - Execute - after successful 2nd query with same statement\n";
-
-$s = oci_parse($c, "declare e exception; begin if :bv = 1 then raise e; end if; end;");
-$bv = 1;
-oci_bind_by_name($s, ":bv", $bv);
-$r = @oci_execute($s, OCI_DEFAULT);
-if (!$r) {
- var_dump(oci_error(), oci_error($c), oci_error($s));
- $bv = 0;
- $r = oci_execute($s, OCI_DEFAULT);
- echo "Execute status is ";
- if (is_null($r)) echo "null";
- else if ($r === false) echo "false";
- else if ($r === true) echo "true";
- else echo $r;
- echo "\n";
- echo "2nd call after successful execute\n";
- var_dump(oci_error(), oci_error($c), oci_error($s));
-}
-
?>
===DONE===
<?php exit(0); ?>
@@ -187,7 +167,7 @@ array(4) {
Test 2 - Parse
-Warning: oci_error() expects parameter 1 to be resource, boolean given in %sbug51291.php on line %d
+Warning: oci_error() expects parameter 1 to be resource, boolean given in %sbug51291_1.php on line %d
bool(false)
array(4) {
["code"]=>
@@ -202,7 +182,7 @@ array(4) {
NULL
2nd call
-Warning: oci_error() expects parameter 1 to be resource, boolean given in %sbug51291.php on line %d
+Warning: oci_error() expects parameter 1 to be resource, boolean given in %sbug51291_1.php on line %d
bool(false)
array(4) {
["code"]=>
@@ -221,9 +201,9 @@ array(4) {
["code"]=>
int(904)
["message"]=>
- string(45) "ORA-00904: "DOESNOTEXIST": %s"
+ string(%d) "ORA-00904:%sDOESNOTEXIST%s"
["offset"]=>
- int(7)
+ int(%d)
["sqltext"]=>
string(29) "select doesnotexist from dual"
}
@@ -232,9 +212,9 @@ array(4) {
["code"]=>
int(904)
["message"]=>
- string(45) "ORA-00904: "DOESNOTEXIST": %s"
+ string(%d) "ORA-00904:%sDOESNOTEXIST%s"
["offset"]=>
- int(7)
+ int(%d)
["sqltext"]=>
string(29) "select doesnotexist from dual"
}
@@ -246,9 +226,9 @@ array(4) {
["code"]=>
int(904)
["message"]=>
- string(45) "ORA-00904: "DOESNOTEXIST": %s"
+ string(%d) "ORA-00904:%sDOESNOTEXIST%s"
["offset"]=>
- int(7)
+ int(%d)
["sqltext"]=>
string(29) "select doesnotexist from dual"
}
@@ -259,9 +239,9 @@ array(4) {
["code"]=>
int(904)
["message"]=>
- string(45) "ORA-00904: "DOESNOTEXIST": %s"
+ string(%d) "ORA-00904:%sDOESNOTEXIST%s"
["offset"]=>
- int(7)
+ int(%d)
["sqltext"]=>
string(29) "select doesnotexist from dual"
}
@@ -273,9 +253,9 @@ array(4) {
["code"]=>
int(904)
["message"]=>
- string(45) "ORA-00904: "DOESNOTEXIST": %s"
+ string(%d) "ORA-00904:%sDOESNOTEXIST%s"
["offset"]=>
- int(7)
+ int(%d)
["sqltext"]=>
string(29) "select doesnotexist from dual"
}
@@ -287,9 +267,9 @@ array(4) {
["code"]=>
int(904)
["message"]=>
- string(45) "ORA-00904: "DOESNOTEXIST": %s"
+ string(%d) "ORA-00904:%sDOESNOTEXIST%s"
["offset"]=>
- int(7)
+ int(%d)
["sqltext"]=>
string(29) "select doesnotexist from dual"
}
@@ -301,9 +281,9 @@ array(4) {
["code"]=>
int(904)
["message"]=>
- string(45) "ORA-00904: "DOESNOTEXIST": %s"
+ string(%d) "ORA-00904:%sDOESNOTEXIST%s"
["offset"]=>
- int(7)
+ int(%d)
["sqltext"]=>
string(29) "select doesnotexist from dual"
}
@@ -315,9 +295,9 @@ array(4) {
["code"]=>
int(904)
["message"]=>
- string(45) "ORA-00904: "DOESNOTEXIST": %s"
+ string(%d) "ORA-00904:%sDOESNOTEXIST%s"
["offset"]=>
- int(7)
+ int(%d)
["sqltext"]=>
string(29) "select doesnotexist from dual"
}
@@ -330,9 +310,9 @@ array(4) {
["code"]=>
int(904)
["message"]=>
- string(45) "ORA-00904: "DOESNOTEXIST": %s"
+ string(%d) "ORA-00904:%sDOESNOTEXIST%s"
["offset"]=>
- int(7)
+ int(%d)
["sqltext"]=>
string(29) "select doesnotexist from dual"
}
@@ -349,14 +329,14 @@ array(4) {
["code"]=>
int(904)
["message"]=>
- string(45) "ORA-00904: "DOESNOTEXIST": %s"
+ string(%d) "ORA-00904:%sDOESNOTEXIST%s"
["offset"]=>
- int(7)
+ int(%d)
["sqltext"]=>
string(29) "select doesnotexist from dual"
}
-Warning: oci_execute(): ORA-00904: "REALLYNOTHERE": %s in %sbug51291.php on line %d
+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)
@@ -365,9 +345,9 @@ array(4) {
["code"]=>
int(904)
["message"]=>
- string(45) "ORA-00904: "DOESNOTEXIST": %s"
+ string(%d) "ORA-00904:%sDOESNOTEXIST%s"
["offset"]=>
- int(7)
+ int(%d)
["sqltext"]=>
string(29) "select doesnotexist from dual"
}
@@ -375,9 +355,9 @@ array(4) {
["code"]=>
int(904)
["message"]=>
- string(46) "ORA-00904: "REALLYNOTHERE": %s"
+ string(%d) "ORA-00904%sREALLYNOTHERE%s"
["offset"]=>
- int(7)
+ int(%d)
["sqltext"]=>
string(30) "select reallynothere from dual"
}
@@ -389,14 +369,14 @@ array(4) {
["code"]=>
int(904)
["message"]=>
- string(45) "ORA-00904: "DOESNOTEXIST": %s"
+ string(%d) "ORA-00904:%sDOESNOTEXIST%s"
["offset"]=>
- int(7)
+ int(%d)
["sqltext"]=>
string(29) "select doesnotexist from dual"
}
-Warning: oci_execute(): ORA-00904: "REALLYNOTHERE": %s in %sbug51291.php on line %d
+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)
@@ -405,30 +385,10 @@ array(4) {
["code"]=>
int(904)
["message"]=>
- string(46) "ORA-00904: "REALLYNOTHERE": %s"
+ string(%d) "ORA-00904%sREALLYNOTHERE%s"
["offset"]=>
- int(7)
+ int(%d)
["sqltext"]=>
string(30) "select reallynothere from dual"
}
-
-Test 10 - 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/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--
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs: different error messages from TimesTen
+require(dirname(__FILE__).'/skipif.inc');
+?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+echo "\nTest 1 - Execute - after successful 2nd query with same statement\n";
+
+$s = oci_parse($c, "declare e exception; begin if :bv = 1 then raise e; end if; end;");
+$bv = 1;
+oci_bind_by_name($s, ":bv", $bv);
+$r = @oci_execute($s, OCI_DEFAULT);
+if (!$r) {
+ var_dump(oci_error(), oci_error($c), oci_error($s));
+ $bv = 0;
+ $r = oci_execute($s, OCI_DEFAULT);
+ echo "Execute status is ";
+ if (is_null($r)) echo "null";
+ else if ($r === false) echo "false";
+ else if ($r === true) echo "true";
+ else echo $r;
+ echo "\n";
+ echo "2nd call after successful execute\n";
+ var_dump(oci_error(), oci_error($c), oci_error($s));
+}
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1 - Execute - after successful 2nd query with same statement
+bool(false)
+bool(false)
+array(4) {
+ ["code"]=>
+ int(6510)
+ ["message"]=>
+ string(72) "ORA-06510: PL/SQL: %s
+ORA-06512: %s"
+ ["offset"]=>
+ int(0)
+ ["sqltext"]=>
+ string(64) "declare e exception; begin if :bv = 1 then raise e; end if; end;"
+}
+Execute status is true
+2nd call after successful execute
+bool(false)
+bool(false)
+bool(false)
+===DONE===
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--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/coll_002.phpt b/ext/oci8/tests/coll_002.phpt
index 6d30519897..cd068ff0b2 100644
--- a/ext/oci8/tests/coll_002.phpt
+++ b/ext/oci8/tests/coll_002.phpt
@@ -1,7 +1,10 @@
--TEST--
oci_new_collection() + free()
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/coll_002_func.phpt b/ext/oci8/tests/coll_002_func.phpt
index 58e641ee24..9d8e4cf976 100644
--- a/ext/oci8/tests/coll_002_func.phpt
+++ b/ext/oci8/tests/coll_002_func.phpt
@@ -1,7 +1,10 @@
--TEST--
oci_new_collection() + free()
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/coll_003.phpt b/ext/oci8/tests/coll_003.phpt
index b5236ef6f6..d7c52fe8e2 100644
--- a/ext/oci8/tests/coll_003.phpt
+++ b/ext/oci8/tests/coll_003.phpt
@@ -1,7 +1,10 @@
--TEST--
collection methods
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/coll_003_func.phpt b/ext/oci8/tests/coll_003_func.phpt
index f5c6dc7f38..58655a55fe 100644
--- a/ext/oci8/tests/coll_003_func.phpt
+++ b/ext/oci8/tests/coll_003_func.phpt
@@ -1,7 +1,10 @@
--TEST--
collection methods
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/coll_004.phpt b/ext/oci8/tests/coll_004.phpt
index eb2ac7e26d..f71db4d0fb 100644
--- a/ext/oci8/tests/coll_004.phpt
+++ b/ext/oci8/tests/coll_004.phpt
@@ -1,7 +1,10 @@
--TEST--
oci_collection_assign()
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/coll_004_func.phpt b/ext/oci8/tests/coll_004_func.phpt
index 57dff2eb35..8f24363e1d 100644
--- a/ext/oci8/tests/coll_004_func.phpt
+++ b/ext/oci8/tests/coll_004_func.phpt
@@ -1,7 +1,10 @@
--TEST--
oci_collection_assign()
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/coll_005.phpt b/ext/oci8/tests/coll_005.phpt
index 0f40069964..84084e7dd3 100644
--- a/ext/oci8/tests/coll_005.phpt
+++ b/ext/oci8/tests/coll_005.phpt
@@ -1,7 +1,10 @@
--TEST--
ocinewcollection()
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/coll_006.phpt b/ext/oci8/tests/coll_006.phpt
index cf258cbe34..4799eb6b79 100644
--- a/ext/oci8/tests/coll_006.phpt
+++ b/ext/oci8/tests/coll_006.phpt
@@ -1,7 +1,10 @@
--TEST--
ocinewcollection() + free()
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/coll_006_func.phpt b/ext/oci8/tests/coll_006_func.phpt
index 56707d6087..3d65606148 100644
--- a/ext/oci8/tests/coll_006_func.phpt
+++ b/ext/oci8/tests/coll_006_func.phpt
@@ -1,7 +1,10 @@
--TEST--
ocinewcollection() + free()
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/coll_007.phpt b/ext/oci8/tests/coll_007.phpt
index 31e10c065e..86ce62f79e 100644
--- a/ext/oci8/tests/coll_007.phpt
+++ b/ext/oci8/tests/coll_007.phpt
@@ -1,7 +1,10 @@
--TEST--
collection methods
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/coll_008.phpt b/ext/oci8/tests/coll_008.phpt
index 57d44cc9ab..431d5d6351 100644
--- a/ext/oci8/tests/coll_008.phpt
+++ b/ext/oci8/tests/coll_008.phpt
@@ -1,7 +1,10 @@
--TEST--
ocicollassign()
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/coll_009.phpt b/ext/oci8/tests/coll_009.phpt
index 296d6493e2..917af5f2c5 100644
--- a/ext/oci8/tests/coll_009.phpt
+++ b/ext/oci8/tests/coll_009.phpt
@@ -1,7 +1,10 @@
--TEST--
collections and wrong dates
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/coll_009_func.phpt b/ext/oci8/tests/coll_009_func.phpt
index 3ed416ce09..0c5b46ddd4 100644
--- a/ext/oci8/tests/coll_009_func.phpt
+++ b/ext/oci8/tests/coll_009_func.phpt
@@ -1,7 +1,10 @@
--TEST--
collections and wrong dates
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/coll_010.phpt b/ext/oci8/tests/coll_010.phpt
index 6f72dd16c1..da088e919d 100644
--- a/ext/oci8/tests/coll_010.phpt
+++ b/ext/oci8/tests/coll_010.phpt
@@ -1,7 +1,10 @@
--TEST--
collections and nulls
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/coll_010_func.phpt b/ext/oci8/tests/coll_010_func.phpt
index 7b63a276f3..c5379ac9f3 100644
--- a/ext/oci8/tests/coll_010_func.phpt
+++ b/ext/oci8/tests/coll_010_func.phpt
@@ -1,7 +1,10 @@
--TEST--
collections and nulls
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/coll_011.phpt b/ext/oci8/tests/coll_011.phpt
index 7d805d3f70..3e8aa9d6a3 100644
--- a/ext/oci8/tests/coll_011.phpt
+++ b/ext/oci8/tests/coll_011.phpt
@@ -1,7 +1,10 @@
--TEST--
collections and strings
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/coll_011_func.phpt b/ext/oci8/tests/coll_011_func.phpt
index dca640e846..3871dd90e1 100644
--- a/ext/oci8/tests/coll_011_func.phpt
+++ b/ext/oci8/tests/coll_011_func.phpt
@@ -1,7 +1,10 @@
--TEST--
collections and strings
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/coll_012.phpt b/ext/oci8/tests/coll_012.phpt
index 543dafd902..4b912a80f8 100644
--- a/ext/oci8/tests/coll_012.phpt
+++ b/ext/oci8/tests/coll_012.phpt
@@ -1,7 +1,10 @@
--TEST--
collections and correct dates
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/coll_012_func.phpt b/ext/oci8/tests/coll_012_func.phpt
index fd1019e411..574281d149 100644
--- a/ext/oci8/tests/coll_012_func.phpt
+++ b/ext/oci8/tests/coll_012_func.phpt
@@ -1,7 +1,10 @@
--TEST--
collections and correct dates
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/coll_013.phpt b/ext/oci8/tests/coll_013.phpt
index 00d88bb9a4..04f549845e 100644
--- a/ext/oci8/tests/coll_013.phpt
+++ b/ext/oci8/tests/coll_013.phpt
@@ -1,7 +1,10 @@
--TEST--
collections and correct dates (2)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/coll_013_func.phpt b/ext/oci8/tests/coll_013_func.phpt
index 0d01bc1744..1992b94f68 100644
--- a/ext/oci8/tests/coll_013_func.phpt
+++ b/ext/oci8/tests/coll_013_func.phpt
@@ -1,7 +1,10 @@
--TEST--
collections and correct dates (2)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/coll_014.phpt b/ext/oci8/tests/coll_014.phpt
index 8458525ae5..e89f4a37bf 100644
--- a/ext/oci8/tests/coll_014.phpt
+++ b/ext/oci8/tests/coll_014.phpt
@@ -1,7 +1,10 @@
--TEST--
collections and strings (2)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/coll_014_func.phpt b/ext/oci8/tests/coll_014_func.phpt
index a0fe555b61..7d771633d2 100644
--- a/ext/oci8/tests/coll_014_func.phpt
+++ b/ext/oci8/tests/coll_014_func.phpt
@@ -1,7 +1,10 @@
--TEST--
collections and strings (2)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/coll_015.phpt b/ext/oci8/tests/coll_015.phpt
index 64b0aea106..c422d211b7 100644
--- a/ext/oci8/tests/coll_015.phpt
+++ b/ext/oci8/tests/coll_015.phpt
@@ -1,7 +1,10 @@
--TEST--
collections and numbers (2)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/coll_015_func.phpt b/ext/oci8/tests/coll_015_func.phpt
index eeed7839a7..18e21dd934 100644
--- a/ext/oci8/tests/coll_015_func.phpt
+++ b/ext/oci8/tests/coll_015_func.phpt
@@ -1,7 +1,10 @@
--TEST--
collections and numbers (2)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/coll_016.phpt b/ext/oci8/tests/coll_016.phpt
index c2af9cc22d..2e06e2959c 100644
--- a/ext/oci8/tests/coll_016.phpt
+++ b/ext/oci8/tests/coll_016.phpt
@@ -1,7 +1,10 @@
--TEST--
collections and negative/too big element indexes
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/coll_016_func.phpt b/ext/oci8/tests/coll_016_func.phpt
index cde26f22f0..67830af25c 100644
--- a/ext/oci8/tests/coll_016_func.phpt
+++ b/ext/oci8/tests/coll_016_func.phpt
@@ -1,7 +1,10 @@
--TEST--
collections and negative/too big element indexes
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/coll_017.phpt b/ext/oci8/tests/coll_017.phpt
index 42347ba6f8..56f509965d 100644
--- a/ext/oci8/tests/coll_017.phpt
+++ b/ext/oci8/tests/coll_017.phpt
@@ -1,7 +1,10 @@
--TEST--
collections and nulls (2)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/coll_017_func.phpt b/ext/oci8/tests/coll_017_func.phpt
index 914844ae61..3440195fe6 100644
--- a/ext/oci8/tests/coll_017_func.phpt
+++ b/ext/oci8/tests/coll_017_func.phpt
@@ -1,7 +1,10 @@
--TEST--
collections and nulls (2)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/coll_018.phpt b/ext/oci8/tests/coll_018.phpt
index f97cc49e7c..a3f0b29ce5 100644
--- a/ext/oci8/tests/coll_018.phpt
+++ b/ext/oci8/tests/coll_018.phpt
@@ -1,7 +1,10 @@
--TEST--
Collection trim tests
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/coll_019.phpt b/ext/oci8/tests/coll_019.phpt
index 15a673d718..371c802ede 100644
--- a/ext/oci8/tests/coll_019.phpt
+++ b/ext/oci8/tests/coll_019.phpt
@@ -1,7 +1,13 @@
--TEST--
Test collection Oracle error handling collections and numbers (2)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/commit_001.phpt b/ext/oci8/tests/commit_001.phpt
index 836d2cd1df..806fb193a0 100644
--- a/ext/oci8/tests/commit_001.phpt
+++ b/ext/oci8/tests/commit_001.phpt
@@ -1,7 +1,10 @@
--TEST--
Test OCI_NO_AUTO_COMMIT constant
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/commit_002.phpt b/ext/oci8/tests/commit_002.phpt
index 1819fe116b..4079ac0c30 100644
--- a/ext/oci8/tests/commit_002.phpt
+++ b/ext/oci8/tests/commit_002.phpt
@@ -1,7 +1,10 @@
--TEST--
Test oci_commit failure
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
@@ -16,21 +19,7 @@ $stmtarray = array(
y int constraint commit_002_tab_check_y check ( y > 0 ) deferrable initially deferred)"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- $r = @oci_execute($s);
- if (!$r) {
- $m = oci_error($s);
- if (!in_array($m['code'], array( // ignore expected errors
- 942 // table or view does not exist
- , 2289 // sequence does not exist
- , 4080 // trigger does not exist
- , 38802 // edition does not exist
- ))) {
- echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
- }
- }
-}
+oci8_test_sql_execute($c, $stmtarray);
// Run Test
@@ -68,12 +57,7 @@ $stmtarray = array(
"drop table commit_002_tab"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
-
-oci_close($c);
+oci8_test_sql_execute($c, $stmtarray);
?>
===DONE===
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--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/conn_attr_1.phpt b/ext/oci8/tests/conn_attr_1.phpt
index c7c1b870e5..ad508a2ed2 100644
--- a/ext/oci8/tests/conn_attr_1.phpt
+++ b/ext/oci8/tests/conn_attr_1.phpt
@@ -2,24 +2,17 @@
Set and get of connection attributes with all types of connections.
--SKIPIF--
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension");
-require(dirname(__FILE__)."/connect.inc");
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+
if (strcasecmp($user, "system") && strcasecmp($user, "sys"))
die("skip needs to be run as a DBA user");
if ($test_drcp) die("skip output might vary with DRCP");
-$sv = oci_server_version($c);
-$sv = preg_match('/Release 1[012]\./', $sv, $matches);
-if ($sv == 1) {
- ob_start();
- phpinfo(INFO_MODULES);
- $phpinfo = ob_get_clean();
- $iv = preg_match('/Oracle .*Version => 1[012]\./', $phpinfo);
- if ($iv != 1) {
- die ("skip test expected to work only with Oracle 10g or greater client ");
- }
-}
-else {
- die ("skip test expected to work only with Oracle 10g or greater server");
+if (preg_match('/Release 1[01]\./', oci_server_version($c), $matches) !== 1) {
+ die("skip expected output only valid when using Oracle 10g or greater database server");
+} else if (preg_match('/^1[01]\./', oci_client_version()) != 1) {
+ die("skip test expected to work only with Oracle 10g or greater version of client");
}
?>
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--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension");
-require(dirname(__FILE__)."/connect.inc");
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+
if (strcasecmp($user, "system") && strcasecmp($user, "sys")) die("skip needs to be run as a DBA user");
if ($test_drcp) die("skip output might vary with DRCP");
-$sv = oci_server_version($c);
-$sv = preg_match('/Release 1[012]\./', $sv, $matches);
-if ($sv == 1) {
- ob_start();
- phpinfo(INFO_MODULES);
- $phpinfo = ob_get_clean();
- $iv = preg_match('/Oracle .*Version => 1[012]\./', $phpinfo);
- if ($iv != 1) {
- die ("skip test expected to work only with Oracle 10g or greater version of client");
- }
-}
-else {
- die ("skip test expected to work only with Oracle 10g or greater version of server");
+if (preg_match('/Release 1[01]\./', oci_server_version($c), $matches) !== 1) {
+ die("skip expected output only valid when using Oracle 10g or greater database server");
+} else if (preg_match('/^1[01]\./', oci_client_version()) != 1) {
+ die("skip test expected to work only with Oracle 10g or greater version of client");
}
+
?>
--INI--
oci8.privileged_connect = On
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--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension");
-require(dirname(__FILE__)."/connect.inc");
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+
if (strcasecmp($user, "system") && strcasecmp($user, "sys")) die("skip needs to be run as a DBA user");
if ($test_drcp) die("skip output might vary with DRCP");
-$sv = oci_server_version($c);
-$sv = preg_match('/Release 1[012]\./', $sv, $matches);
-if ($sv == 1) {
- ob_start();
- phpinfo(INFO_MODULES);
- $phpinfo = ob_get_clean();
- $iv = preg_match('/Oracle .*Version => 1[012]\./', $phpinfo);
- if ($iv != 1) {
- die ("skip test expected to work only with Oracle 10g or greater version of client");
- }
-}
-else {
- die ("skip test expected to work only with Oracle 10g or greater version of server");
+if (preg_match('/Release 1[01]\./', oci_server_version($c), $matches) !== 1) {
+ die("skip expected output only valid when using Oracle 10g or greater database server");
+} else if (preg_match('/^1[01]\./', oci_client_version()) != 1) {
+ die("skip test expected to work only with Oracle 10g or greater version of client");
}
?>
--FILE--
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--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension");
-require(dirname(__FILE__)."/connect.inc");
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+
if (strcasecmp($user, "system") && strcasecmp($user, "sys")) die("skip needs to be run as a DBA user");
if ($test_drcp) die("skip output might vary with DRCP");
if ($stress_test !== true) die ('skip Slow test not run when $stress_test is FALSE');
-$sv = oci_server_version($c);
-$sv = preg_match('/Release 1[012]\./', $sv, $matches);
-if ($sv == 1) {
- ob_start();
- phpinfo(INFO_MODULES);
- $phpinfo = ob_get_clean();
- $iv = preg_match('/Oracle .*Version => 1[012]\./', $phpinfo);
- if ($iv != 1) {
- die ("skip test expected to work only with Oracle 10g or greater version of client");
- }
-}
-else {
- die ("skip test expected to work only with Oracle 10g or greater version of server");
+if (preg_match('/Release (11\.2|12)\./', oci_server_version($c), $matches) !== 1) {
+ // Bug fixed in 11.2 prevents client_info being rest
+ die("skip expected output only valid when using Oracle 11gR2 or greater database server");
+} else if (preg_match('/^1[01]\./', oci_client_version()) != 1) {
+ die("skip test expected to work only with Oracle 10g or greater version of client");
}
?>
--FILE--
<?php
+
+
require(dirname(__FILE__)."/conn_attr.inc");
$user='testuser';
@@ -56,6 +52,7 @@ var_dump(oci_set_action($c1,'ACTION1'));
get_attr($c1,'ACTION');
// Testing with different types of values
+// NB. This may diff in 11.1.0.6 due to a bug causing CLIENT_INFO of NULL to be ignored.
echo "\nSetting to different values \n";
$values_array = array(1000,NULL,'this is a very huge string with a length > 64 !!!!!this is a very huge string with a length > 64 !!!!!this is a very huge string with a length > 64 !!!!!this is a very huge string with a length > 64 !!!!!');
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--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension");
-require(dirname(__FILE__)."/connect.inc");
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+
if (strcasecmp($user, "system") && strcasecmp($user, "sys")) die("skip needs to be run as a DBA user");
if ($test_drcp) die("skip output might vary with DRCP");
-$sv = oci_server_version($c);
-$sv = preg_match('/Release 1[012]\./', $sv, $matches);
-if ($sv == 1) {
- ob_start();
- phpinfo(INFO_MODULES);
- $phpinfo = ob_get_clean();
- $iv = preg_match('/Oracle .*Version => 1[012]\./', $phpinfo);
- if ($iv != 1) {
- die ("skip test expected to work only with Oracle 10g or greater version of client");
- }
-}
-else {
- die ("skip test expected to work only with Oracle 10g or greater version of server");
+if (preg_match('/Release 1[01]\./', oci_server_version($c), $matches) !== 1) {
+ die("skip expected output only valid when using Oracle 10g or greater database server");
+} else if (preg_match('/^1[01]\./', oci_client_version()) != 1) {
+ die("skip test expected to work only with Oracle 10g or greater version of client");
}
?>
--FILE--
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 @@
<?php
- if ($c) {
- $ora_sql = "DROP TABLE ".$schema.$table_name;
- $statement = oci_parse($c, $ora_sql);
- @oci_execute($statement);
-
- $ora_sql = "CREATE TABLE ".$schema.$table_name." (id NUMBER, value NUMBER, blob BLOB, clob CLOB, string VARCHAR(10))";
- $statement = oci_parse($c, $ora_sql);
- oci_execute($statement);
- }
+if ($c) {
+
+
+ $stmtarray = array(
+ "DROP TABLE ".$schema.$table_name,
+ "CREATE TABLE ".$schema.$table_name." (id NUMBER, value NUMBER, blob BLOB, clob CLOB, string VARCHAR(10))"
+ );
+
+ oci8_test_sql_execute($c, $stmtarray);
+
+}
?>
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--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
-require dirname(__FILE__)."/connect.inc";
-
-$drop_table = "DROP TABLE ".$schema.$table_name."";
+require(dirname(__FILE__)."/connect.inc");
-if (!($s = oci_parse($c, $drop_table))) {
- die("oci_parse(drop) failed!\n");
-}
+// Initialization
-@oci_execute($s);
-
-$create_table = "CREATE TABLE ".$schema.$table_name." (id NUMBER, value VARCHAR(20))";
-
-if (!($s = oci_parse($c, $create_table))) {
- die("oci_parse(create) failed!\n");
-}
-
-if (!oci_execute($s)) {
- die("oci_execute(create) failed!\n");
-}
-
-$insert_sql = "INSERT INTO ".$schema.$table_name." (id, value) VALUES (1,1)";
-
-if (!($s = oci_parse($c, $insert_sql))) {
- die("oci_parse(insert) failed!\n");
-}
-
-for ($i = 0; $i<3; $i++) {
- if (!oci_execute($s)) {
- die("oci_execute(insert) failed!\n");
- }
-}
-
-if (!oci_commit($c)) {
- die("oci_commit() failed!\n");
-}
+$stmtarray = array(
+ "drop table cursor_bind_tab",
+ "create table cursor_bind_tab (id NUMBER, value VARCHAR(20))",
+ "insert into cursor_bind_tab values (1, '1')",
+ "insert into cursor_bind_tab values (1, '1')",
+ "insert into cursor_bind_tab values (1, '1')"
+);
+oci8_test_sql_execute($c, $stmtarray);
$sql = "
DECLARE
TYPE curtype IS REF CURSOR;
cursor_var curtype;
BEGIN
- OPEN cursor_var FOR SELECT id, value FROM ".$schema.$table_name.";
- :curs := cursor_var;
+ OPEN cursor_var FOR SELECT id, value FROM cursor_bind_tab;
+ :curs := cursor_var;
END;
";
@@ -65,18 +45,18 @@ var_dump(oci_fetch_row($cursor));
var_dump(oci_fetch_row($cursor));
var_dump(oci_fetch_row($cursor));
-echo "Done\n";
+// Clean up
-$drop_table = "DROP TABLE ".$schema.$table_name."";
-
-if (!($s = oci_parse($c, $drop_table))) {
- die("oci_parse(drop) failed!\n");
-}
+$stmtarray = array(
+ "drop table cursor_bind_tab"
+);
-@oci_execute($s);
+oci8_test_sql_execute($c, $stmtarray);
?>
---EXPECT--
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
array(2) {
[0]=>
string(1) "1"
@@ -96,4 +76,4 @@ array(2) {
string(1) "1"
}
bool(false)
-Done
+===DONE===
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--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
@@ -17,23 +20,7 @@ $stmtarray = array(
"insert into cursor_bind_err_tab (id, value) values (1,1)",
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- $r = @oci_execute($s);
- if (!$r) {
- $m = oci_error($s);
- if (!in_array($m['code'], array( // ignore expected errors
- 942 // table or view does not exist
- ))) {
- echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
- }
- }
-}
-
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
// Run Test
@@ -54,10 +41,7 @@ $stmtarray = array(
"drop table cursor_bind_err_tab"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
diff --git a/ext/oci8/tests/cursors.phpt b/ext/oci8/tests/cursors.phpt
index 22c89c9c54..0919e44113 100644
--- a/ext/oci8/tests/cursors.phpt
+++ b/ext/oci8/tests/cursors.phpt
@@ -1,7 +1,10 @@
--TEST--
fetching cursor from a statement
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/cursors_old.phpt b/ext/oci8/tests/cursors_old.phpt
index 73447c82b4..d60e2ff1ea 100644
--- a/ext/oci8/tests/cursors_old.phpt
+++ b/ext/oci8/tests/cursors_old.phpt
@@ -1,7 +1,10 @@
--TEST--
fetching cursor from a statement
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
@@ -17,23 +20,7 @@ $stmtarray = array(
"insert into cursors_old_tab (id, value) values (1,1)",
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- $r = @oci_execute($s);
- if (!$r) {
- $m = oci_error($s);
- if (!in_array($m['code'], array( // ignore expected errors
- 942 // table or view does not exist
- ))) {
- echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
- }
- }
-}
-
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
// Run Test
@@ -58,10 +45,7 @@ $stmtarray = array(
"drop table cursors_old_tab"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
diff --git a/ext/oci8/tests/dbmsoutput.phpt b/ext/oci8/tests/dbmsoutput.phpt
new file mode 100644
index 0000000000..eaace0fa08
--- /dev/null
+++ b/ext/oci8/tests/dbmsoutput.phpt
@@ -0,0 +1,750 @@
+--TEST--
+PL/SQL: dbms_output
+--SKIPIF--
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+ "create or replace procedure dbmsoutput_proc as
+ begin
+ dbms_output.put_line('Hello World!');
+ end;",
+
+ "create or replace type dorow as table of varchar2(4000)",
+
+ "create or replace function mydofetch return dorow pipelined is
+ line varchar2(4000);
+ status integer;
+ begin
+ loop
+ dbms_output.get_line(line, status);
+ exit when status = 1;
+ pipe row (line);
+ end loop;
+ return;
+ end;"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+// Run Test
+
+// Turn DBMS_OUTPUT on
+function setserveroutputon($c)
+{
+ $s = oci_parse($c, "begin dbms_output.enable(null); end;");
+ oci_execute($s);
+}
+
+// Create some output
+function createoutput($c, $prefix)
+{
+ $s = oci_parse($c, "call dbms_output.put_line(:bv1 || ' ' || :bv2 || ' Hello, world! Lots and lots and ... of text')");
+ oci_bind_by_name($s, ":bv1", $i, -1, SQLT_INT);
+ oci_bind_by_name($s, ":bv2", $prefix);
+ for ($i = 0; $i < 100; ++$i) {
+ oci_execute($s);
+ }
+}
+
+// Call dbms_output.get_line()
+// Returns an array of DBMS_OUTPUT lines, or false.
+function getdbmsoutput_do($c)
+{
+ $s = oci_parse($c, "begin dbms_output.get_line(:ln, :st); end;");
+ oci_bind_by_name($s, ":ln", $ln, 100);
+ oci_bind_by_name($s, ":st", $st, -1, SQLT_INT);
+ $res = false;
+ while (($succ = oci_execute($s)) && !$st) {
+ $res[] = $ln; // append each line to the array
+ }
+ return $res;
+}
+
+function getdbmsoutput_do2($c)
+{
+ $orignumlines = $numlines = 100;
+ $s = oci_parse($c, "begin dbms_output.get_lines(:lines, :numlines); end;");
+ $r = oci_bind_by_name($s, ":numlines", $numlines);
+ $res = array();
+ while ($numlines >= $orignumlines) {
+ oci_bind_array_by_name($s, ":lines", $lines, $numlines, 255, SQLT_CHR);
+ oci_execute($s);
+ if ($numlines == 0) {
+ break;
+ }
+ $res = array_merge($res, array_slice($lines, 0, $numlines));
+ unset($lines);
+ }
+ return $res;
+}
+
+function getdbmsoutput_pl($c)
+{
+ $s = oci_parse($c, "select * from table(mydofetch())");
+ oci_execute($s);
+ $res = false;
+ while ($row = oci_fetch_array($s, OCI_NUM)) {
+ $res[] = $row[0];
+ }
+ return $res;
+}
+
+echo "Test 1\n";
+
+setserveroutputon($c); // Turn output buffering on
+
+$s = oci_parse($c, 'call dbmsoutput_proc()');
+oci_execute($s);
+var_dump(getdbmsoutput_do($c));
+
+echo "Test 2\n";
+
+createoutput($c, 'test 2');
+var_dump(getdbmsoutput_do($c));
+
+echo "Test 3\n";
+
+createoutput($c, 'test 3');
+var_dump(getdbmsoutput_do2($c));
+
+echo "Test 4\n";
+
+createoutput($c, 'test 4');
+var_dump(getdbmsoutput_pl($c));
+
+// Clean up
+
+$stmtarray = array(
+ "drop procedure dbmsoutput_proc"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1
+array(1) {
+ [0]=>
+ string(12) "Hello World!"
+}
+Test 2
+array(100) {
+ [0]=>
+ string(52) "0 test 2 Hello, world! Lots and lots and ... of text"
+ [1]=>
+ string(52) "1 test 2 Hello, world! Lots and lots and ... of text"
+ [2]=>
+ string(52) "2 test 2 Hello, world! Lots and lots and ... of text"
+ [3]=>
+ string(52) "3 test 2 Hello, world! Lots and lots and ... of text"
+ [4]=>
+ string(52) "4 test 2 Hello, world! Lots and lots and ... of text"
+ [5]=>
+ string(52) "5 test 2 Hello, world! Lots and lots and ... of text"
+ [6]=>
+ string(52) "6 test 2 Hello, world! Lots and lots and ... of text"
+ [7]=>
+ string(52) "7 test 2 Hello, world! Lots and lots and ... of text"
+ [8]=>
+ string(52) "8 test 2 Hello, world! Lots and lots and ... of text"
+ [9]=>
+ string(52) "9 test 2 Hello, world! Lots and lots and ... of text"
+ [10]=>
+ string(53) "10 test 2 Hello, world! Lots and lots and ... of text"
+ [11]=>
+ string(53) "11 test 2 Hello, world! Lots and lots and ... of text"
+ [12]=>
+ string(53) "12 test 2 Hello, world! Lots and lots and ... of text"
+ [13]=>
+ string(53) "13 test 2 Hello, world! Lots and lots and ... of text"
+ [14]=>
+ string(53) "14 test 2 Hello, world! Lots and lots and ... of text"
+ [15]=>
+ string(53) "15 test 2 Hello, world! Lots and lots and ... of text"
+ [16]=>
+ string(53) "16 test 2 Hello, world! Lots and lots and ... of text"
+ [17]=>
+ string(53) "17 test 2 Hello, world! Lots and lots and ... of text"
+ [18]=>
+ string(53) "18 test 2 Hello, world! Lots and lots and ... of text"
+ [19]=>
+ string(53) "19 test 2 Hello, world! Lots and lots and ... of text"
+ [20]=>
+ string(53) "20 test 2 Hello, world! Lots and lots and ... of text"
+ [21]=>
+ string(53) "21 test 2 Hello, world! Lots and lots and ... of text"
+ [22]=>
+ string(53) "22 test 2 Hello, world! Lots and lots and ... of text"
+ [23]=>
+ string(53) "23 test 2 Hello, world! Lots and lots and ... of text"
+ [24]=>
+ string(53) "24 test 2 Hello, world! Lots and lots and ... of text"
+ [25]=>
+ string(53) "25 test 2 Hello, world! Lots and lots and ... of text"
+ [26]=>
+ string(53) "26 test 2 Hello, world! Lots and lots and ... of text"
+ [27]=>
+ string(53) "27 test 2 Hello, world! Lots and lots and ... of text"
+ [28]=>
+ string(53) "28 test 2 Hello, world! Lots and lots and ... of text"
+ [29]=>
+ string(53) "29 test 2 Hello, world! Lots and lots and ... of text"
+ [30]=>
+ string(53) "30 test 2 Hello, world! Lots and lots and ... of text"
+ [31]=>
+ string(53) "31 test 2 Hello, world! Lots and lots and ... of text"
+ [32]=>
+ string(53) "32 test 2 Hello, world! Lots and lots and ... of text"
+ [33]=>
+ string(53) "33 test 2 Hello, world! Lots and lots and ... of text"
+ [34]=>
+ string(53) "34 test 2 Hello, world! Lots and lots and ... of text"
+ [35]=>
+ string(53) "35 test 2 Hello, world! Lots and lots and ... of text"
+ [36]=>
+ string(53) "36 test 2 Hello, world! Lots and lots and ... of text"
+ [37]=>
+ string(53) "37 test 2 Hello, world! Lots and lots and ... of text"
+ [38]=>
+ string(53) "38 test 2 Hello, world! Lots and lots and ... of text"
+ [39]=>
+ string(53) "39 test 2 Hello, world! Lots and lots and ... of text"
+ [40]=>
+ string(53) "40 test 2 Hello, world! Lots and lots and ... of text"
+ [41]=>
+ string(53) "41 test 2 Hello, world! Lots and lots and ... of text"
+ [42]=>
+ string(53) "42 test 2 Hello, world! Lots and lots and ... of text"
+ [43]=>
+ string(53) "43 test 2 Hello, world! Lots and lots and ... of text"
+ [44]=>
+ string(53) "44 test 2 Hello, world! Lots and lots and ... of text"
+ [45]=>
+ string(53) "45 test 2 Hello, world! Lots and lots and ... of text"
+ [46]=>
+ string(53) "46 test 2 Hello, world! Lots and lots and ... of text"
+ [47]=>
+ string(53) "47 test 2 Hello, world! Lots and lots and ... of text"
+ [48]=>
+ string(53) "48 test 2 Hello, world! Lots and lots and ... of text"
+ [49]=>
+ string(53) "49 test 2 Hello, world! Lots and lots and ... of text"
+ [50]=>
+ string(53) "50 test 2 Hello, world! Lots and lots and ... of text"
+ [51]=>
+ string(53) "51 test 2 Hello, world! Lots and lots and ... of text"
+ [52]=>
+ string(53) "52 test 2 Hello, world! Lots and lots and ... of text"
+ [53]=>
+ string(53) "53 test 2 Hello, world! Lots and lots and ... of text"
+ [54]=>
+ string(53) "54 test 2 Hello, world! Lots and lots and ... of text"
+ [55]=>
+ string(53) "55 test 2 Hello, world! Lots and lots and ... of text"
+ [56]=>
+ string(53) "56 test 2 Hello, world! Lots and lots and ... of text"
+ [57]=>
+ string(53) "57 test 2 Hello, world! Lots and lots and ... of text"
+ [58]=>
+ string(53) "58 test 2 Hello, world! Lots and lots and ... of text"
+ [59]=>
+ string(53) "59 test 2 Hello, world! Lots and lots and ... of text"
+ [60]=>
+ string(53) "60 test 2 Hello, world! Lots and lots and ... of text"
+ [61]=>
+ string(53) "61 test 2 Hello, world! Lots and lots and ... of text"
+ [62]=>
+ string(53) "62 test 2 Hello, world! Lots and lots and ... of text"
+ [63]=>
+ string(53) "63 test 2 Hello, world! Lots and lots and ... of text"
+ [64]=>
+ string(53) "64 test 2 Hello, world! Lots and lots and ... of text"
+ [65]=>
+ string(53) "65 test 2 Hello, world! Lots and lots and ... of text"
+ [66]=>
+ string(53) "66 test 2 Hello, world! Lots and lots and ... of text"
+ [67]=>
+ string(53) "67 test 2 Hello, world! Lots and lots and ... of text"
+ [68]=>
+ string(53) "68 test 2 Hello, world! Lots and lots and ... of text"
+ [69]=>
+ string(53) "69 test 2 Hello, world! Lots and lots and ... of text"
+ [70]=>
+ string(53) "70 test 2 Hello, world! Lots and lots and ... of text"
+ [71]=>
+ string(53) "71 test 2 Hello, world! Lots and lots and ... of text"
+ [72]=>
+ string(53) "72 test 2 Hello, world! Lots and lots and ... of text"
+ [73]=>
+ string(53) "73 test 2 Hello, world! Lots and lots and ... of text"
+ [74]=>
+ string(53) "74 test 2 Hello, world! Lots and lots and ... of text"
+ [75]=>
+ string(53) "75 test 2 Hello, world! Lots and lots and ... of text"
+ [76]=>
+ string(53) "76 test 2 Hello, world! Lots and lots and ... of text"
+ [77]=>
+ string(53) "77 test 2 Hello, world! Lots and lots and ... of text"
+ [78]=>
+ string(53) "78 test 2 Hello, world! Lots and lots and ... of text"
+ [79]=>
+ string(53) "79 test 2 Hello, world! Lots and lots and ... of text"
+ [80]=>
+ string(53) "80 test 2 Hello, world! Lots and lots and ... of text"
+ [81]=>
+ string(53) "81 test 2 Hello, world! Lots and lots and ... of text"
+ [82]=>
+ string(53) "82 test 2 Hello, world! Lots and lots and ... of text"
+ [83]=>
+ string(53) "83 test 2 Hello, world! Lots and lots and ... of text"
+ [84]=>
+ string(53) "84 test 2 Hello, world! Lots and lots and ... of text"
+ [85]=>
+ string(53) "85 test 2 Hello, world! Lots and lots and ... of text"
+ [86]=>
+ string(53) "86 test 2 Hello, world! Lots and lots and ... of text"
+ [87]=>
+ string(53) "87 test 2 Hello, world! Lots and lots and ... of text"
+ [88]=>
+ string(53) "88 test 2 Hello, world! Lots and lots and ... of text"
+ [89]=>
+ string(53) "89 test 2 Hello, world! Lots and lots and ... of text"
+ [90]=>
+ string(53) "90 test 2 Hello, world! Lots and lots and ... of text"
+ [91]=>
+ string(53) "91 test 2 Hello, world! Lots and lots and ... of text"
+ [92]=>
+ string(53) "92 test 2 Hello, world! Lots and lots and ... of text"
+ [93]=>
+ string(53) "93 test 2 Hello, world! Lots and lots and ... of text"
+ [94]=>
+ string(53) "94 test 2 Hello, world! Lots and lots and ... of text"
+ [95]=>
+ string(53) "95 test 2 Hello, world! Lots and lots and ... of text"
+ [96]=>
+ string(53) "96 test 2 Hello, world! Lots and lots and ... of text"
+ [97]=>
+ string(53) "97 test 2 Hello, world! Lots and lots and ... of text"
+ [98]=>
+ string(53) "98 test 2 Hello, world! Lots and lots and ... of text"
+ [99]=>
+ string(53) "99 test 2 Hello, world! Lots and lots and ... of text"
+}
+Test 3
+array(100) {
+ [0]=>
+ string(52) "0 test 3 Hello, world! Lots and lots and ... of text"
+ [1]=>
+ string(52) "1 test 3 Hello, world! Lots and lots and ... of text"
+ [2]=>
+ string(52) "2 test 3 Hello, world! Lots and lots and ... of text"
+ [3]=>
+ string(52) "3 test 3 Hello, world! Lots and lots and ... of text"
+ [4]=>
+ string(52) "4 test 3 Hello, world! Lots and lots and ... of text"
+ [5]=>
+ string(52) "5 test 3 Hello, world! Lots and lots and ... of text"
+ [6]=>
+ string(52) "6 test 3 Hello, world! Lots and lots and ... of text"
+ [7]=>
+ string(52) "7 test 3 Hello, world! Lots and lots and ... of text"
+ [8]=>
+ string(52) "8 test 3 Hello, world! Lots and lots and ... of text"
+ [9]=>
+ string(52) "9 test 3 Hello, world! Lots and lots and ... of text"
+ [10]=>
+ string(53) "10 test 3 Hello, world! Lots and lots and ... of text"
+ [11]=>
+ string(53) "11 test 3 Hello, world! Lots and lots and ... of text"
+ [12]=>
+ string(53) "12 test 3 Hello, world! Lots and lots and ... of text"
+ [13]=>
+ string(53) "13 test 3 Hello, world! Lots and lots and ... of text"
+ [14]=>
+ string(53) "14 test 3 Hello, world! Lots and lots and ... of text"
+ [15]=>
+ string(53) "15 test 3 Hello, world! Lots and lots and ... of text"
+ [16]=>
+ string(53) "16 test 3 Hello, world! Lots and lots and ... of text"
+ [17]=>
+ string(53) "17 test 3 Hello, world! Lots and lots and ... of text"
+ [18]=>
+ string(53) "18 test 3 Hello, world! Lots and lots and ... of text"
+ [19]=>
+ string(53) "19 test 3 Hello, world! Lots and lots and ... of text"
+ [20]=>
+ string(53) "20 test 3 Hello, world! Lots and lots and ... of text"
+ [21]=>
+ string(53) "21 test 3 Hello, world! Lots and lots and ... of text"
+ [22]=>
+ string(53) "22 test 3 Hello, world! Lots and lots and ... of text"
+ [23]=>
+ string(53) "23 test 3 Hello, world! Lots and lots and ... of text"
+ [24]=>
+ string(53) "24 test 3 Hello, world! Lots and lots and ... of text"
+ [25]=>
+ string(53) "25 test 3 Hello, world! Lots and lots and ... of text"
+ [26]=>
+ string(53) "26 test 3 Hello, world! Lots and lots and ... of text"
+ [27]=>
+ string(53) "27 test 3 Hello, world! Lots and lots and ... of text"
+ [28]=>
+ string(53) "28 test 3 Hello, world! Lots and lots and ... of text"
+ [29]=>
+ string(53) "29 test 3 Hello, world! Lots and lots and ... of text"
+ [30]=>
+ string(53) "30 test 3 Hello, world! Lots and lots and ... of text"
+ [31]=>
+ string(53) "31 test 3 Hello, world! Lots and lots and ... of text"
+ [32]=>
+ string(53) "32 test 3 Hello, world! Lots and lots and ... of text"
+ [33]=>
+ string(53) "33 test 3 Hello, world! Lots and lots and ... of text"
+ [34]=>
+ string(53) "34 test 3 Hello, world! Lots and lots and ... of text"
+ [35]=>
+ string(53) "35 test 3 Hello, world! Lots and lots and ... of text"
+ [36]=>
+ string(53) "36 test 3 Hello, world! Lots and lots and ... of text"
+ [37]=>
+ string(53) "37 test 3 Hello, world! Lots and lots and ... of text"
+ [38]=>
+ string(53) "38 test 3 Hello, world! Lots and lots and ... of text"
+ [39]=>
+ string(53) "39 test 3 Hello, world! Lots and lots and ... of text"
+ [40]=>
+ string(53) "40 test 3 Hello, world! Lots and lots and ... of text"
+ [41]=>
+ string(53) "41 test 3 Hello, world! Lots and lots and ... of text"
+ [42]=>
+ string(53) "42 test 3 Hello, world! Lots and lots and ... of text"
+ [43]=>
+ string(53) "43 test 3 Hello, world! Lots and lots and ... of text"
+ [44]=>
+ string(53) "44 test 3 Hello, world! Lots and lots and ... of text"
+ [45]=>
+ string(53) "45 test 3 Hello, world! Lots and lots and ... of text"
+ [46]=>
+ string(53) "46 test 3 Hello, world! Lots and lots and ... of text"
+ [47]=>
+ string(53) "47 test 3 Hello, world! Lots and lots and ... of text"
+ [48]=>
+ string(53) "48 test 3 Hello, world! Lots and lots and ... of text"
+ [49]=>
+ string(53) "49 test 3 Hello, world! Lots and lots and ... of text"
+ [50]=>
+ string(53) "50 test 3 Hello, world! Lots and lots and ... of text"
+ [51]=>
+ string(53) "51 test 3 Hello, world! Lots and lots and ... of text"
+ [52]=>
+ string(53) "52 test 3 Hello, world! Lots and lots and ... of text"
+ [53]=>
+ string(53) "53 test 3 Hello, world! Lots and lots and ... of text"
+ [54]=>
+ string(53) "54 test 3 Hello, world! Lots and lots and ... of text"
+ [55]=>
+ string(53) "55 test 3 Hello, world! Lots and lots and ... of text"
+ [56]=>
+ string(53) "56 test 3 Hello, world! Lots and lots and ... of text"
+ [57]=>
+ string(53) "57 test 3 Hello, world! Lots and lots and ... of text"
+ [58]=>
+ string(53) "58 test 3 Hello, world! Lots and lots and ... of text"
+ [59]=>
+ string(53) "59 test 3 Hello, world! Lots and lots and ... of text"
+ [60]=>
+ string(53) "60 test 3 Hello, world! Lots and lots and ... of text"
+ [61]=>
+ string(53) "61 test 3 Hello, world! Lots and lots and ... of text"
+ [62]=>
+ string(53) "62 test 3 Hello, world! Lots and lots and ... of text"
+ [63]=>
+ string(53) "63 test 3 Hello, world! Lots and lots and ... of text"
+ [64]=>
+ string(53) "64 test 3 Hello, world! Lots and lots and ... of text"
+ [65]=>
+ string(53) "65 test 3 Hello, world! Lots and lots and ... of text"
+ [66]=>
+ string(53) "66 test 3 Hello, world! Lots and lots and ... of text"
+ [67]=>
+ string(53) "67 test 3 Hello, world! Lots and lots and ... of text"
+ [68]=>
+ string(53) "68 test 3 Hello, world! Lots and lots and ... of text"
+ [69]=>
+ string(53) "69 test 3 Hello, world! Lots and lots and ... of text"
+ [70]=>
+ string(53) "70 test 3 Hello, world! Lots and lots and ... of text"
+ [71]=>
+ string(53) "71 test 3 Hello, world! Lots and lots and ... of text"
+ [72]=>
+ string(53) "72 test 3 Hello, world! Lots and lots and ... of text"
+ [73]=>
+ string(53) "73 test 3 Hello, world! Lots and lots and ... of text"
+ [74]=>
+ string(53) "74 test 3 Hello, world! Lots and lots and ... of text"
+ [75]=>
+ string(53) "75 test 3 Hello, world! Lots and lots and ... of text"
+ [76]=>
+ string(53) "76 test 3 Hello, world! Lots and lots and ... of text"
+ [77]=>
+ string(53) "77 test 3 Hello, world! Lots and lots and ... of text"
+ [78]=>
+ string(53) "78 test 3 Hello, world! Lots and lots and ... of text"
+ [79]=>
+ string(53) "79 test 3 Hello, world! Lots and lots and ... of text"
+ [80]=>
+ string(53) "80 test 3 Hello, world! Lots and lots and ... of text"
+ [81]=>
+ string(53) "81 test 3 Hello, world! Lots and lots and ... of text"
+ [82]=>
+ string(53) "82 test 3 Hello, world! Lots and lots and ... of text"
+ [83]=>
+ string(53) "83 test 3 Hello, world! Lots and lots and ... of text"
+ [84]=>
+ string(53) "84 test 3 Hello, world! Lots and lots and ... of text"
+ [85]=>
+ string(53) "85 test 3 Hello, world! Lots and lots and ... of text"
+ [86]=>
+ string(53) "86 test 3 Hello, world! Lots and lots and ... of text"
+ [87]=>
+ string(53) "87 test 3 Hello, world! Lots and lots and ... of text"
+ [88]=>
+ string(53) "88 test 3 Hello, world! Lots and lots and ... of text"
+ [89]=>
+ string(53) "89 test 3 Hello, world! Lots and lots and ... of text"
+ [90]=>
+ string(53) "90 test 3 Hello, world! Lots and lots and ... of text"
+ [91]=>
+ string(53) "91 test 3 Hello, world! Lots and lots and ... of text"
+ [92]=>
+ string(53) "92 test 3 Hello, world! Lots and lots and ... of text"
+ [93]=>
+ string(53) "93 test 3 Hello, world! Lots and lots and ... of text"
+ [94]=>
+ string(53) "94 test 3 Hello, world! Lots and lots and ... of text"
+ [95]=>
+ string(53) "95 test 3 Hello, world! Lots and lots and ... of text"
+ [96]=>
+ string(53) "96 test 3 Hello, world! Lots and lots and ... of text"
+ [97]=>
+ string(53) "97 test 3 Hello, world! Lots and lots and ... of text"
+ [98]=>
+ string(53) "98 test 3 Hello, world! Lots and lots and ... of text"
+ [99]=>
+ string(53) "99 test 3 Hello, world! Lots and lots and ... of text"
+}
+Test 4
+array(100) {
+ [0]=>
+ string(52) "0 test 4 Hello, world! Lots and lots and ... of text"
+ [1]=>
+ string(52) "1 test 4 Hello, world! Lots and lots and ... of text"
+ [2]=>
+ string(52) "2 test 4 Hello, world! Lots and lots and ... of text"
+ [3]=>
+ string(52) "3 test 4 Hello, world! Lots and lots and ... of text"
+ [4]=>
+ string(52) "4 test 4 Hello, world! Lots and lots and ... of text"
+ [5]=>
+ string(52) "5 test 4 Hello, world! Lots and lots and ... of text"
+ [6]=>
+ string(52) "6 test 4 Hello, world! Lots and lots and ... of text"
+ [7]=>
+ string(52) "7 test 4 Hello, world! Lots and lots and ... of text"
+ [8]=>
+ string(52) "8 test 4 Hello, world! Lots and lots and ... of text"
+ [9]=>
+ string(52) "9 test 4 Hello, world! Lots and lots and ... of text"
+ [10]=>
+ string(53) "10 test 4 Hello, world! Lots and lots and ... of text"
+ [11]=>
+ string(53) "11 test 4 Hello, world! Lots and lots and ... of text"
+ [12]=>
+ string(53) "12 test 4 Hello, world! Lots and lots and ... of text"
+ [13]=>
+ string(53) "13 test 4 Hello, world! Lots and lots and ... of text"
+ [14]=>
+ string(53) "14 test 4 Hello, world! Lots and lots and ... of text"
+ [15]=>
+ string(53) "15 test 4 Hello, world! Lots and lots and ... of text"
+ [16]=>
+ string(53) "16 test 4 Hello, world! Lots and lots and ... of text"
+ [17]=>
+ string(53) "17 test 4 Hello, world! Lots and lots and ... of text"
+ [18]=>
+ string(53) "18 test 4 Hello, world! Lots and lots and ... of text"
+ [19]=>
+ string(53) "19 test 4 Hello, world! Lots and lots and ... of text"
+ [20]=>
+ string(53) "20 test 4 Hello, world! Lots and lots and ... of text"
+ [21]=>
+ string(53) "21 test 4 Hello, world! Lots and lots and ... of text"
+ [22]=>
+ string(53) "22 test 4 Hello, world! Lots and lots and ... of text"
+ [23]=>
+ string(53) "23 test 4 Hello, world! Lots and lots and ... of text"
+ [24]=>
+ string(53) "24 test 4 Hello, world! Lots and lots and ... of text"
+ [25]=>
+ string(53) "25 test 4 Hello, world! Lots and lots and ... of text"
+ [26]=>
+ string(53) "26 test 4 Hello, world! Lots and lots and ... of text"
+ [27]=>
+ string(53) "27 test 4 Hello, world! Lots and lots and ... of text"
+ [28]=>
+ string(53) "28 test 4 Hello, world! Lots and lots and ... of text"
+ [29]=>
+ string(53) "29 test 4 Hello, world! Lots and lots and ... of text"
+ [30]=>
+ string(53) "30 test 4 Hello, world! Lots and lots and ... of text"
+ [31]=>
+ string(53) "31 test 4 Hello, world! Lots and lots and ... of text"
+ [32]=>
+ string(53) "32 test 4 Hello, world! Lots and lots and ... of text"
+ [33]=>
+ string(53) "33 test 4 Hello, world! Lots and lots and ... of text"
+ [34]=>
+ string(53) "34 test 4 Hello, world! Lots and lots and ... of text"
+ [35]=>
+ string(53) "35 test 4 Hello, world! Lots and lots and ... of text"
+ [36]=>
+ string(53) "36 test 4 Hello, world! Lots and lots and ... of text"
+ [37]=>
+ string(53) "37 test 4 Hello, world! Lots and lots and ... of text"
+ [38]=>
+ string(53) "38 test 4 Hello, world! Lots and lots and ... of text"
+ [39]=>
+ string(53) "39 test 4 Hello, world! Lots and lots and ... of text"
+ [40]=>
+ string(53) "40 test 4 Hello, world! Lots and lots and ... of text"
+ [41]=>
+ string(53) "41 test 4 Hello, world! Lots and lots and ... of text"
+ [42]=>
+ string(53) "42 test 4 Hello, world! Lots and lots and ... of text"
+ [43]=>
+ string(53) "43 test 4 Hello, world! Lots and lots and ... of text"
+ [44]=>
+ string(53) "44 test 4 Hello, world! Lots and lots and ... of text"
+ [45]=>
+ string(53) "45 test 4 Hello, world! Lots and lots and ... of text"
+ [46]=>
+ string(53) "46 test 4 Hello, world! Lots and lots and ... of text"
+ [47]=>
+ string(53) "47 test 4 Hello, world! Lots and lots and ... of text"
+ [48]=>
+ string(53) "48 test 4 Hello, world! Lots and lots and ... of text"
+ [49]=>
+ string(53) "49 test 4 Hello, world! Lots and lots and ... of text"
+ [50]=>
+ string(53) "50 test 4 Hello, world! Lots and lots and ... of text"
+ [51]=>
+ string(53) "51 test 4 Hello, world! Lots and lots and ... of text"
+ [52]=>
+ string(53) "52 test 4 Hello, world! Lots and lots and ... of text"
+ [53]=>
+ string(53) "53 test 4 Hello, world! Lots and lots and ... of text"
+ [54]=>
+ string(53) "54 test 4 Hello, world! Lots and lots and ... of text"
+ [55]=>
+ string(53) "55 test 4 Hello, world! Lots and lots and ... of text"
+ [56]=>
+ string(53) "56 test 4 Hello, world! Lots and lots and ... of text"
+ [57]=>
+ string(53) "57 test 4 Hello, world! Lots and lots and ... of text"
+ [58]=>
+ string(53) "58 test 4 Hello, world! Lots and lots and ... of text"
+ [59]=>
+ string(53) "59 test 4 Hello, world! Lots and lots and ... of text"
+ [60]=>
+ string(53) "60 test 4 Hello, world! Lots and lots and ... of text"
+ [61]=>
+ string(53) "61 test 4 Hello, world! Lots and lots and ... of text"
+ [62]=>
+ string(53) "62 test 4 Hello, world! Lots and lots and ... of text"
+ [63]=>
+ string(53) "63 test 4 Hello, world! Lots and lots and ... of text"
+ [64]=>
+ string(53) "64 test 4 Hello, world! Lots and lots and ... of text"
+ [65]=>
+ string(53) "65 test 4 Hello, world! Lots and lots and ... of text"
+ [66]=>
+ string(53) "66 test 4 Hello, world! Lots and lots and ... of text"
+ [67]=>
+ string(53) "67 test 4 Hello, world! Lots and lots and ... of text"
+ [68]=>
+ string(53) "68 test 4 Hello, world! Lots and lots and ... of text"
+ [69]=>
+ string(53) "69 test 4 Hello, world! Lots and lots and ... of text"
+ [70]=>
+ string(53) "70 test 4 Hello, world! Lots and lots and ... of text"
+ [71]=>
+ string(53) "71 test 4 Hello, world! Lots and lots and ... of text"
+ [72]=>
+ string(53) "72 test 4 Hello, world! Lots and lots and ... of text"
+ [73]=>
+ string(53) "73 test 4 Hello, world! Lots and lots and ... of text"
+ [74]=>
+ string(53) "74 test 4 Hello, world! Lots and lots and ... of text"
+ [75]=>
+ string(53) "75 test 4 Hello, world! Lots and lots and ... of text"
+ [76]=>
+ string(53) "76 test 4 Hello, world! Lots and lots and ... of text"
+ [77]=>
+ string(53) "77 test 4 Hello, world! Lots and lots and ... of text"
+ [78]=>
+ string(53) "78 test 4 Hello, world! Lots and lots and ... of text"
+ [79]=>
+ string(53) "79 test 4 Hello, world! Lots and lots and ... of text"
+ [80]=>
+ string(53) "80 test 4 Hello, world! Lots and lots and ... of text"
+ [81]=>
+ string(53) "81 test 4 Hello, world! Lots and lots and ... of text"
+ [82]=>
+ string(53) "82 test 4 Hello, world! Lots and lots and ... of text"
+ [83]=>
+ string(53) "83 test 4 Hello, world! Lots and lots and ... of text"
+ [84]=>
+ string(53) "84 test 4 Hello, world! Lots and lots and ... of text"
+ [85]=>
+ string(53) "85 test 4 Hello, world! Lots and lots and ... of text"
+ [86]=>
+ string(53) "86 test 4 Hello, world! Lots and lots and ... of text"
+ [87]=>
+ string(53) "87 test 4 Hello, world! Lots and lots and ... of text"
+ [88]=>
+ string(53) "88 test 4 Hello, world! Lots and lots and ... of text"
+ [89]=>
+ string(53) "89 test 4 Hello, world! Lots and lots and ... of text"
+ [90]=>
+ string(53) "90 test 4 Hello, world! Lots and lots and ... of text"
+ [91]=>
+ string(53) "91 test 4 Hello, world! Lots and lots and ... of text"
+ [92]=>
+ string(53) "92 test 4 Hello, world! Lots and lots and ... of text"
+ [93]=>
+ string(53) "93 test 4 Hello, world! Lots and lots and ... of text"
+ [94]=>
+ string(53) "94 test 4 Hello, world! Lots and lots and ... of text"
+ [95]=>
+ string(53) "95 test 4 Hello, world! Lots and lots and ... of text"
+ [96]=>
+ string(53) "96 test 4 Hello, world! Lots and lots and ... of text"
+ [97]=>
+ string(53) "97 test 4 Hello, world! Lots and lots and ... of text"
+ [98]=>
+ string(53) "98 test 4 Hello, world! Lots and lots and ... of text"
+ [99]=>
+ string(53) "99 test 4 Hello, world! Lots and lots and ... of text"
+}
+===DONE===
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--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--INI--
+oci8.default_prefetch=20
+--FILE--
+<?php
+
+require(dirname(__FILE__)."/connect.inc");
+
+// Initialize
+
+$stmtarray = array(
+ "drop table default_prefetch_tab",
+ "create table default_prefetch_tab (id number, value number)",
+ "insert into default_prefetch_tab (id, value) values (1,1)",
+ "insert into default_prefetch_tab (id, value) values (1,1)",
+ "insert into default_prefetch_tab (id, value) values (1,1)",
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+// Run Test
+
+$select_sql = "select * from default_prefetch_tab";
+
+if (!($s = oci_parse($c, $select_sql))) {
+ die("oci_parse(select) failed!\n");
+}
+
+if (!oci_execute($s)) {
+ die("oci_execute(select) failed!\n");
+}
+
+var_dump(oci_fetch($s));
+
+var_dump(oci_num_rows($s));
+
+// Cleanup
+
+$stmtarray = array(
+ "drop table default_prefetch_tab"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+echo "Done\n";
+?>
+--EXPECT--
+bool(true)
+int(1)
+Done
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--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require(dirname(__FILE__)."/connect.inc");
+
+// Initialize
+
+$stmtarray = array(
+ "drop table define0_tab",
+ "create table define0_tab (string varchar(10))",
+ "insert into define0_tab (string) values ('some')",
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+// Run test
+
+$stmt = oci_parse($c, "select string from define0_tab");
+
+/* the define MUST be done BEFORE ociexecute! */
+
+echo "Test 1\n";
+
+$string = '';
+oci_define_by_name($stmt, "STRING", $string, 20);
+oci_execute($stmt);
+while (oci_fetch($stmt)) {
+ var_dump($string);
+}
+
+echo "Test 2\n";
+
+$string = '';
+$s2 = oci_parse($c, 'select string from define0_tab');
+oci_define_by_name($s2, 'STRING', $string);
+oci_execute($s2);
+while (oci_fetch($s2)) {
+ var_dump($string);
+}
+
+// Cleanup
+
+$stmtarray = array(
+ "drop table define0_tab"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1
+string(%d) "some"
+Test 2
+string(%d) "some"
+===DONE===
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--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
@@ -12,10 +15,7 @@ $stmtarray = array(
"create table phptestrawtable( id number(10), fileimage raw(1000))"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
$stmt = oci_parse ($c, "insert into phptestrawtable (id, fileimage) values (:id, :fileimage)");
$i=1;
@@ -68,8 +68,13 @@ while (oci_fetch($stmt)) {
echo "file md5:" . md5($fi) . "\n";
}
-$stmt = oci_parse($c, "drop table phptestrawtable");
-oci_execute($stmt);
+// Cleanup
+
+$stmtarray = array(
+ "drop table phptestrawtable"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
?>
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--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
@@ -12,10 +15,7 @@ $stmtarray = array(
"create table phpdefblobtable (id number(10), fileimage blob)"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
// Load data
$stmt = oci_parse ($c, "insert into phpdefblobtable (id, fileimage) values (:id, empty_blob()) returning fileimage into :fileimage");
@@ -75,8 +75,11 @@ while (oci_fetch($stmt)) {
echo "file md5:" . md5($fid->load()) . "\n";
}
-$stmt = oci_parse($c, "drop table phpdefblobtable");
-oci_execute($stmt);
+$stmtarray = array(
+ "drop table phpdefblobtable"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
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--
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+ "drop table define6_tab",
+ "create table define6_tab (id number)",
+ "insert into define6_tab values (1)"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+// Run Test
+
+$sql =
+"DECLARE
+ TYPE curtype IS REF CURSOR;
+ cursor_var curtype;
+BEGIN
+ OPEN cursor_var FOR SELECT id FROM define6_tab;
+ :curs := cursor_var;
+END;";
+
+echo "Test 1 - define last\n";
+
+$s1 = oci_parse($c, $sql);
+$cursor1 = oci_new_cursor($c);
+oci_bind_by_name($s1, ":curs", $cursor1, -1, OCI_B_CURSOR);
+oci_execute($s1);
+oci_execute($cursor1);
+oci_define_by_name($cursor1, 'ID', $id1);
+while (oci_fetch_row($cursor1)) {
+ var_dump($id1);
+}
+
+
+echo "Test 2 - define last with preset var\n";
+
+$s2 = oci_parse($c, $sql);
+$cursor2 = oci_new_cursor($c);
+oci_bind_by_name($s2, ":curs", $cursor2, -1, OCI_B_CURSOR);
+oci_execute($s2);
+oci_execute($cursor2);
+$id2 = '';
+oci_define_by_name($cursor2, 'ID', $id2);
+while (oci_fetch_row($cursor2)) {
+ var_dump($id2);
+}
+
+
+echo "Test 3 - define before cursor execute\n";
+
+$s3 = oci_parse($c, $sql);
+$cursor3 = oci_new_cursor($c);
+oci_bind_by_name($s3, ":curs", $cursor3, -1, OCI_B_CURSOR);
+oci_execute($s3);
+oci_define_by_name($cursor3, 'ID', $id3);
+oci_execute($cursor3);
+while (oci_fetch_row($cursor3)) {
+ var_dump($id3);
+}
+
+
+echo "Test 4 - define before top level execute\n";
+
+$s4 = oci_parse($c, $sql);
+$cursor4 = oci_new_cursor($c);
+oci_bind_by_name($s4, ":curs", $cursor4, -1, OCI_B_CURSOR);
+oci_define_by_name($cursor4, 'ID', $id4);
+oci_execute($s4);
+oci_execute($cursor4);
+while (oci_fetch_row($cursor4)) {
+ var_dump($id4);
+}
+
+
+echo "Test 5 - define before bind\n";
+
+$s5 = oci_parse($c, $sql);
+$cursor5 = oci_new_cursor($c);
+oci_define_by_name($cursor5, 'ID', $id5);
+oci_bind_by_name($s5, ":curs", $cursor5, -1, OCI_B_CURSOR);
+oci_execute($s5);
+oci_execute($cursor5);
+while (oci_fetch_row($cursor5)) {
+ var_dump($id5);
+}
+
+
+echo "Test 6 - fetch on wrong handle\n";
+
+$s6 = oci_parse($c, $sql);
+$cursor6 = oci_new_cursor($c);
+oci_define_by_name($cursor6, 'ID', $id6);
+oci_bind_by_name($s6, ":curs", $cursor6, -1, OCI_B_CURSOR);
+oci_execute($s6);
+oci_execute($cursor6);
+while (oci_fetch_row($s6)) {
+ var_dump($id6);
+}
+
+
+// Clean up
+
+$stmtarray = array(
+ "drop table define6_tab"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1 - define last
+NULL
+Test 2 - define last with preset var
+string(0) ""
+Test 3 - define before cursor execute
+string(1) "1"
+Test 4 - define before top level execute
+string(1) "1"
+Test 5 - define before bind
+string(1) "1"
+Test 6 - fetch on wrong handle
+
+Warning: oci_fetch_row(): ORA-24374: %s in %sdefine6.php on line %d
+===DONE===
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--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/details.inc b/ext/oci8/tests/details.inc
index 922b8c4f49..4c07e636e3 100644
--- a/ext/oci8/tests/details.inc
+++ b/ext/oci8/tests/details.inc
@@ -3,9 +3,6 @@
/*
* Please change $user, $password and $dbase to match your configuration.
*
- * Set $oracle_on_localhost to TRUE if the Oracle Database is
- * installed on your localhost.
- *
* Set $test_drcp to TRUE if you want to run the Oracle Database
* Resident Connection Pooling (DRCP) tests. For these tests to run
* successfully, you need a server and client which is Oracle 11g or
@@ -14,50 +11,76 @@
* string like hostname:port/service_name:POOLED
*
* Set $stress_test to TRUE if you want to run some longer/slower/more
- * memory intensive tests.
+ * memory intensive tests. External configuration such as increasing
+ * the timeout of run-tests.php may also be needed.
*/
if (file_exists(dirname(__FILE__)."/details_local.inc")) {
- include(dirname(__FILE__)."/details_local.inc"); // this file is not part of the source distribution; make it your own local variant of details.inc
+ include(dirname(__FILE__)."/details_local.inc"); // this file is not part of the source distribution; make it your own local variant of details.inc
} else {
- if (false !== getenv('PHP_OCI8_TEST_DB')) {
- $user = getenv('PHP_OCI8_TEST_USER'); // Database username for tests
- $password = getenv('PHP_OCI8_TEST_PASS'); // Password for $user
- $dbase = getenv('PHP_OCI8_TEST_DB'); // Database connection string
- $test_drcp = getenv('PHP_OCI8_TEST_DRCP');
- if (false !== $test_drcp && 0 == strcasecmp($test_drcp,'TRUE')) {
- $test_drcp = TRUE;
- } else {
- $test_drcp = FALSE;
- }
- $oracle_on_localhost = getenv('PHP_OCI8_TEST_DB_ON_LOCALHOST');
- if (false !== $oracle_on_localhost && 0 == strcasecmp($oracle_on_localhost,'TRUE')) {
- $oracle_on_localhost = TRUE;
- } else {
- $oracle_on_localhost = FALSE;
- }
- $stress_test = getenv('PHP_OCI8_STRESS_TEST');
- if (false !== $stress_test && 0 == strcasecmp($stress_test,'TRUE')) {
- $stress_test = TRUE;
- } else {
- $stress_test = FALSE;
- }
- } else {
- $user = "system";
- $password = "oracle";
- $dbase = "localhost/XE";
- $oracle_on_localhost = TRUE;
- $test_drcp = FALSE;
- $stress_test = FALSE;
- }
-
- /*
- * Common object names for scripts to use
- */
-
- $table_name = "tb".substr(str_replace(Array(".", "-"), "_", php_uname("n")), 0, 5);
- $type_name = strtoupper("tp".substr(str_replace(Array(".", "-"), "_", php_uname("n")), 0, 5));
- $schema = '';
+ if (false !== getenv('PHP_OCI8_TEST_DB')) {
+ $user = getenv('PHP_OCI8_TEST_USER'); // Database username for tests
+ $password = getenv('PHP_OCI8_TEST_PASS'); // Password for $user
+ $dbase = getenv('PHP_OCI8_TEST_DB'); // Database connection string
+ $test_drcp = getenv('PHP_OCI8_TEST_DRCP');
+ $stress_test = getenv('PHP_OCI8_STRESS_TEST');
+ if (false !== $test_drcp && 0 == strcasecmp($test_drcp,'TRUE')) {
+ $test_drcp = TRUE;
+ } else {
+ $test_drcp = FALSE;
+ }
+ if (false !== $stress_test && 0 == strcasecmp($stress_test,'TRUE')) {
+ $stress_test = TRUE;
+ } else {
+ $stress_test = FALSE;
+ }
+ } else {
+ $user = "system";
+ $password = "oracle";
+ $dbase = "localhost/XE";
+ $test_drcp = FALSE;
+ $stress_test = FALSE;
+ }
+
+ /*
+ * Common object names for scripts to use
+ */
+
+ $table_name = "tb".substr(str_replace(Array(".", "-"), "_", php_uname("n")), 0, 5);
+ $type_name = strtoupper("tp".substr(str_replace(Array(".", "-"), "_", php_uname("n")), 0, 5));
+ $schema = '';
+}
+
+
+/*
+ * Used for creating/dropping schema objects used by a test
+ */
+
+function oci8_test_sql_execute($c, $stmtarray)
+{
+ foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ if (!$s) {
+ $m = oci_error($c);
+ echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
+ }
+ else {
+ $r = @oci_execute($s);
+ if (!$r) {
+ $m = oci_error($s);
+ if (!in_array($m['code'], array( // ignore expected errors
+ 942 // table or view does not exist
+ , 1918 // user does not exist
+ , 2024 // database link not found
+ , 2289 // sequence does not exist
+ , 4080 // trigger does not exist
+ , 38802 // edition does not exist
+ ))) {
+ echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
+ }
+ }
+ }
+ }
}
?>
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--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs (Calling PL/SQL from SQL is not supported in TimesTen)
+require(dirname(__FILE__).'/skipif.inc');
+?>
--INI--
oci8.connection_class=test
oci8.old_oci_close_semantics=0
@@ -16,10 +19,12 @@ require dirname(__FILE__)."/drcp_functions.inc";
// To verify this, we change the value of a PL/SQL package variable in one
// session and query for this through another connection
+echo "Test 1a\n";
var_dump($conn1 = oci_connect($user,$password,$dbase));
// Create the package
drcp_create_package($conn1);
-
+
+echo "Test 1b\n";
// OCI_CONNECT
echo " This is with OCI_CONNECT.....\n";
drcp_select_packagevar($conn1); // Returns 0
@@ -27,12 +32,14 @@ drcp_set_packagevar($conn1,1000);
oci_close($conn1);
echo " Connection conn1 closed....\n";
+echo "Test 2\n";
// Second connection should return 0 for the package variable.
var_dump($conn2 = oci_connect($user,$password,$dbase));
echo " Select with connection 2 \n";
drcp_select_packagevar($conn2); // Returns 0
drcp_set_packagevar($conn2,100);
+echo "Test 3\n";
// Third connection. There is no oci_close() for conn2 hence this should
// return the value set by conn2.
var_dump($conn3 = oci_connect($user,$password,$dbase));
@@ -43,8 +50,9 @@ drcp_select_packagevar($conn3); // Returns 100
oci_close($conn2);
oci_close($conn3);
+echo "Test 4\n";
// OCI_PCONNECT
-echo "\n This is with oci_pconnect().....\n";
+echo " This is with oci_pconnect().....\n";
var_dump($pconn1 = oci_pconnect($user,$password,$dbase));
drcp_set_packagevar($pconn1,1000);
oci_close($pconn1);
@@ -53,6 +61,7 @@ echo " Connection pconn1 closed....\n";
// Second connection with oci_pconnect should return the same session hence the
// value returned is what is set by pconn1
+echo "Test 5\n";
var_dump($pconn2 = oci_pconnect($user,$password,$dbase));
echo " Select with persistent connection 2 \n";
drcp_select_packagevar($pconn2); // Returns 1000
@@ -62,23 +71,28 @@ echo "Done\n";
?>
--EXPECTF--
+Test 1a
resource(%d) of type (oci8 connection)
+Test 1b
This is with OCI_CONNECT.....
The value of the package variable is 0
Package variable value set to 1000
Connection conn1 closed....
+Test 2
resource(%d) of type (oci8 connection)
Select with connection 2
The value of the package variable is 0
Package variable value set to 100
+Test 3
resource(%d) of type (oci8 connection)
Select with connection 3
The value of the package variable is 100
-
+Test 4
This is with oci_pconnect().....
resource(%d) of type (oci8 persistent connection)
Package variable value set to 1000
Connection pconn1 closed....
+Test 5
resource(%d) of type (oci8 persistent connection)
Select with persistent connection 2
The value of the package variable is 1000
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--
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+ "drop table dupcolnames_tab1",
+ "drop table dupcolnames_tab2",
+
+ "create table dupcolnames_tab1 (c1 number, dupnamecol varchar2(20))",
+ "create table dupcolnames_tab2 (c2 number, dupnamecol varchar2(20))",
+
+ "insert into dupcolnames_tab1 (c1, dupnamecol) values (1, 'chris')",
+ "insert into dupcolnames_tab2 (c2, dupnamecol) values (2, 'jones')",
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+// Run Test
+
+echo "Test 1 - OCI_ASSOC\n";
+$s = oci_parse($c, "select * from dupcolnames_tab1, dupcolnames_tab2");
+oci_execute($s);
+while (($r = oci_fetch_array($s, OCI_ASSOC)) != false) {
+ var_dump($r);
+}
+
+
+echo "\nTest 2 - OCI_NUM\n";
+$s = oci_parse($c, "select * from dupcolnames_tab1, dupcolnames_tab2");
+oci_execute($s);
+while (($r = oci_fetch_array($s, OCI_NUM)) != false) {
+ var_dump($r);
+}
+
+
+echo "\nTest 3 - OCI_ASSOC+OCI_NUM\n";
+$s = oci_parse($c, "select * from dupcolnames_tab1, dupcolnames_tab2");
+oci_execute($s);
+while (($r = oci_fetch_array($s, OCI_ASSOC+OCI_NUM)) != false) {
+ var_dump($r);
+}
+
+// Clean up
+
+$stmtarray = array(
+ "drop table dupcolnames_tab1",
+ "drop table dupcolnames_tab2",
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1 - OCI_ASSOC
+array(3) {
+ ["C1"]=>
+ string(1) "1"
+ ["DUPNAMECOL"]=>
+ string(5) "jones"
+ ["C2"]=>
+ string(1) "2"
+}
+
+Test 2 - OCI_NUM
+array(4) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(5) "chris"
+ [2]=>
+ string(1) "2"
+ [3]=>
+ string(5) "jones"
+}
+
+Test 3 - OCI_ASSOC+OCI_NUM
+array(7) {
+ [0]=>
+ string(1) "1"
+ ["C1"]=>
+ string(1) "1"
+ [1]=>
+ string(5) "chris"
+ ["DUPNAMECOL"]=>
+ string(5) "jones"
+ [2]=>
+ string(1) "2"
+ ["C2"]=>
+ string(1) "2"
+ [3]=>
+ string(5) "jones"
+}
+===DONE===
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
<?php
if (!extension_loaded('oci8')) die("skip no oci8 extension");
require(dirname(__FILE__)."/connect.inc");
-if (strcasecmp($user, "system") && strcasecmp($user, "sys"))
+if (strcasecmp($user, "system") && strcasecmp($user, "sys")) {
die("skip needs to be run as a DBA user");
-if ($test_drcp)
+}
+if ($test_drcp) {
die("skip as Output might vary with DRCP");
-
-$sv = oci_server_version($c);
-$sv = preg_match('/Release (11\.2|12)/', $sv, $matches);
-if ($sv == 1) {
- ob_start();
- phpinfo(INFO_MODULES);
- $phpinfo = ob_get_clean();
- $iv = preg_match('/Oracle .*Version => (11\.2|12)/', $phpinfo);
- if ($iv != 1) {
- die ("skip tests a feature that works only with Oracle 11gR2 or greater version of client");
- }
}
-else {
- die ("skip tests a feature that works only with Oracle 11gR2 or greater version of server");
+if (preg_match('/Release (1[1]\.2|12)\./', oci_server_version($c), $matches) !== 1) {
+ die("skip expected output only valid when using Oracle 11gR2 or greater databases");
+} else if (preg_match('/^(11\.2|12)\./', oci_client_version()) != 1) {
+ die("skip test expected to work only with Oracle 11gR2 or greater version of client");
}
-
?>
--FILE--
<?php
@@ -62,10 +53,7 @@ $stmtarray = array(
"create or replace editioning view view_ed as select name,age,job from edit_tab",
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($conn, $stmt);
- @oci_execute($s);
-}
+oci8_test_sql_execute($conn, $stmtarray);
// Check the current edition of the DB and the contents of view_ed.
get_edit_attr($conn);
diff --git a/ext/oci8/tests/edition_2.phpt b/ext/oci8/tests/edition_2.phpt
index f7ab979bcf..030e6a673c 100644
--- a/ext/oci8/tests/edition_2.phpt
+++ b/ext/oci8/tests/edition_2.phpt
@@ -9,19 +9,10 @@ if (strcasecmp($user, "system") && strcasecmp($user, "sys"))
if ($test_drcp)
die("skip as Output might vary with DRCP");
-$sv = oci_server_version($c);
-$sv = preg_match('/Release (11\.2|12)/', $sv, $matches);
-if ($sv == 1) {
- ob_start();
- phpinfo(INFO_MODULES);
- $phpinfo = ob_get_clean();
- $iv = preg_match('/Oracle .*Version => (11\.2|12)/', $phpinfo);
- if ($iv != 1) {
- die ("skip tests a feature that works only with Oracle 11gR2 or greater version of client");
- }
-}
-else {
- die ("skip tests a feature that works only with Oracle 11gR2 or greater version of server");
+if (preg_match('/Release (1[1]\.2|12)\./', oci_server_version($c), $matches) !== 1) {
+ die("skip expected output only valid when using Oracle 11gR2 or greater databases");
+} else if (preg_match('/^(11\.2|12)\./', oci_client_version()) != 1) {
+ die("skip test expected to work only with Oracle 11gR2 or greater version of client");
}
?>
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--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs: different error messages from TimesTen
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
require dirname(__FILE__)."/connect.inc";
if (!empty($dbase)) {
- var_dump(oci_connect($user, $password, $dbase));
+ var_dump(oci_connect($user, $password, $dbase));
}
else {
- var_dump(oci_connect($user, $password));
+ var_dump(oci_connect($user, $password));
}
var_dump($s = oci_parse($c, "WRONG SYNTAX"));
@@ -25,13 +28,13 @@ echo "Done\n";
resource(%s) of type (oci8 connection)
resource(%s) of type (oci8 statement)
-Warning: oci_execute(): ORA-00900: invalid SQL statement in %s on line %d
+Warning: oci_execute(): ORA-00900: %s in %s on line %d
bool(false)
array(4) {
["code"]=>
int(900)
["message"]=>
- string(32) "ORA-00900: invalid SQL statement"
+ string(%d) "ORA-00900: %s"
["offset"]=>
int(0)
["sqltext"]=>
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--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+if ($stress_test !== true) die ('skip Slow test not run when $stress_test is FALSE');
+?>
--FILE--
<?php
-require dirname(__FILE__).'/connect.inc';
+require(dirname(__FILE__).'/connect.inc');
ini_set('error_reporting', E_ALL);
@@ -20,5 +24,5 @@ echo "Done\n";
?>
--EXPECTF--
-ORA-24344: success with compilation error
+ORA-24344: %s
Done
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--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs: different error messages from TimesTen
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
require dirname(__FILE__)."/connect.inc";
if (!empty($dbase)) {
- var_dump(ocilogon($user, $password, $dbase));
+ var_dump(ocilogon($user, $password, $dbase));
}
else {
- var_dump(ocilogon($user, $password));
+ var_dump(ocilogon($user, $password));
}
var_dump($s = ociparse($c, "WRONG SYNTAX"));
@@ -25,13 +28,13 @@ echo "Done\n";
resource(%s) of type (oci8 connection)
resource(%s) of type (oci8 statement)
-Warning: ociexecute(): ORA-00900: invalid SQL statement in %s on line %d
+Warning: ociexecute(): ORA-00900: %s in %s on line %d
bool(false)
array(4) {
["code"]=>
int(900)
["message"]=>
- string(32) "ORA-00900: invalid SQL statement"
+ string(%d) "ORA-00900: %s"
["offset"]=>
int(0)
["sqltext"]=>
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--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require(dirname(__FILE__)."/connect.inc");
+
+// Initialize
+
+$stmtarray = array(
+ "drop table fetch_all_tab",
+ "create table fetch_all_tab (id number, value number)",
+ "insert into fetch_all_tab (id, value) values (1,1)",
+ "insert into fetch_all_tab (id, value) values (1,1)",
+ "insert into fetch_all_tab (id, value) values (1,1)"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+if (!($s = oci_parse($c, "select * from fetch_all_tab"))) {
+ die("oci_parse(select) failed!\n");
+}
+
+/* oci_fetch_all */
+if (!oci_execute($s)) {
+ die("oci_execute(select) failed!\n");
+}
+var_dump(oci_fetch_all($s, $all));
+var_dump($all);
+
+/* ocifetchstatement */
+if (!oci_execute($s)) {
+ die("oci_execute(select) failed!\n");
+}
+
+var_dump(ocifetchstatement($s, $all));
+var_dump($all);
+
+// Cleanup
+
+$stmtarray = array(
+ "drop table fetch_all_tab"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+echo "Done\n";
+?>
+--EXPECTF--
+int(3)
+array(2) {
+ [%u|b%"ID"]=>
+ array(3) {
+ [0]=>
+ %unicode|string%(1) "1"
+ [1]=>
+ %unicode|string%(1) "1"
+ [2]=>
+ %unicode|string%(1) "1"
+ }
+ [%u|b%"VALUE"]=>
+ array(3) {
+ [0]=>
+ %unicode|string%(1) "1"
+ [1]=>
+ %unicode|string%(1) "1"
+ [2]=>
+ %unicode|string%(1) "1"
+ }
+}
+int(3)
+array(2) {
+ [%u|b%"ID"]=>
+ array(3) {
+ [0]=>
+ %unicode|string%(1) "1"
+ [1]=>
+ %unicode|string%(1) "1"
+ [2]=>
+ %unicode|string%(1) "1"
+ }
+ [%u|b%"VALUE"]=>
+ array(3) {
+ [0]=>
+ %unicode|string%(1) "1"
+ [1]=>
+ %unicode|string%(1) "1"
+ [2]=>
+ %unicode|string%(1) "1"
+ }
+}
+Done
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--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/fetch_all3.phpt b/ext/oci8/tests/fetch_all3.phpt
index 42fe617dc9..1748ea5658 100644
--- a/ext/oci8/tests/fetch_all3.phpt
+++ b/ext/oci8/tests/fetch_all3.phpt
@@ -14,28 +14,12 @@ $stmtarray = array(
"create table fetch_all3_tab (id number, value number)",
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- $r = @oci_execute($s);
- if (!$r) {
- $m = oci_error($s);
- if (!in_array($m['code'], array( // ignore expected errors
- 942 // table or view does not exist
- ))) {
- echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
- }
- }
-}
-
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
$insert_sql = "insert into fetch_all3_tab (id, value) values (:idbv,:vbv)";
$s = oci_parse($c, $insert_sql);
-oci_bind_by_name($s, ":idbv", $idbv, SQLT_INT);
-oci_bind_by_name($s, ":vbv", $vbv, SQLT_INT);
+oci_bind_by_name($s, ":idbv", $idbv, -1, SQLT_INT);
+oci_bind_by_name($s, ":vbv", $vbv, -1, SQLT_INT);
for ($i = 1; $i <= 4; $i++) {
$idbv = $i;
@@ -137,10 +121,7 @@ $stmtarray = array(
"drop table fetch_all3_tab"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
?>
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--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
@@ -24,6 +27,8 @@ if (!oci_commit($c)) {
die("oci_commit() failed!\n");
}
+echo "Test 1\n";
+
$select_sql = "SELECT * FROM ".$schema."".$table_name."";
if (!($s = oci_parse($c, $select_sql))) {
@@ -37,6 +42,8 @@ while ($row = oci_fetch_array($s)) {
var_dump($row);
}
+echo "Test 2\n";
+
if (!oci_execute($s)) {
die("oci_execute(select) failed!\n");
}
@@ -44,6 +51,8 @@ while ($row = oci_fetch_array($s, OCI_NUM)) {
var_dump($row);
}
+echo "Test 3\n";
+
if (!oci_execute($s)) {
die("oci_execute(select) failed!\n");
}
@@ -51,6 +60,8 @@ while ($row = oci_fetch_array($s, OCI_ASSOC)) {
var_dump($row);
}
+echo "Test 4\n";
+
if (!oci_execute($s)) {
die("oci_execute(select) failed!\n");
}
@@ -58,6 +69,8 @@ while ($row = oci_fetch_array($s, OCI_BOTH)) {
var_dump($row);
}
+echo "Test 5\n";
+
if (!oci_execute($s)) {
die("oci_execute(select) failed!\n");
}
@@ -65,6 +78,8 @@ while ($row = oci_fetch_array($s, OCI_RETURN_LOBS)) {
var_dump($row);
}
+echo "Test 6\n";
+
if (!oci_execute($s)) {
die("oci_execute(select) failed!\n");
}
@@ -72,11 +87,21 @@ while ($row = oci_fetch_array($s, OCI_RETURN_NULLS)) {
var_dump($row);
}
+echo "Test 7\n";
+
+if (!oci_execute($s)) {
+ die("oci_execute(select) failed!\n");
+}
+while ($row = oci_fetch_array($s, OCI_NUM+OCI_RETURN_NULLS)) {
+ var_dump($row);
+}
+
require dirname(__FILE__).'/drop_table.inc';
echo "Done\n";
?>
--EXPECT--
+Test 1
array(10) {
[0]=>
string(1) "1"
@@ -143,6 +168,7 @@ array(10) {
["STRING"]=>
NULL
}
+Test 2
array(2) {
[0]=>
string(1) "1"
@@ -161,6 +187,7 @@ array(2) {
[1]=>
string(1) "1"
}
+Test 3
array(2) {
["ID"]=>
string(1) "1"
@@ -179,6 +206,7 @@ array(2) {
["VALUE"]=>
string(1) "1"
}
+Test 4
array(4) {
[0]=>
string(1) "1"
@@ -209,6 +237,7 @@ array(4) {
["VALUE"]=>
string(1) "1"
}
+Test 5
array(4) {
[0]=>
string(1) "1"
@@ -239,6 +268,7 @@ array(4) {
["VALUE"]=>
string(1) "1"
}
+Test 6
array(10) {
[0]=>
string(1) "1"
@@ -305,4 +335,42 @@ array(10) {
["STRING"]=>
NULL
}
+Test 7
+array(5) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "1"
+ [2]=>
+ NULL
+ [3]=>
+ NULL
+ [4]=>
+ NULL
+}
+array(5) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "1"
+ [2]=>
+ NULL
+ [3]=>
+ NULL
+ [4]=>
+ NULL
+}
+array(5) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "1"
+ [2]=>
+ NULL
+ [3]=>
+ NULL
+ [4]=>
+ NULL
+}
Done
+
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--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
--FILE--
<?php
require dirname(__FILE__)."/connect.inc";
-require dirname(__FILE__).'/create_table.inc';
-$insert_sql = "INSERT INTO ".$schema."".$table_name." (id, value) VALUES (1,1)";
+$stmtarray = array(
+ "drop table fetch_assoc_tab",
+ "create table fetch_assoc_tab (id number, value number, dummy varchar2(20))",
+ "insert into fetch_assoc_tab values (1,1,null)",
+ "insert into fetch_assoc_tab values (1,1,null)",
+ "insert into fetch_assoc_tab values (1,1,null)"
+);
-if (!($s = oci_parse($c, $insert_sql))) {
- die("oci_parse(insert) failed!\n");
-}
-
-for ($i = 0; $i<3; $i++) {
- if (!oci_execute($s)) {
- die("oci_execute(insert) failed!\n");
- }
-}
+oci8_test_sql_execute($c, $stmtarray);
-if (!oci_commit($c)) {
- die("oci_commit() failed!\n");
-}
-
-$select_sql = "SELECT * FROM ".$schema."".$table_name."";
+$select_sql = "select * from fetch_assoc_tab";
if (!($s = oci_parse($c, $select_sql))) {
die("oci_parse(select) failed!\n");
@@ -37,46 +30,40 @@ while ($row = oci_fetch_assoc($s)) {
var_dump($row);
}
-require dirname(__FILE__).'/drop_table.inc';
+// Clean up
+
+$stmtarray = array(
+ "drop table fetch_assoc_tab"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
?>
--EXPECT--
-array(5) {
+array(3) {
["ID"]=>
string(1) "1"
["VALUE"]=>
string(1) "1"
- ["BLOB"]=>
- NULL
- ["CLOB"]=>
- NULL
- ["STRING"]=>
+ ["DUMMY"]=>
NULL
}
-array(5) {
+array(3) {
["ID"]=>
string(1) "1"
["VALUE"]=>
string(1) "1"
- ["BLOB"]=>
- NULL
- ["CLOB"]=>
- NULL
- ["STRING"]=>
+ ["DUMMY"]=>
NULL
}
-array(5) {
+array(3) {
["ID"]=>
string(1) "1"
["VALUE"]=>
string(1) "1"
- ["BLOB"]=>
- NULL
- ["CLOB"]=>
- NULL
- ["STRING"]=>
+ ["DUMMY"]=>
NULL
}
Done
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--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/fetch_into2.phpt b/ext/oci8/tests/fetch_into2.phpt
index c196d39f62..7bef2c0821 100644
--- a/ext/oci8/tests/fetch_into2.phpt
+++ b/ext/oci8/tests/fetch_into2.phpt
@@ -1,7 +1,10 @@
--TEST--
ocifetchinto() & wrong number of params
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/fetch_object.phpt b/ext/oci8/tests/fetch_object.phpt
index 674a88ff28..1c290d5e95 100644
--- a/ext/oci8/tests/fetch_object.phpt
+++ b/ext/oci8/tests/fetch_object.phpt
@@ -1,7 +1,10 @@
--TEST--
oci_fetch_object()
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
@@ -10,53 +13,39 @@ require(dirname(__FILE__).'/connect.inc');
// Initialization
$stmtarray = array(
- "drop table fetch_object_tab",
- "create table fetch_object_tab (\"caseSensitive\" number, secondcol varchar2(20), anothercol char(15))",
- "insert into fetch_object_tab values (123, '1st row col2 string', '1 more text')",
- "insert into fetch_object_tab values (456, '2nd row col2 string', '2 more text')",
- "insert into fetch_object_tab values (789, '3rd row col2 string', '3 more text')",
+ "drop table fetch_object_tab",
+ "create table fetch_object_tab (\"caseSensitive\" number, secondcol varchar2(20), anothercol char(15))",
+ "insert into fetch_object_tab values (123, '1st row col2 string', '1 more text')",
+ "insert into fetch_object_tab values (456, '2nd row col2 string', '2 more text')",
+ "insert into fetch_object_tab values (789, '3rd row col2 string', '3 more text')",
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- $r = @oci_execute($s);
- if (!$r) {
- $m = oci_error($s);
- if (!in_array($m['code'], array( // ignore expected errors
- 942 // table or view does not exist
- , 2289 // sequence does not exist
- , 4080 // trigger does not exist
- , 38802 // edition does not exist
- ))) {
- echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
- }
- }
-}
+oci8_test_sql_execute($c, $stmtarray);
// Run Test
echo "Test 1\n";
if (!($s = oci_parse($c, 'select * from fetch_object_tab'))) {
- die("oci_parse(select) failed!\n");
+ die("oci_parse(select) failed!\n");
}
if (!oci_execute($s)) {
- die("oci_execute(select) failed!\n");
+ die("oci_execute(select) failed!\n");
}
while ($row = oci_fetch_object($s)) {
- var_dump($row);
+ var_dump($row);
}
echo "Test 2\n";
if (!($s = oci_parse($c, 'select * from fetch_object_tab'))) {
- die("oci_parse(select) failed!\n");
+ die("oci_parse(select) failed!\n");
}
if (!oci_execute($s)) {
- die("oci_execute(select) failed!\n");
+ die("oci_execute(select) failed!\n");
}
while ($row = oci_fetch_object($s)) {
@@ -68,11 +57,11 @@ while ($row = oci_fetch_object($s)) {
echo "Test 3\n";
if (!($s = oci_parse($c, 'select * from fetch_object_tab where rownum < 2 order by "caseSensitive"'))) {
- die("oci_parse(select) failed!\n");
+ die("oci_parse(select) failed!\n");
}
if (!oci_execute($s)) {
- die("oci_execute(select) failed!\n");
+ die("oci_execute(select) failed!\n");
}
$row = oci_fetch_object($s);
@@ -82,13 +71,10 @@ echo $row->CASESENSITIVE . "\n";
// Clean up
$stmtarray = array(
- "drop table fetch_object_tab"
+ "drop table fetch_object_tab"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
?>
===DONE===
diff --git a/ext/oci8/tests/fetch_object_1.phpt b/ext/oci8/tests/fetch_object_1.phpt
new file mode 100644
index 0000000000..4f14a5ec04
--- /dev/null
+++ b/ext/oci8/tests/fetch_object_1.phpt
@@ -0,0 +1,123 @@
+--TEST--
+oci_fetch_object()
+--SKIPIF--
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+ "drop table fetch_object_tab",
+ "create table fetch_object_tab (\"caseSensitive\" number, secondcol varchar2(20), anothercol char(15))",
+ "insert into fetch_object_tab values (123, '1st row col2 string', '1 more text')",
+ "insert into fetch_object_tab values (456, '2nd row col2 string', '2 more text')",
+ "insert into fetch_object_tab values (789, '3rd row col2 string', '3 more text')",
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+// Run Test
+
+echo "Test 1\n";
+
+if (!($s = oci_parse($c, 'select * from fetch_object_tab'))) {
+ die("oci_parse(select) failed!\n");
+}
+
+if (!oci_execute($s)) {
+ die("oci_execute(select) failed!\n");
+}
+
+while ($row = oci_fetch_object($s)) {
+ var_dump($row);
+}
+
+echo "Test 2\n";
+
+if (!($s = oci_parse($c, 'select * from fetch_object_tab'))) {
+ die("oci_parse(select) failed!\n");
+}
+
+if (!oci_execute($s)) {
+ die("oci_execute(select) failed!\n");
+}
+
+while ($row = oci_fetch_object($s)) {
+ echo $row->caseSensitive . "\n";
+ echo $row->SECONDCOL . "\n";
+ echo $row->ANOTHERCOL . "\n";
+}
+
+echo "Test 3\n";
+
+if (!($s = oci_parse($c, 'select * from fetch_object_tab where rownum < 2 order by "caseSensitive"'))) {
+ die("oci_parse(select) failed!\n");
+}
+
+if (!oci_execute($s)) {
+ die("oci_execute(select) failed!\n");
+}
+
+$row = oci_fetch_object($s);
+echo $row->caseSensitive . "\n";
+echo $row->CASESENSITIVE . "\n";
+
+// Clean up
+
+$stmtarray = array(
+ "drop table fetch_object_tab"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1
+object(stdClass)#%d (3) {
+ ["caseSensitive"]=>
+ string(3) "123"
+ ["SECONDCOL"]=>
+ string(19) "1st row col2 string"
+ ["ANOTHERCOL"]=>
+ string(15) "1 more text "
+}
+object(stdClass)#%d (3) {
+ ["caseSensitive"]=>
+ string(3) "456"
+ ["SECONDCOL"]=>
+ string(19) "2nd row col2 string"
+ ["ANOTHERCOL"]=>
+ string(15) "2 more text "
+}
+object(stdClass)#%d (3) {
+ ["caseSensitive"]=>
+ string(3) "789"
+ ["SECONDCOL"]=>
+ string(19) "3rd row col2 string"
+ ["ANOTHERCOL"]=>
+ string(15) "3 more text "
+}
+Test 2
+123
+1st row col2 string
+1 more text
+456
+2nd row col2 string
+2 more text
+789
+3rd row col2 string
+3 more text
+Test 3
+123
+
+Notice: Undefined property: stdClass::$CASESENSITIVE in %sfetch_object_1.php on line %d
+
+===DONE===
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--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
@@ -10,53 +13,39 @@ require(dirname(__FILE__).'/connect.inc');
// Initialization
$stmtarray = array(
- "drop table fetch_object_2_tab",
- "create table fetch_object_2_tab (col1 number, col2 CLOB, col3 varchar2(15))",
- "insert into fetch_object_2_tab values (123, '1st row col2 string', '1 more text')",
- "insert into fetch_object_2_tab values (456, '2nd row col2 string', NULL)",
- "insert into fetch_object_2_tab values (789, '3rd row col2 string', '3 more text')",
+ "drop table fetch_object_2_tab",
+ "create table fetch_object_2_tab (col1 number, col2 CLOB, col3 varchar2(15))",
+ "insert into fetch_object_2_tab values (123, '1st row col2 string', '1 more text')",
+ "insert into fetch_object_2_tab values (456, '2nd row col2 string', NULL)",
+ "insert into fetch_object_2_tab values (789, '3rd row col2 string', '3 more text')",
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- $r = @oci_execute($s);
- if (!$r) {
- $m = oci_error($s);
- if (!in_array($m['code'], array( // ignore expected errors
- 942 // table or view does not exist
- , 2289 // sequence does not exist
- , 4080 // trigger does not exist
- , 38802 // edition does not exist
- ))) {
- echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
- }
- }
-}
+oci8_test_sql_execute($c, $stmtarray);
// Run Test
echo "Test 1\n";
if (!($s = oci_parse($c, 'select * from fetch_object_2_tab order by 1'))) {
- die("oci_parse(select) failed!\n");
+ die("oci_parse(select) failed!\n");
}
if (!oci_execute($s)) {
- die("oci_execute(select) failed!\n");
+ die("oci_execute(select) failed!\n");
}
while ($row = oci_fetch_object($s)) {
- var_dump($row);
+ var_dump($row);
}
echo "Test 2\n";
if (!($s = oci_parse($c, 'select * from fetch_object_2_tab order by 1'))) {
- die("oci_parse(select) failed!\n");
+ die("oci_parse(select) failed!\n");
}
if (!oci_execute($s)) {
- die("oci_execute(select) failed!\n");
+ die("oci_execute(select) failed!\n");
}
while ($row = oci_fetch_object($s)) {
@@ -68,13 +57,10 @@ while ($row = oci_fetch_object($s)) {
// Clean up
$stmtarray = array(
- "drop table fetch_object_2_tab"
+ "drop table fetch_object_2_tab"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
?>
===DONE===
@@ -82,37 +68,37 @@ foreach ($stmtarray as $stmt) {
--EXPECTF--
Test 1
object(stdClass)#%d (3) {
- [%u|b%"COL1"]=>
- %unicode|string%(3) "123"
- [%u|b%"COL2"]=>
+ ["COL1"]=>
+ string(3) "123"
+ ["COL2"]=>
object(OCI-Lob)#%d (1) {
- [%u|b%"descriptor"]=>
+ ["descriptor"]=>
resource(%d) of type (oci8 descriptor)
}
- [%u|b%"COL3"]=>
- %unicode|string%(11) "1 more text"
+ ["COL3"]=>
+ string(11) "1 more text"
}
object(stdClass)#%d (3) {
- [%u|b%"COL1"]=>
- %unicode|string%(3) "456"
- [%u|b%"COL2"]=>
+ ["COL1"]=>
+ string(3) "456"
+ ["COL2"]=>
object(OCI-Lob)#%d (1) {
- [%u|b%"descriptor"]=>
+ ["descriptor"]=>
resource(%d) of type (oci8 descriptor)
}
- [%u|b%"COL3"]=>
+ ["COL3"]=>
NULL
}
object(stdClass)#%d (3) {
- [%u|b%"COL1"]=>
- %unicode|string%(3) "789"
- [%u|b%"COL2"]=>
+ ["COL1"]=>
+ string(3) "789"
+ ["COL2"]=>
object(OCI-Lob)#%d (1) {
- [%u|b%"descriptor"]=>
+ ["descriptor"]=>
resource(%d) of type (oci8 descriptor)
}
- [%u|b%"COL3"]=>
- %unicode|string%(11) "3 more text"
+ ["COL3"]=>
+ string(11) "3 more text"
}
Test 2
123
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--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/field_funcs0.phpt b/ext/oci8/tests/field_funcs0.phpt
new file mode 100644
index 0000000000..5448fcbc34
--- /dev/null
+++ b/ext/oci8/tests/field_funcs0.phpt
@@ -0,0 +1,108 @@
+--TEST--
+oci_field_*() family
+--SKIPIF--
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+require dirname(__FILE__).'/create_table.inc';
+
+$insert_sql = "INSERT INTO ".$schema."".$table_name." (id, value) VALUES (1,1)";
+
+if (!($s = oci_parse($c, $insert_sql))) {
+ die("oci_parse(insert) failed!\n");
+}
+
+for ($i = 0; $i<3; $i++) {
+ if (!oci_execute($s)) {
+ die("oci_execute(insert) failed!\n");
+ }
+}
+
+if (!oci_commit($c)) {
+ die("oci_commit() failed!\n");
+}
+
+$select_sql = "SELECT * FROM ".$schema."".$table_name."";
+
+if (!($s = oci_parse($c, $select_sql))) {
+ die("oci_parse(select) failed!\n");
+}
+
+if (!oci_execute($s)) {
+ die("oci_execute(select) failed!\n");
+}
+
+$row = oci_fetch_array($s, OCI_NUM + OCI_RETURN_NULLS + OCI_RETURN_LOBS);
+var_dump($row);
+
+foreach ($row as $num => $field) {
+ $num++;
+ var_dump(oci_field_is_null($s, $num));
+ var_dump(oci_field_name($s, $num));
+ var_dump(oci_field_type($s, $num));
+ var_dump(oci_field_type_raw($s, $num));
+ var_dump(oci_field_scale($s, $num));
+ var_dump(oci_field_precision($s, $num));
+ var_dump(oci_field_size($s, $num));
+}
+
+
+require dirname(__FILE__).'/drop_table.inc';
+
+echo "Done\n";
+
+?>
+--EXPECT--
+array(5) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "1"
+ [2]=>
+ NULL
+ [3]=>
+ NULL
+ [4]=>
+ NULL
+}
+bool(false)
+string(2) "ID"
+string(6) "NUMBER"
+int(2)
+int(-127)
+int(0)
+int(22)
+bool(false)
+string(5) "VALUE"
+string(6) "NUMBER"
+int(2)
+int(-127)
+int(0)
+int(22)
+bool(true)
+string(4) "BLOB"
+string(4) "BLOB"
+int(113)
+int(0)
+int(0)
+int(4000)
+bool(true)
+string(4) "CLOB"
+string(4) "CLOB"
+int(112)
+int(0)
+int(0)
+int(4000)
+bool(true)
+string(6) "STRING"
+string(8) "VARCHAR2"
+int(1)
+int(0)
+int(0)
+int(10)
+Done
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--
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
--FILE--
@@ -14,40 +14,25 @@ $stmtarray = array(
"create table field_funcs1_tab (id number, value number)",
"insert into field_funcs1_tab (id, value) values (1,1)",
"insert into field_funcs1_tab (id, value) values (1,1)",
- "insert into field_funcs1_tab (id, value) values (1,1)",
+ "insert into field_funcs1_tab (id, value) values (1,1)"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- $r = @oci_execute($s);
- if (!$r) {
- $m = oci_error($s);
- if (!in_array($m['code'], array( // ignore expected errors
- 942 // table or view does not exist
- ))) {
- echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
- }
- }
-}
-
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
// Run Test
if (!($s = oci_parse($c, "select * from field_funcs1_tab"))) {
- die("oci_parse(select) failed!\n");
+ die("oci_parse(select) failed!\n");
}
if (!oci_execute($s)) {
- die("oci_execute(select) failed!\n");
+ die("oci_execute(select) failed!\n");
}
$row = oci_fetch_array($s, OCI_NUM + OCI_RETURN_NULLS + OCI_RETURN_LOBS);
var_dump($row);
+echo "Test 1\n";
var_dump(oci_field_is_null($s, -1));
var_dump(oci_field_name($s, -1));
var_dump(oci_field_type($s, -1));
@@ -56,6 +41,7 @@ var_dump(oci_field_scale($s, -1));
var_dump(oci_field_precision($s, -1));
var_dump(oci_field_size($s, -1));
+echo "Test 2\n";
var_dump(oci_field_is_null($s, "none"));
var_dump(oci_field_name($s, "none"));
var_dump(oci_field_type($s, "none"));
@@ -64,6 +50,7 @@ var_dump(oci_field_scale($s, "none"));
var_dump(oci_field_precision($s, "none"));
var_dump(oci_field_size($s, "none"));
+echo "Test 3\n";
var_dump(oci_field_is_null($c, -1));
var_dump(oci_field_name($c, -1));
var_dump(oci_field_type($c, -1));
@@ -72,6 +59,7 @@ var_dump(oci_field_scale($c, -1));
var_dump(oci_field_precision($c, -1));
var_dump(oci_field_size($c, -1));
+echo "Test 4\n";
var_dump(oci_field_is_null($s, array()));
var_dump(oci_field_name($s, array()));
var_dump(oci_field_type($s, array()));
@@ -89,10 +77,7 @@ $stmtarray = array(
"drop table field_funcs1_tab"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
@@ -104,6 +89,7 @@ array(2) {
[1]=>
%unicode|string%(1) "1"
}
+Test 1
Warning: oci_field_is_null(): Invalid column index "-1" in %s on line %d
bool(false)
@@ -125,6 +111,7 @@ bool(false)
Warning: oci_field_size(): Invalid column index "-1" in %s on line %d
bool(false)
+Test 2
Warning: oci_field_is_null(): Invalid column name "none" in %s on line %d
bool(false)
@@ -146,6 +133,7 @@ bool(false)
Warning: oci_field_size(): Invalid column name "none" in %s on line %d
bool(false)
+Test 3
Warning: oci_field_is_null(): supplied resource is not a valid oci8 statement resource in %s on line %d
bool(false)
@@ -167,6 +155,7 @@ bool(false)
Warning: oci_field_size(): supplied resource is not a valid oci8 statement resource in %s on line %d
bool(false)
+Test 4
Warning: oci_field_is_null(): Invalid column index "0" in %s on line %d
bool(false)
diff --git a/ext/oci8/tests/field_funcs3.phpt b/ext/oci8/tests/field_funcs3.phpt
new file mode 100644
index 0000000000..e51949cf21
--- /dev/null
+++ b/ext/oci8/tests/field_funcs3.phpt
@@ -0,0 +1,99 @@
+--TEST--
+oci_field_*() family: basic column types
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require(dirname(__FILE__)."/connect.inc");
+
+// Initialization
+$stmtarray = array(
+ "drop table field_funcs3_tab",
+ "create table field_funcs3_tab(c1_c char(2), c2_v varchar2(2), c3_n number, c4_d date)",
+ "insert into field_funcs3_tab values ('c1', 'c2', 3, '01-Jan-2010')"
+);
+
+$v = oci_server_version($c);
+if (strpos($v, 'Oracle TimesTen') === false) {
+ oci8_test_sql_execute($c, array("alter session set nls_date_format = 'DD-MON-YYYY'"));
+}
+oci8_test_sql_execute($c, $stmtarray);
+
+// Run Test
+
+$select_sql = "select * from field_funcs3_tab";
+
+if (!($s = oci_parse($c, $select_sql))) {
+ die("oci_parse(select) failed!\n");
+}
+
+if (!oci_execute($s)) {
+ die("oci_execute(select) failed!\n");
+}
+
+$row = oci_fetch_array($s, OCI_NUM + OCI_RETURN_NULLS + OCI_RETURN_LOBS);
+var_dump($row);
+
+foreach ($row as $num => $field) {
+ $num++;
+ var_dump(oci_field_is_null($s, $num));
+ var_dump(oci_field_name($s, $num));
+ var_dump(oci_field_type($s, $num));
+ var_dump(oci_field_type_raw($s, $num));
+ var_dump(oci_field_scale($s, $num));
+ var_dump(oci_field_precision($s, $num));
+ var_dump(oci_field_size($s, $num));
+}
+
+// Clean up
+
+$stmtarray = array(
+ "drop table field_funcs3_tab"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+array(4) {
+ [0]=>
+ string(2) "c1"
+ [1]=>
+ string(2) "c2"
+ [2]=>
+ string(1) "3"
+ [3]=>
+ string(1%r[19]%r) "%r(01-JAN-2010|0001-01-20 10:00:00)%r"
+}
+bool(false)
+string(4) "C1_C"
+string(4) "CHAR"
+int(96)
+int(0)
+int(0)
+int(2)
+bool(false)
+string(4) "C2_V"
+string(8) "VARCHAR2"
+int(1)
+int(0)
+int(0)
+int(2)
+bool(false)
+string(4) "C3_N"
+string(6) "NUMBER"
+int(2)
+int(-127)
+int(0)
+int(22)
+bool(false)
+string(4) "C4_D"
+string(4) "DATE"
+int(12)
+int(0)
+int(0)
+int(7)
+===DONE===
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--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/lob_001.phpt b/ext/oci8/tests/lob_001.phpt
index cbcb92e7ec..cb94bfae13 100644
--- a/ext/oci8/tests/lob_001.phpt
+++ b/ext/oci8/tests/lob_001.phpt
Binary files differ
diff --git a/ext/oci8/tests/lob_002.phpt b/ext/oci8/tests/lob_002.phpt
index ebbef1815e..7417f9c127 100644
--- a/ext/oci8/tests/lob_002.phpt
+++ b/ext/oci8/tests/lob_002.phpt
@@ -1,21 +1,25 @@
--TEST--
oci_lob_write() and friends (with errors)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
-
-require dirname(__FILE__).'/connect.inc';
-require dirname(__FILE__).'/create_table.inc';
-
-$ora_sql = "INSERT INTO
- ".$schema.$table_name." (blob)
- VALUES (empty_blob())
- RETURNING
- blob
- INTO :v_blob ";
-
-$statement = oci_parse($c,$ora_sql);
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+ "drop table lob_002_tab",
+ "create table lob_002_tab (id number, b1 BLOB)",
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+$statement = oci_parse($c, "insert into lob_002_tab (id, b1) values (1, empty_blob()) returning b1 INTO :v_blob ");
$blob = oci_new_descriptor($c,OCI_D_LOB);
oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB);
oci_execute($statement, OCI_DEFAULT);
@@ -32,7 +36,7 @@ var_dump($blob->flush());
oci_commit($c);
-$select_sql = "SELECT blob FROM ".$schema.$table_name."";
+$select_sql = "select b1 from lob_002_tab where id = 1";
$s = oci_parse($c, $select_sql);
oci_execute($s);
@@ -40,12 +44,17 @@ $row = oci_fetch_array($s, OCI_RETURN_LOBS);
var_dump(strlen($row[0]));
+// Cleanup
-require dirname(__FILE__).'/drop_table.inc';
+$stmtarray = array(
+ "drop table lob_002_tab"
+);
-echo "Done\n";
+oci8_test_sql_execute($c, $stmtarray);
?>
+===DONE===
+<?php exit(0); ?>
--EXPECTF--
object(OCI-Lob)#%d (1) {
["descriptor"]=>
@@ -63,4 +72,4 @@ Warning: OCI-Lob::seek() expects parameter 1 to be long, string given in %slob_0
NULL
bool(false)
int(40004)
-Done
+===DONE===
diff --git a/ext/oci8/tests/lob_003.phpt b/ext/oci8/tests/lob_003.phpt
index 8a492d16ca..4775444e27 100644
--- a/ext/oci8/tests/lob_003.phpt
+++ b/ext/oci8/tests/lob_003.phpt
Binary files differ
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--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/lob_005.phpt b/ext/oci8/tests/lob_005.phpt
index e1ac6e5340..a1e3c3bd8c 100644
--- a/ext/oci8/tests/lob_005.phpt
+++ b/ext/oci8/tests/lob_005.phpt
@@ -1,7 +1,10 @@
--TEST--
oci_lob_is_equal()
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/lob_006.phpt b/ext/oci8/tests/lob_006.phpt
index 3192ebc906..ae6b37c960 100644
--- a/ext/oci8/tests/lob_006.phpt
+++ b/ext/oci8/tests/lob_006.phpt
Binary files differ
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--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/lob_008.phpt b/ext/oci8/tests/lob_008.phpt
index a36bb4a340..6f4cc05648 100644
--- a/ext/oci8/tests/lob_008.phpt
+++ b/ext/oci8/tests/lob_008.phpt
@@ -1,7 +1,10 @@
--TEST--
oci_lob_write()/read()/eof()
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/lob_009.phpt b/ext/oci8/tests/lob_009.phpt
index b9f7401128..4702e61aca 100644
--- a/ext/oci8/tests/lob_009.phpt
+++ b/ext/oci8/tests/lob_009.phpt
@@ -1,7 +1,10 @@
--TEST--
oci_lob_import()/read()
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/lob_010.phpt b/ext/oci8/tests/lob_010.phpt
index 59f3e145f2..3361c4b9b5 100644
--- a/ext/oci8/tests/lob_010.phpt
+++ b/ext/oci8/tests/lob_010.phpt
@@ -1,7 +1,10 @@
--TEST--
oci_lob_save()
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/lob_011.phpt b/ext/oci8/tests/lob_011.phpt
index b074e1730e..7580d4caf3 100644
--- a/ext/oci8/tests/lob_011.phpt
+++ b/ext/oci8/tests/lob_011.phpt
@@ -1,7 +1,10 @@
--TEST--
oci_lob_copy()
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/lob_012.phpt b/ext/oci8/tests/lob_012.phpt
index 2061969bc4..99b971a0bd 100644
--- a/ext/oci8/tests/lob_012.phpt
+++ b/ext/oci8/tests/lob_012.phpt
@@ -1,7 +1,10 @@
--TEST--
oci_lob_export()
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/lob_013.phpt b/ext/oci8/tests/lob_013.phpt
index c56de56198..556e56dc3f 100644
--- a/ext/oci8/tests/lob_013.phpt
+++ b/ext/oci8/tests/lob_013.phpt
@@ -1,7 +1,10 @@
--TEST--
lob buffering
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/lob_014.phpt b/ext/oci8/tests/lob_014.phpt
index 1ba29ee649..2a1a6bed64 100644
--- a/ext/oci8/tests/lob_014.phpt
+++ b/ext/oci8/tests/lob_014.phpt
@@ -1,7 +1,10 @@
--TEST--
oci_lob_free()/close()
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/lob_015.phpt b/ext/oci8/tests/lob_015.phpt
index 297d5b4971..b4a19684a3 100644
--- a/ext/oci8/tests/lob_015.phpt
+++ b/ext/oci8/tests/lob_015.phpt
@@ -1,7 +1,10 @@
--TEST--
various tests with wrong param count
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
@@ -45,7 +48,7 @@ Warning: oci_bind_by_name() expects at least 3 parameters, 2 given in %s on line
Warning: oci_bind_by_name() expects at least 3 parameters, 1 given in %s on line %d
-Warning: oci_execute(): ORA-00932: inconsistent datatypes: expected NUMBER got BLOB in %s on line %d
+Warning: oci_execute(): ORA-00932: %s NUMBER %s BLOB in %s on line %d
object(OCI-Lob)#%d (1) {
["descriptor"]=>
resource(%d) of type (oci8 descriptor)
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--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/lob_017.phpt b/ext/oci8/tests/lob_017.phpt
index ed12cc4685..d27a09052e 100644
--- a/ext/oci8/tests/lob_017.phpt
+++ b/ext/oci8/tests/lob_017.phpt
@@ -1,7 +1,10 @@
--TEST--
returning multiple lobs (using persistent connection)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/lob_018.phpt b/ext/oci8/tests/lob_018.phpt
index 35cec4bd7d..352cd50337 100644
--- a/ext/oci8/tests/lob_018.phpt
+++ b/ext/oci8/tests/lob_018.phpt
@@ -1,21 +1,27 @@
--TEST--
fetching the same lob several times
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
-require dirname(__FILE__).'/connect.inc';
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+ "drop table lob_018_tab",
+ "create table lob_018_tab (mykey number, lob_1 clob)",
+);
-$drop = "DROP table lob_test";
-$statement = oci_parse($c, $drop);
-@oci_execute($statement);
+oci8_test_sql_execute($c, $stmtarray);
-$create = "CREATE table lob_test(mykey NUMBER, lob_1 CLOB)";
-$statement = oci_parse($c, $create);
-oci_execute($statement);
+echo "Test 1\n";
-$init = "INSERT INTO lob_test (mykey, lob_1) VALUES(1, EMPTY_CLOB()) RETURNING lob_1 INTO :mylob";
+$init = "insert into lob_018_tab (mykey, lob_1) values(1, empty_clob()) returning lob_1 into :mylob";
$statement = oci_parse($c, $init);
$clob = oci_new_descriptor($c, OCI_D_LOB);
oci_bind_by_name($statement, ":mylob", $clob, -1, OCI_B_CLOB);
@@ -24,7 +30,7 @@ $clob->save("data");
oci_commit($c);
-$init = "INSERT INTO lob_test (mykey, lob_1) VALUES(2, EMPTY_CLOB()) RETURNING lob_1 INTO :mylob";
+$init = "insert into lob_018_tab (mykey, lob_1) values(2, empty_clob()) returning lob_1 into :mylob";
$statement = oci_parse($c, $init);
$clob = oci_new_descriptor($c, OCI_D_LOB);
oci_bind_by_name($statement, ":mylob", $clob, -1, OCI_B_CLOB);
@@ -34,7 +40,18 @@ $clob->save("long data");
oci_commit($c);
-$query = 'SELECT * FROM lob_test ORDER BY mykey ASC';
+$query = 'select * from lob_018_tab order by mykey asc';
+$statement = oci_parse ($c, $query);
+oci_execute($statement, OCI_DEFAULT);
+
+while ($row = oci_fetch_array($statement, OCI_ASSOC)) {
+ $result = $row['LOB_1']->load();
+ var_dump($result);
+}
+
+echo "Test 2\n";
+
+$query = 'select * from lob_018_tab order by mykey desc';
$statement = oci_parse ($c, $query);
oci_execute($statement, OCI_DEFAULT);
@@ -43,7 +60,18 @@ while ($row = oci_fetch_array($statement, OCI_ASSOC)) {
var_dump($result);
}
-$query = 'SELECT * FROM lob_test ORDER BY mykey DESC';
+echo "Test 3 - bind with SQLT_CLOB (an alias for OCI_B_CLOB)\n";
+
+$init = "insert into lob_018_tab (mykey, lob_1) values(3, empty_clob()) returning lob_1 into :mylob";
+$statement = oci_parse($c, $init);
+$clob = oci_new_descriptor($c, OCI_D_LOB);
+oci_bind_by_name($statement, ":mylob", $clob, -1, SQLT_CLOB);
+oci_execute($statement, OCI_DEFAULT);
+$clob->save("more stuff");
+
+oci_commit($c);
+
+$query = 'select * from lob_018_tab where mykey = 3';
$statement = oci_parse ($c, $query);
oci_execute($statement, OCI_DEFAULT);
@@ -52,16 +80,24 @@ while ($row = oci_fetch_array($statement, OCI_ASSOC)) {
var_dump($result);
}
-$drop = "DROP table lob_test";
-$statement = oci_parse($c, $drop);
-@oci_execute($statement);
+// Cleanup
+
+$stmtarray = array(
+ "drop table lob_018_tab"
+);
-echo "Done\n";
+oci8_test_sql_execute($c, $stmtarray);
?>
+===DONE===
+<?php exit(0); ?>
--EXPECTF--
+Test 1
string(4) "data"
string(9) "long data"
+Test 2
string(9) "long data"
string(4) "data"
-Done
+Test 3 - bind with SQLT_CLOB (an alias for OCI_B_CLOB)
+string(10) "more stuff"
+===DONE===
diff --git a/ext/oci8/tests/lob_019.phpt b/ext/oci8/tests/lob_019.phpt
index fb9a3c8188..19c21f4a78 100644
--- a/ext/oci8/tests/lob_019.phpt
+++ b/ext/oci8/tests/lob_019.phpt
Binary files differ
diff --git a/ext/oci8/tests/lob_020.phpt b/ext/oci8/tests/lob_020.phpt
index 6564dede9b..3faa89ff71 100644
--- a/ext/oci8/tests/lob_020.phpt
+++ b/ext/oci8/tests/lob_020.phpt
Binary files differ
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--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/lob_022.phpt b/ext/oci8/tests/lob_022.phpt
index 5fb9dfab0e..94d175b3bd 100644
--- a/ext/oci8/tests/lob_022.phpt
+++ b/ext/oci8/tests/lob_022.phpt
@@ -1,7 +1,10 @@
--TEST--
fetching the same lob several times
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/lob_023.phpt b/ext/oci8/tests/lob_023.phpt
index 0c352956de..6416fb45a6 100644
--- a/ext/oci8/tests/lob_023.phpt
+++ b/ext/oci8/tests/lob_023.phpt
@@ -1,7 +1,10 @@
--TEST--
oci_lob_import()/read()
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/lob_024.phpt b/ext/oci8/tests/lob_024.phpt
index 9a7f53240d..ed9b567273 100644
--- a/ext/oci8/tests/lob_024.phpt
+++ b/ext/oci8/tests/lob_024.phpt
@@ -1,7 +1,10 @@
--TEST--
oci_lob_load()
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/lob_025.phpt b/ext/oci8/tests/lob_025.phpt
index 5b5e845a7a..1566944cb8 100644
--- a/ext/oci8/tests/lob_025.phpt
+++ b/ext/oci8/tests/lob_025.phpt
@@ -1,7 +1,10 @@
--TEST--
oci_lob_read() tests
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/lob_026.phpt b/ext/oci8/tests/lob_026.phpt
index 157d78a2b6..aa4c254dda 100644
--- a/ext/oci8/tests/lob_026.phpt
+++ b/ext/oci8/tests/lob_026.phpt
@@ -1,7 +1,10 @@
--TEST--
oci_lob_seek()/rewind()/append()
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/lob_027.phpt b/ext/oci8/tests/lob_027.phpt
index 8b49b1ac5b..49850635ca 100644
--- a/ext/oci8/tests/lob_027.phpt
+++ b/ext/oci8/tests/lob_027.phpt
@@ -1,7 +1,10 @@
--TEST--
oci_lob_truncate()
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/lob_028.phpt b/ext/oci8/tests/lob_028.phpt
index 8ac2da3a32..8da7a8af8f 100644
--- a/ext/oci8/tests/lob_028.phpt
+++ b/ext/oci8/tests/lob_028.phpt
@@ -1,7 +1,10 @@
--TEST--
Test descriptor types for oci_new_descriptor()
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/lob_029.phpt b/ext/oci8/tests/lob_029.phpt
index 6826f36cda..56919e2ba6 100644
--- a/ext/oci8/tests/lob_029.phpt
+++ b/ext/oci8/tests/lob_029.phpt
@@ -1,14 +1,21 @@
--TEST--
reading/writing BFILE LOBs
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension");
-include "details.inc";
-if (empty($oracle_on_localhost)) die("skip this test won't work with remote Oracle");
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+ob_start();
+phpinfo(INFO_MODULES);
+$phpinfo = ob_get_clean();
+if (preg_match('/Compile-time ORACLE_HOME/', $phpinfo) !== 1) {
+ // Assume building PHP with an ORACLE_HOME means the tested DB is on the same machine as PHP
+ die("skip this test won't work with remote Oracle");
+}
?>
--FILE--
<?php
-require dirname(__FILE__).'/connect.inc';
+require(dirname(__FILE__).'/connect.inc');
$realdirname = dirname(__FILE__);
$realfilename1 = "oci8bfiletest1.txt";
diff --git a/ext/oci8/tests/lob_030.phpt b/ext/oci8/tests/lob_030.phpt
index 86b2956a51..d7fd21b961 100644
--- a/ext/oci8/tests/lob_030.phpt
+++ b/ext/oci8/tests/lob_030.phpt
@@ -1,7 +1,10 @@
--TEST--
Test piecewise fetch of CLOBs equal to, and larger than PHP_OCI_LOB_BUFFER_SIZE
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/lob_031.phpt b/ext/oci8/tests/lob_031.phpt
index a27d53bb38..39d27fd4a3 100644
--- a/ext/oci8/tests/lob_031.phpt
+++ b/ext/oci8/tests/lob_031.phpt
@@ -1,7 +1,10 @@
--TEST--
Test LOB->read(), LOB->seek() and LOB->tell() with nul bytes in data
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/lob_032.phpt b/ext/oci8/tests/lob_032.phpt
index 5d6ff6ec90..97b63c984d 100644
--- a/ext/oci8/tests/lob_032.phpt
+++ b/ext/oci8/tests/lob_032.phpt
@@ -1,7 +1,10 @@
--TEST--
oci_lob_write() and friends
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/lob_033.phpt b/ext/oci8/tests/lob_033.phpt
index 5647cd9a41..cdce2d0863 100644
--- a/ext/oci8/tests/lob_033.phpt
+++ b/ext/oci8/tests/lob_033.phpt
@@ -1,7 +1,10 @@
--TEST--
various oci_lob_write() error messages
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/lob_034.phpt b/ext/oci8/tests/lob_034.phpt
index 6bf4058e74..7561f64ff8 100644
--- a/ext/oci8/tests/lob_034.phpt
+++ b/ext/oci8/tests/lob_034.phpt
@@ -1,7 +1,10 @@
--TEST--
lob buffering - 2
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/lob_035.phpt b/ext/oci8/tests/lob_035.phpt
index 6e1f5a7359..37e010ce79 100644
--- a/ext/oci8/tests/lob_035.phpt
+++ b/ext/oci8/tests/lob_035.phpt
@@ -1,7 +1,10 @@
--TEST--
oci_lob_copy() - 2
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/lob_036.phpt b/ext/oci8/tests/lob_036.phpt
index e72c1cf081..060b1713cf 100644
--- a/ext/oci8/tests/lob_036.phpt
+++ b/ext/oci8/tests/lob_036.phpt
@@ -1,7 +1,10 @@
--TEST--
Exercise cleanup code when LOB buffering is on
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/lob_037.phpt b/ext/oci8/tests/lob_037.phpt
index 228f5e8123..75db589aae 100644
--- a/ext/oci8/tests/lob_037.phpt
+++ b/ext/oci8/tests/lob_037.phpt
@@ -1,7 +1,10 @@
--TEST--
Fetching two different lobs and using them after fetch
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/lob_038.phpt b/ext/oci8/tests/lob_038.phpt
index 91dac66c0d..34b7b48b66 100644
--- a/ext/oci8/tests/lob_038.phpt
+++ b/ext/oci8/tests/lob_038.phpt
@@ -1,7 +1,10 @@
--TEST--
Array fetch CLOB and BLOB
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/lob_039.phpt b/ext/oci8/tests/lob_039.phpt
index 5675f5a928..02d057e2bb 100644
--- a/ext/oci8/tests/lob_039.phpt
+++ b/ext/oci8/tests/lob_039.phpt
@@ -1,7 +1,10 @@
--TEST--
Test CLOB->write() for multiple inserts
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/lob_040.phpt b/ext/oci8/tests/lob_040.phpt
index 3f8a73dc5a..0a29dc1b9e 100644
--- a/ext/oci8/tests/lob_040.phpt
+++ b/ext/oci8/tests/lob_040.phpt
@@ -1,7 +1,10 @@
--TEST--
Bug #37706 (Test LOB locator reuse. Extends simple test of lob_037.phpt)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/lob_041.phpt b/ext/oci8/tests/lob_041.phpt
index d04b43606a..aa1ea98a52 100644
--- a/ext/oci8/tests/lob_041.phpt
+++ b/ext/oci8/tests/lob_041.phpt
@@ -1,7 +1,10 @@
--TEST--
Check LOBS are valid after statement free
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
@@ -15,10 +18,7 @@ $stmtarray = array(
"INSERT INTO lob_041_tab VALUES('test data')"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
echo "Test 1 - explicit statement close\n";
@@ -60,12 +60,7 @@ $stmtarray = array(
"DROP table lob_041_tab"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- @oci_execute($s);
-}
-
-oci_close($c);
+oci8_test_sql_execute($c, $stmtarray);
?>
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--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/lob_043.phpt b/ext/oci8/tests/lob_043.phpt
index 0280ef6de8..ade79a200c 100644
--- a/ext/oci8/tests/lob_043.phpt
+++ b/ext/oci8/tests/lob_043.phpt
@@ -1,8 +1,9 @@
--TEST--
Bug #49560 (LOB resource destructor and refcount test)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension");
-require(dirname(__FILE__).'/details.inc');
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
if ($stress_test !== true) die ('skip Slow test not run when $stress_test is FALSE');
?>
--FILE--
@@ -22,21 +23,7 @@ $stmtarray = array(
end;",
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- $r = @oci_execute($s);
- if (!$r) {
- $m = oci_error($s);
- if (!in_array($m['code'], array( // ignore expected errors
- 942 // table or view does not exist
- , 2289 // sequence does not exist
- , 4080 // trigger does not exist
- , 38802 // edition does not exist
- ))) {
- echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
- }
- }
-}
+oci8_test_sql_execute($c, $stmtarray);
// Run Test
@@ -86,10 +73,7 @@ $stmtarray = array(
"drop table lob_043_tab"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
oci_close($c);
diff --git a/ext/oci8/tests/lob_044.phpt b/ext/oci8/tests/lob_044.phpt
new file mode 100644
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--
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+ "drop table lob_044_tab",
+ "create table lob_044_tab (blob BLOB)",
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+
+// Run Test
+
+echo "Test 1 - truncate on insert\n";
+
+$s = oci_parse($c, "INSERT INTO lob_044_tab (blob) VALUES (empty_blob()) RETURNING blob INTO :v_blob ");
+$blob = oci_new_descriptor($c, OCI_D_LOB);
+oci_bind_by_name($s,":v_blob", $blob, -1, OCI_B_BLOB);
+oci_execute($s, OCI_DEFAULT);
+
+var_dump($blob->write("this is a biiiig faaat test string. why are you reading it, I wonder? =)"));
+var_dump($blob->seek(0));
+var_dump($blob->read(10000));
+var_dump($blob->truncate());
+var_dump($blob->seek(0));
+var_dump($blob->read(10000));
+
+oci_commit($c);
+
+
+// Read it back
+
+echo "\nTest 2 - read it back\n";
+
+$s = oci_parse($c, "SELECT blob FROM lob_044_tab FOR UPDATE");
+oci_execute($s, OCI_DEFAULT);
+$row = oci_fetch_array($s);
+var_dump($row[0]->read(10000));
+
+// Clean up
+
+$stmtarray = array(
+ "drop table lob_044_tab"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1 - truncate on insert
+int(72)
+bool(true)
+string(72) "this is a biiiig faaat test string. why are you reading it, I wonder? =)"
+bool(true)
+bool(true)
+string(0) ""
+
+Test 2 - read it back
+string(0) ""
+===DONE===
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--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/lob_null.phpt b/ext/oci8/tests/lob_null.phpt
index 227ebb89fb..be3e53453d 100644
--- a/ext/oci8/tests/lob_null.phpt
+++ b/ext/oci8/tests/lob_null.phpt
@@ -1,7 +1,10 @@
--TEST--
Test null data for CLOBs
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/lob_temp.phpt b/ext/oci8/tests/lob_temp.phpt
index cad2d39058..9a07fb5ac0 100644
--- a/ext/oci8/tests/lob_temp.phpt
+++ b/ext/oci8/tests/lob_temp.phpt
@@ -1,7 +1,10 @@
--TEST--
temporary lobs
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/lob_temp1.phpt b/ext/oci8/tests/lob_temp1.phpt
index 2482d65f64..e27ea6d47d 100644
--- a/ext/oci8/tests/lob_temp1.phpt
+++ b/ext/oci8/tests/lob_temp1.phpt
@@ -1,7 +1,10 @@
--TEST--
closing temporary lobs
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/null_byte_2.phpt b/ext/oci8/tests/null_byte_2.phpt
index b4c9b61ad4..01fb87235a 100644
--- a/ext/oci8/tests/null_byte_2.phpt
+++ b/ext/oci8/tests/null_byte_2.phpt
@@ -1,7 +1,10 @@
--TEST--
Null bytes in SQL statements
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--INI--
display_errors = On
error_reporting = E_WARNING
@@ -19,11 +22,6 @@ oci_execute($s);
oci_fetch_all($s, $res);
var_dump($res);
-echo "Test 2: Invalid use of a null byte\n";
-
-$s = oci_parse($c, "select * from du\0al");
-oci_execute($s);
-
echo "Test 3: Using a null byte in a bind variable name\n";
$s = oci_parse($c, "select * from dual where :bv = 1");
@@ -31,14 +29,6 @@ $bv = 1;
oci_bind_by_name($s, ":bv\0:bv", $bv);
oci_execute($s);
-echo "Test 4: Using a null byte in a bind variable value causing WHERE clause to fail\n";
-
-$s = oci_parse($c, "select * from dual where :bv = 'abc'");
-$bv = 'abc\0abc';
-oci_bind_by_name($s, ":bv", $bv);
-oci_execute($s);
-oci_fetch_all($s, $res);
-var_dump($res);
?>
===DONE===
@@ -52,18 +42,9 @@ array(1) {
string(1) "X"
}
}
-Test 2: Invalid use of a null byte
-
-Warning: oci_execute(): ORA-00942: %s in %snull_byte_2.php on line %d
Test 3: Using a null byte in a bind variable name
Warning: oci_bind_by_name(): ORA-01036: %s in %snull_byte_2.php on line %d
Warning: oci_execute(): ORA-01008: %s in %snull_byte_2.php on line %d
-Test 4: Using a null byte in a bind variable value causing WHERE clause to fail
-array(1) {
- ["DUMMY"]=>
- array(0) {
- }
-}
===DONE===
diff --git a/ext/oci8/tests/null_byte_3.phpt b/ext/oci8/tests/null_byte_3.phpt
new file mode 100644
index 0000000000..73d5c26c0b
--- /dev/null
+++ b/ext/oci8/tests/null_byte_3.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Null bytes in SQL statements
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+--INI--
+display_errors = On
+error_reporting = E_WARNING
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Run Test
+
+echo "Test 1: Invalid use of a null byte\n";
+
+$s = oci_parse($c, "select * from du\0al");
+oci_execute($s);
+
+echo "Test 2: Using a null byte in a bind variable value causing WHERE clause to fail\n";
+
+$s = oci_parse($c, "select * from dual where :bv = 'abc'");
+$bv = 'abc\0abc';
+oci_bind_by_name($s, ":bv", $bv);
+oci_execute($s);
+oci_fetch_all($s, $res);
+var_dump($res);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1: Invalid use of a null byte
+
+Warning: oci_execute(): ORA-00942: %s in %snull_byte_3.php on line %d
+Test 2: Using a null byte in a bind variable value causing WHERE clause to fail
+array(1) {
+ ["DUMMY"]=>
+ array(0) {
+ }
+}
+===DONE===
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--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/password.phpt b/ext/oci8/tests/password.phpt
index 7133d8bae8..1738702cb6 100644
--- a/ext/oci8/tests/password.phpt
+++ b/ext/oci8/tests/password.phpt
@@ -11,20 +11,16 @@ if ($test_drcp) die("skip password change not supported in DRCP Mode");
--FILE--
<?php
-require(dirname(__FILE__)."/details.inc");
+require(dirname(__FILE__)."/connect.inc");
+
+$stmtarray = array(
+ "drop user testuser cascade",
+ "create user testuser identified by testuserpwd",
+ "grant connect, create session to testuser"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
-// Create a user we can stuff around with and not affect subsequent tests
-$c0 = oci_connect($user, $password, $dbase);
-$stmts = array(
- "drop user testuser",
- "begin
- execute immediate 'create user testuser identified by testuserpwd';
- execute immediate 'grant connect, create session to testuser';
- end;");
-foreach ($stmts as $sql) {
- $s = oci_parse($c0, $sql);
- @oci_execute($s);
-}
// Connect and change the password
$c1 = oci_connect("testuser", "testuserpwd", $dbase);
@@ -62,16 +58,19 @@ else {
var_dump($c2);
}
-// Clean up
-oci_close($c1);
-oci_close($c2);
-oci_close($c3);
+echo "Done\n";
+
+?>
+--CLEAN--
+<?php
-// Clean up
-$s = oci_parse($c0, "drop user cascade testuser");
-@oci_execute($s);
+require(dirname(__FILE__)."/connect.inc");
-echo "Done\n";
+$stmtarray = array(
+ "drop user testuser cascade"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
?>
--EXPECTF--
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--
<?php
-require(dirname(__FILE__)."/details.inc");
+require(dirname(__FILE__)."/connect.inc");
-// Create a user we can stuff around with and not affect subsequent tests
-$c0 = oci_connect($user, $password, $dbase);
-$stmts = array(
- "drop user testuser",
- "begin
- execute immediate 'create user testuser identified by testuserpwd';
- execute immediate 'grant connect, create session to testuser';
- end;");
-foreach ($stmts as $sql) {
- $s = oci_parse($c0, $sql);
- @oci_execute($s);
-}
+$stmtarray = array(
+ "drop user testuser cascade",
+ "create user testuser identified by testuserpwd",
+ "grant connect, create session to testuser"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
// Connect (persistent) and change the password
$c1 = oci_pconnect("testuser", "testuserpwd", $dbase);
@@ -62,16 +57,19 @@ else {
var_dump($c2);
}
-// Clean up
-oci_close($c1);
-oci_close($c2);
-oci_close($c3);
+echo "Done\n";
-// Clean up
-$s = oci_parse($c0, "drop user cascade testuser");
-@oci_execute($s);
+?>
+--CLEAN--
+<?php
-echo "Done\n";
+require(dirname(__FILE__)."/connect.inc");
+
+$stmtarray = array(
+ "drop user testuser cascade"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
?>
--EXPECTF--
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--
<?php
-if (!extension_loaded('oci8')) die("skip no oci8 extension");
-require(dirname(__FILE__)."/connect.inc");
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on thes
+require(dirname(__FILE__).'/skipif.inc');
if (empty($dbase)) die ("skip requires database connection string be set");
if ($test_drcp) die("skip password change not supported in DRCP Mode");
// This test is known to fail with Oracle 10.2.0.4 client libraries
// connecting to Oracle Database 11 (Oracle bug 6277160, fixed 10.2.0.5)
-$sv = oci_server_version($c);
-$sv = preg_match('/Release (11|12)\./', $sv, $matches);
-if ($sv === 1) {
- ob_start();
- phpinfo(INFO_MODULES);
- $phpinfo = ob_get_clean();
- $iv = preg_match('/Oracle .*Version => 10/', $phpinfo);
- if ($iv === 1) {
- die ("skip test known to fail using Oracle 10.2.0.4 client libs connecting to Oracle 11 (6277160)");
- }
+if (preg_match('/Release (11|12)\./', oci_server_version($c), $matches) === 1 &&
+ preg_match('/^10\.2\.0\.[1234]/', oci_client_version()) === 1) {
+ die ("skip test known to fail using Oracle 10.2.0.4 client libs connecting to Oracle 11 (6277160)");
}
?>
--FILE--
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--
<?php
-if (!extension_loaded('oci8')) die("skip no oci8 extension");
-require(dirname(__FILE__)."/connect.inc");
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on thes
+require(dirname(__FILE__).'/skipif.inc');
if (empty($dbase)) die ("skip requires database connection string be set");
if ($test_drcp) die("skip password change not supported in DRCP Mode");
// This test is known to fail with Oracle 10.2.0.4 client libraries
// connecting to Oracle Database 11 (Oracle bug 6277160, fixed 10.2.0.5)
-$sv = oci_server_version($c);
-$sv = preg_match('/Release (11|12)\./', $sv, $matches);
-if ($sv === 1) {
- ob_start();
- phpinfo(INFO_MODULES);
- $phpinfo = ob_get_clean();
- $iv = preg_match('/Oracle .*Version => 10/', $phpinfo);
- if ($iv === 1) {
- die ("skip test known to fail using Oracle 10.2.0.4 client libs connecting to Oracle 11 (6277160)");
- }
+if (preg_match('/Release (11|12)\./', oci_server_version($c), $matches) === 1 &&
+ preg_match('/^10\.2\.0\.[1234]/', oci_client_version()) === 1) {
+ die ("skip test known to fail using Oracle 10.2.0.4 client libs connecting to Oracle 11 (6277160)");
}
+
+
?>
--FILE--
<?php
diff --git a/ext/oci8/tests/pecl_bug10194.phpt b/ext/oci8/tests/pecl_bug10194.phpt
index 4714fadcd4..4bffc7644d 100644
--- a/ext/oci8/tests/pecl_bug10194.phpt
+++ b/ext/oci8/tests/pecl_bug10194.phpt
@@ -1,7 +1,10 @@
--TEST--
PECL Bug #10194 (segfault in Instant Client when memory_limit is reached inside the callback)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--INI--
memory_limit=10M
--FILE--
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--
-<?php
-if (!extension_loaded('oci8')) die("skip no oci8 extension");
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platforms only");
-?>
+?>
--INI--
memory_limit=3M
--FILE--
<?php
// This test is dependent on the behavior of the memory manager
-
-require dirname(__FILE__).'/connect.inc';
-require dirname(__FILE__).'/create_table.inc';
+
+require(dirname(__FILE__).'/connect.inc');
+require(dirname(__FILE__).'/create_table.inc');
-$ora_sql = "INSERT INTO ".$schema.$table_name." (blob)
- VALUES (empty_blob())";
+$ora_sql = "INSERT INTO ".$schema.$table_name." (blob) VALUES (empty_blob())";
$statement = oci_parse($c,$ora_sql);
oci_execute($statement);
@@ -30,7 +30,7 @@ $row = oci_fetch_assoc($statement);
$string = str_repeat("test", 32768*4*4);
for ($i = 0; $i < 8; $i++) {
- $row['BLOB']->write($string);
+ $row['BLOB']->write($string);
}
oci_commit($c);
@@ -48,7 +48,7 @@ require dirname(__FILE__).'/drop_table.inc';
echo "Done\n";
?>
---EXPECTF--
+--EXPECTF--
Before load()
Fatal error: Allowed memory size of %d bytes exhausted%s(tried to allocate %d bytes) in %s on line %d
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--
<?php
-if (!extension_loaded('oci8')) die("skip no oci8 extension");
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on thes
+require(dirname(__FILE__).'/skipif.inc');
if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platforms only");
?>
--INI--
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--
<?php
if (!extension_loaded('oci8')) die ("skip no oci8 extension");
@@ -23,4 +23,7 @@ oci_connect('abc', 'def', 'ghi', 'jkl');
<?php exit(0); ?>
--EXPECTF--
Warning: oci_connect(): OCIEnvNlsCreate() failed. There is something wrong with your system - please check that ORACLE_HOME and %s are set and point to the right directories in %s on line %d
+
+Warning: oci_connect(): Error while trying to retrieve text for error ORA-01804
+ in %specl_bug16035.php on line %d
===DONE===
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--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--INI--
error_reporting = E_WARNING
--FILE--
@@ -39,15 +42,15 @@ Raises NO_DATA_FOUND
Warning: oci_execute(): OCI_NO_DATA in %s on line 11
bool(false)
array(4) {
- [%u|b%"code"]=>
+ ["code"]=>
int(1403)
- [%u|b%"message"]=>
- %unicode|string%(45) "ORA-01403: %s
+ ["message"]=>
+ string(%d) "ORA-01403: %s
ORA-06512: at line 1"
- [%u|b%"offset"]=>
+ ["offset"]=>
int(0)
- [%u|b%"sqltext"]=>
- %unicode|string%(31) "begin raise NO_DATA_FOUND; end;"
+ ["sqltext"]=>
+ string(31) "begin raise NO_DATA_FOUND; end;"
}
Test 2
Raises ZERO_DIVIDE
@@ -56,14 +59,14 @@ Warning: oci_execute(): ORA-01476: %s
ORA-06512: at line 1 in %s on line 19
bool(false)
array(4) {
- [%u|b%"code"]=>
+ ["code"]=>
int(1476)
- [%u|b%"message"]=>
- %unicode|string%(56) "ORA-01476: %s
+ ["message"]=>
+ string(%d) "ORA-01476: %s
ORA-06512: at line 1"
- [%u|b%"offset"]=>
+ ["offset"]=>
int(0)
- [%u|b%"sqltext"]=>
- %unicode|string%(29) "begin raise ZERO_DIVIDE; end;"
+ ["sqltext"]=>
+ string(29) "begin raise ZERO_DIVIDE; end;"
}
===DONE===
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--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
diff --git a/ext/oci8/tests/prefetch.phpt b/ext/oci8/tests/prefetch.phpt
index 26762601df..b163a89e94 100644
--- a/ext/oci8/tests/prefetch.phpt
+++ b/ext/oci8/tests/prefetch.phpt
@@ -17,23 +17,7 @@ $stmtarray = array(
"insert into prefetch_tab (id, value) values (1,1)",
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- $r = @oci_execute($s);
- if (!$r) {
- $m = oci_error($s);
- if (!in_array($m['code'], array( // ignore expected errors
- 942 // table or view does not exist
- ))) {
- echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
- }
- }
-}
-
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
// Run Test
@@ -58,10 +42,7 @@ $stmtarray = array(
"drop table prefetch_tab"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
?>
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 904e4da1ff..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
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension");
if (!extension_loaded('oci8')) die("skip no oci8 extension");
require(dirname(__FILE__)."/connect.inc");
-ob_start();
-phpinfo(INFO_MODULES);
-$phpinfo = ob_get_clean();
-$iv = preg_match('/Oracle .*Version => (11\.2|12\.)/', $phpinfo);
-if ($iv == 1) {
- $sv = oci_server_version($c);
- $sv = preg_match('/Release 1[012]\./', $sv, $matches);
- if ($sv != 1) {
- die ("skip expected output only valid when using Oracle 10g or greater server");
- }
-}
-else {
- die ("skip expected output only valid when using Oracle 11.2 or greater client");
+if (preg_match('/Release 1[012]\./', oci_server_version($c), $matches) !== 1) {
+ die("skip expected output only valid when using Oracle 10g or greater databases");
+} else if (preg_match('/^(11\.2|12)\./', oci_client_version()) != 1) {
+ die("skip test expected to work only with Oracle 11gR2 or greater version of client");
}
?>
--FILE--
@@ -45,16 +36,7 @@ $stmtarray = array(
end refcurpkg;"
);
-foreach($stmtarray as $stmt) {
- $s = oci_parse($c,$stmt);
- $r = @oci_execute($s);
- if (!$r) {
- $msg = oci_error($s);
- if ($msg['code'] != 942) {
- echo $msg['message'],"\n";
- }
- }
-}
+oci8_test_sql_execute($c, $stmtarray);
// Insert 500 rows into the table.
$insert_sql = "INSERT INTO refcurtest (c1, c2) VALUES (:c1,:c2)";
@@ -94,7 +76,7 @@ function fetch_frm_php($c,$cur1,$value) {
oci_execute($s1);
oci_set_prefetch($cur1,$value);
oci_execute($cur1);
- echo "Fetch Row from PHP\n";
+ echo "Fetch Row from PHP\n";
var_dump(oci_fetch_row($cur1));
}
@@ -106,14 +88,14 @@ function fetch_frm_plsql($c,$cur1) {
if (!oci_bind_by_name($s2,":curs1",$cur1,-1,SQLT_RSET)) {
die("oci_bind_by_name(sql2) failed!\n");
}
- if (!oci_bind_by_name($s2,":c1",$c1,SQLT_INT)) {
+ if (!oci_bind_by_name($s2,":c1",$c1,-1,SQLT_INT)) {
die("oci_bind_by_name(sql2) failed!\n");
}
- if (!oci_bind_by_name($s2,":c2",$c2,SQLT_AFC)) {
+ if (!oci_bind_by_name($s2,":c2",$c2,20,SQLT_CHR)) {
die("oci_bind_by_name(sql2) failed!\n");
}
oci_execute($s2);
- echo "Fetch Row from PL/SQL\n";
+ echo "Fetch Row from PL/SQL\n";
var_dump($c1);
var_dump($c2);
}
@@ -125,132 +107,125 @@ $stmtarray = array(
"drop table refcurtest"
);
-foreach($stmtarray as $stmt) {
- $s = oci_parse($c,$stmt);
- $r = @oci_execute($s);
- if (!$r) {
- $msg = oci_error($s);
- echo $msg['message'],"\n";
- }
-}
-oci_close($c);
+oci8_test_sql_execute($c, $stmtarray);
+
echo "Done\n";
?>
--EXPECTF--
-----------------------------------------------
Test with Prefetch value set to 0
-----------------------------------------------
-Fetch Row from PHP
+Fetch Row from PHP
array(2) {
[0]=>
- %unicode|string%(%d) "0"
+ string(%d) "0"
[1]=>
- %unicode|string%(%d) "test0"
+ string(%d) "test0"
}
-Fetch Row from PL/SQL
-%unicode|string%(%d) "1"
-%unicode|string%(%d) "test1"
+Fetch Row from PL/SQL
+int(1)
+string(%d) "test1"
-----------------------------------------------
Test with Prefetch value set to 1
-----------------------------------------------
-Fetch Row from PHP
+Fetch Row from PHP
array(2) {
[0]=>
- %unicode|string%(%d) "0"
+ string(%d) "0"
[1]=>
- %unicode|string%(%d) "test0"
+ string(%d) "test0"
}
-Fetch Row from PL/SQL
-%unicode|string%(%d) "2"
-%unicode|string%(%d) "test2"
+Fetch Row from PL/SQL
+int(2)
+string(%d) "test2"
-----------------------------------------------
Test with Prefetch value set to 501
-----------------------------------------------
-Fetch Row from PHP
+Fetch Row from PHP
array(2) {
[0]=>
- %unicode|string%(%d) "0"
+ string(%d) "0"
[1]=>
- %unicode|string%(%d) "test0"
+ string(%d) "test0"
}
Warning: oci_execute(): ORA-01002: %s
ORA-06512: at "%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 "%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 751ffa78f0..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
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension");
if (!extension_loaded('oci8')) die("skip no oci8 extension");
require(dirname(__FILE__)."/connect.inc");
-ob_start();
-phpinfo(INFO_MODULES);
-$phpinfo = ob_get_clean();
-$iv = preg_match('/Oracle .*Version => (11\.2|12\.)/', $phpinfo);
-if ($iv == 1) {
- $sv = oci_server_version($c);
- $sv = preg_match('/Release 1[012]\./', $sv, $matches);
- if ($sv != 1) {
- die ("skip expected output only valid when using Oracle 10g or greater server");
- }
-}
-else {
- die ("skip expected output only valid when using Oracle 11.1 or greater client");
+if (preg_match('/Release 1[012]\./', oci_server_version($c), $matches) !== 1) {
+ die("skip expected output only valid when using Oracle 10g or greater databases");
+} else if (preg_match('/^(11\.2|12)\./', oci_client_version()) != 1) {
+ die("skip test expected to work only with Oracle 11gR2 or greater version of client");
}
?>
--FILE--
@@ -45,16 +36,7 @@ $stmtarray = array(
end refcurpkg;"
);
-foreach($stmtarray as $stmt) {
- $s = oci_parse($c,$stmt);
- $r = @oci_execute($s);
- if (!$r) {
- $msg = oci_error($s);
- if ($msg['code'] != 942) {
- echo $msg['message'],"\n";
- }
- }
-}
+oci8_test_sql_execute($c, $stmtarray);
// Insert 500 rows into the table.
$insert_sql = "INSERT INTO refcurtest (c1, c2) VALUES (:c1,:c2)";
@@ -85,13 +67,13 @@ if (!oci_bind_by_name($s1,":cur1",$cur1,-1,SQLT_RSET)) {
$sql2 = "begin refcurpkg.fetch_ref_cur(:curs1,:c1,:c2); end;";
$s2 = oci_parse($c,$sql2);
-if (!oci_bind_by_name($s2,":curs1",$cur1,-1,SQLT_RSET)) {
+if (!oci_bind_by_name($s2, ":curs1", $cur1, -1, SQLT_RSET)) {
die("oci_bind_by_name(sql2) failed!\n");
}
-if (!oci_bind_by_name($s2,":c1",$c1,SQLT_INT)) {
+if (!oci_bind_by_name($s2, ":c1", $c1, -1, SQLT_INT)) {
die("oci_bind_by_name(sql2) failed!\n");
}
-if (!oci_bind_by_name($s2,":c2",$c2,SQLT_AFC)) {
+if (!oci_bind_by_name($s2, ":c2", $c2, 20, SQLT_CHR)) {
die("oci_bind_by_name(sql2) failed!\n");
}
@@ -124,7 +106,7 @@ if (!oci_bind_by_name($s1,":cur1",$cur1,-1,SQLT_RSET)) {
die("oci_bind_by_name(sql1) failed!\n");
}
-echo "Fetch Row from PHP\n";
+echo "Fetch Row from PHP\n";
oci_execute($s1);
oci_execute($cur1);
var_dump(oci_fetch_row($cur1));
@@ -135,55 +117,10 @@ if (!oci_bind_by_name($s2,":curs1",$cur1,-1,SQLT_RSET)) {
die("oci_bind_by_name(sql2) failed!\n");
}
oci_execute($s2);
-echo "Fetch Row from PL/SQL\n";
-var_dump($c1);
-var_dump($c2);
-
-echo "------Test 3 - Set Prefetch after PL/SQL fetch ----------\n";
-$cur1 = oci_new_cursor($c);
-// Fetch from PL/SQL
-if (!oci_bind_by_name($s2,":curs1",$cur1,-1,SQLT_RSET)) {
- die("oci_bind_by_name(sql2) failed!\n");
-}
-oci_execute($s2);
-echo "Fetch Row from PL/SQL\n";
-var_dump($c1);
-var_dump($c2);
-
-// Fetch from PHP
-echo "Fetch Row from PHP\n";
-if (!oci_bind_by_name($s1,":cur1",$cur1,-1,SQLT_RSET)) {
- die("oci_bind_by_name(sql1) failed!\n");
-}
-oci_set_prefetch($cur1,5);
-oci_execute($s1);
-oci_execute($cur1);
-var_dump(oci_fetch_row($cur1));
-
-echo "------Test 4- Overwrite prefetch-----------\n";
-// Fetch from PHP
-$cur1 = oci_new_cursor($c);
-if (!oci_bind_by_name($s1,":cur1",$cur1,-1,SQLT_RSET)) {
- die("oci_bind_by_name(sql1) failed!\n");
-}
-echo "Fetch Row from PHP\n";
-oci_execute($s1);
-oci_execute($cur1);
-var_dump(oci_fetch_row($cur1));
-oci_set_prefetch($cur1,5);
-oci_set_prefetch($cur1,0);
-oci_set_prefetch($cur1,100);
-
-// Fetch from PL/SQL
-if (!oci_bind_by_name($s2,":curs1",$cur1,-1,SQLT_RSET)) {
- die("oci_bind_by_name(sql2) failed!\n");
-}
-oci_execute($s2);
-echo "Fetch Row from PL/SQL\n";
+echo "Fetch Row from PL/SQL\n";
var_dump($c1);
var_dump($c2);
-
function print_roundtrips($c) {
$sql_stmt = "select value from v\$mystat a,v\$statname c where
a.statistic#=c.statistic# and c.name='SQL*Net roundtrips to/from client'";
@@ -201,117 +138,83 @@ $stmtarray = array(
"drop table refcurtest"
);
-foreach($stmtarray as $stmt) {
- $s = oci_parse($c,$stmt);
- $r = @oci_execute($s);
- if (!$r) {
- $msg = oci_error($s);
- echo $msg['message'],"\n";
- }
-}
+oci8_test_sql_execute($c, $stmtarray);
-oci_close($c);
echo "Done\n";
?>
--EXPECTF--
------Test 1- Check Roundtrips with prefetch 0 and 5 -----------
array(2) {
[0]=>
- %unicode|string%(%d) "0"
+ string(1) "0"
[1]=>
- %unicode|string%(%d) "test0"
+ string(5) "test0"
}
array(2) {
[0]=>
- %unicode|string%(%d) "1"
+ string(1) "1"
[1]=>
- %unicode|string%(%d) "test1"
+ string(5) "test1"
}
array(2) {
[0]=>
- %unicode|string%(%d) "2"
+ string(1) "2"
[1]=>
- %unicode|string%(%d) "test2"
+ string(5) "test2"
}
array(2) {
[0]=>
- %unicode|string%(%d) "3"
+ string(1) "3"
[1]=>
- %unicode|string%(%d) "test3"
+ string(5) "test3"
}
array(2) {
[0]=>
- %unicode|string%(%d) "4"
+ string(1) "4"
[1]=>
- %unicode|string%(%d) "test4"
+ string(5) "test4"
}
Number of roundtrips made with prefetch count 0 for 5 rows is 6
array(2) {
[0]=>
- %unicode|string%(%d) "5"
+ string(1) "5"
[1]=>
- %unicode|string%(%d) "test5"
+ string(5) "test5"
}
array(2) {
[0]=>
- %unicode|string%(%d) "6"
+ string(1) "6"
[1]=>
- %unicode|string%(%d) "test6"
+ string(5) "test6"
}
array(2) {
[0]=>
- %unicode|string%(%d) "7"
+ string(1) "7"
[1]=>
- %unicode|string%(%d) "test7"
+ string(5) "test7"
}
array(2) {
[0]=>
- %unicode|string%(%d) "8"
+ string(1) "8"
[1]=>
- %unicode|string%(%d) "test8"
+ string(5) "test8"
}
array(2) {
[0]=>
- %unicode|string%(%d) "9"
+ string(1) "9"
[1]=>
- %unicode|string%(%d) "test9"
+ string(5) "test9"
}
Number of roundtrips made with prefetch count 5 for 5 rows is 2
------Test 2 - Set Prefetch before PL/SQL fetch ----------
-Fetch Row from PHP
-array(2) {
- [0]=>
- %unicode|string%(%d) "0"
- [1]=>
- %unicode|string%(%d) "test0"
-}
-Fetch Row from PL/SQL
-%unicode|string%(%d) "101"
-%unicode|string%(%d) "test101"
-------Test 3 - Set Prefetch after PL/SQL fetch ----------
-
-Warning: oci_execute(): ORA-01001: %s
-ORA-06512: at "SYSTEM.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
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension");
if (!extension_loaded('oci8')) die("skip no oci8 extension");
require(dirname(__FILE__)."/connect.inc");
-ob_start();
-phpinfo(INFO_MODULES);
-$phpinfo = ob_get_clean();
-$iv = preg_match('/Oracle .*Version => (11\.2|12\.)/', $phpinfo);
-if ($iv == 1) {
- $sv = oci_server_version($c);
- $sv = preg_match('/Release (11\.2|12\.)/', $sv, $matches);
- if ($sv != 1) {
- die ("skip expected output only valid when using Oracle 11.2 or greater server");
- }
-}
-else {
- die ("skip expected output only valid when using Oracle 11.2 or greater client");
+if (preg_match('/Release (11\.2|12)\./', oci_server_version($c), $matches) !== 1) {
+ die("skip expected output only valid when using Oracle 11gR2 or greater databases");
+} else if (preg_match('/^(11\.2|12)\./', oci_client_version()) != 1) {
+ die("skip test expected to work only with Oracle 11gR2 or greater version of client");
}
?>
@@ -32,16 +23,8 @@ $stmtarray = array(
"create table nescurtest(c1 varchar2(10))"
);
-foreach($stmtarray as $stmt) {
- $s = oci_parse($c,$stmt);
- $r = @oci_execute($s);
- if (!$r) {
- $msg = oci_error($s);
- if ($msg['code'] !=942) {
- echo $msg['message'],"\n";
- }
- }
-}
+oci8_test_sql_execute($c, $stmtarray);
+
// Insert 500 rows into the table.
$insert_sql = "INSERT INTO nescurtest (c1) VALUES (:c1)";
if (!($s = oci_parse($c, $insert_sql))) {
@@ -92,15 +75,8 @@ $stmtarray = array(
"drop table nescurtest"
);
-foreach($stmtarray as $stmt) {
- $s = oci_parse($c,$stmt);
- $r = @oci_execute($s);
- if (!$r) {
- $msg = oci_error($s);
- echo $msg['message'],"\n";
- }
-}
-oci_close($c);
+oci8_test_sql_execute($c, $stmtarray);
+
echo "Done\n";
?>
--EXPECTF--
diff --git a/ext/oci8/tests/refcur_prefetch_4.phpt b/ext/oci8/tests/refcur_prefetch_4.phpt
new file mode 100644
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--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension");
+if (!extension_loaded('oci8')) die("skip no oci8 extension");
+require(dirname(__FILE__)."/connect.inc");
+if (preg_match('/Release 1[012]\./', oci_server_version($c), $matches) !== 1) {
+ die("skip expected output only valid when using Oracle 10g or greater databases");
+} else if (preg_match('/^(11\.2|12)\./', oci_client_version()) != 1) {
+ die("skip test expected to work only with Oracle 11gR2 or greater version of client");
+}
+?>
+--FILE--
+<?php
+require dirname(__FILE__)."/connect.inc";
+
+// Creates the necessary package and tables.
+$stmtarray = array(
+ "DROP TABLE refcurtest",
+
+ "CREATE TABLE refcurtest (c1 NUMBER, c2 VARCHAR(20))",
+
+ "CREATE or REPLACE PACKAGE refcurpkg is
+ type refcursortype is ref cursor;
+ procedure open_ref_cur(cur1 out refcursortype);
+ procedure fetch_ref_cur(cur1 in refcursortype, c1 out number, c2 out varchar2);
+ end refcurpkg;",
+
+ "CREATE or REPLACE PACKAGE body refcurpkg is
+ procedure open_ref_cur(cur1 out refcursortype) is
+ begin
+ open cur1 for select * from refcurtest order by c1;
+ end open_ref_cur;
+ procedure fetch_ref_cur(cur1 in refcursortype, c1 out number, c2 out varchar2) is
+ begin
+ fetch cur1 into c1,c2;
+ end fetch_ref_cur;
+ end refcurpkg;"
+ );
+
+oci8_test_sql_execute($c, $stmtarray);
+
+// Insert 500 rows into the table.
+$insert_sql = "INSERT INTO refcurtest (c1, c2) VALUES (:c1,:c2)";
+if (!($s = oci_parse($c, $insert_sql))) {
+ die("oci_parse(insert) failed!\n");
+}
+
+for ($i = 0; $i <= 500; $i++) {
+ $val2 = 'test'.$i;
+ oci_bind_by_name($s,':c1',$i);
+ oci_bind_by_name($s,':c2',$val2);
+ if (!oci_execute($s)) {
+ die("oci_execute(insert) failed!\n");
+ }
+}
+
+// Steps to Fetch from PHP . For every sub-test,the cursor is bound and then executed.
+
+$sql1 = "begin refcurpkg.open_ref_cur(:cur1); end;";
+$s1 = oci_parse($c,$sql1);
+$cur1 = oci_new_cursor($c);
+if (!oci_bind_by_name($s1,":cur1",$cur1,-1,SQLT_RSET)) {
+ die("oci_bind_by_name(sql1) failed!\n");
+}
+
+
+// Steps to Fetch from PL/SQL . For every sub-test,the cursor is bound and then executed.
+
+$sql2 = "begin refcurpkg.fetch_ref_cur(:curs1,:c1,:c2); end;";
+$s2 = oci_parse($c,$sql2);
+if (!oci_bind_by_name($s2, ":curs1", $cur1, -1, SQLT_RSET)) {
+ die("oci_bind_by_name(sql2) failed!\n");
+}
+if (!oci_bind_by_name($s2, ":c1", $c1, -1, SQLT_INT)) {
+ die("oci_bind_by_name(sql2) failed!\n");
+}
+if (!oci_bind_by_name($s2, ":c2", $c2, 20, SQLT_CHR)) {
+ die("oci_bind_by_name(sql2) failed!\n");
+}
+
+
+echo "------Test 1 - Set Prefetch after PL/SQL fetch ----------\n";
+$cur1 = oci_new_cursor($c);
+// Fetch from PL/SQL
+if (!oci_bind_by_name($s2,":curs1",$cur1,-1,SQLT_RSET)) {
+ die("oci_bind_by_name(sql2) failed!\n");
+}
+oci_execute($s2);
+echo "Fetch Row from PL/SQL\n";
+var_dump($c1);
+var_dump($c2);
+
+// Fetch from PHP
+echo "Fetch Row from PHP\n";
+if (!oci_bind_by_name($s1,":cur1",$cur1,-1,SQLT_RSET)) {
+ die("oci_bind_by_name(sql1) failed!\n");
+}
+oci_set_prefetch($cur1,5);
+oci_execute($s1);
+oci_execute($cur1);
+var_dump(oci_fetch_row($cur1));
+
+echo "------Test 2- Overwrite prefetch-----------\n";
+// Fetch from PHP
+$cur1 = oci_new_cursor($c);
+if (!oci_bind_by_name($s1,":cur1",$cur1,-1,SQLT_RSET)) {
+ die("oci_bind_by_name(sql1) failed!\n");
+}
+echo "Fetch Row from PHP\n";
+oci_execute($s1);
+oci_execute($cur1);
+var_dump(oci_fetch_row($cur1));
+oci_set_prefetch($cur1,5);
+oci_set_prefetch($cur1,0);
+oci_set_prefetch($cur1,100);
+
+// Fetch from PL/SQL
+if (!oci_bind_by_name($s2,":curs1",$cur1,-1,SQLT_RSET)) {
+ die("oci_bind_by_name(sql2) failed!\n");
+}
+oci_execute($s2);
+echo "Fetch Row from PL/SQL\n";
+var_dump($c1);
+var_dump($c2);
+
+
+function print_roundtrips($c) {
+ $sql_stmt = "select value from v\$mystat a,v\$statname c where
+ a.statistic#=c.statistic# and c.name='SQL*Net roundtrips to/from client'";
+ $s = oci_parse($c,$sql_stmt);
+ oci_define_by_name($s,"VALUE",$value);
+ oci_execute($s);
+ oci_fetch($s);
+ return $value;
+}
+
+// Clean up here
+
+$stmtarray = array(
+ "drop package refcurpkg",
+ "drop table refcurtest"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+echo "Done\n";
+?>
+--EXPECTF--
+------Test 1 - Set Prefetch after PL/SQL fetch ----------
+
+Warning: oci_execute(): ORA-01001: %s
+ORA-06512: at "SYSTEM.REFCURPKG", line %d
+ORA-06512: at line %d in %s on line %d
+Fetch Row from PL/SQL
+int(0)
+NULL
+Fetch Row from PHP
+array(2) {
+ [0]=>
+ string(1) "0"
+ [1]=>
+ string(5) "test0"
+}
+------Test 2- Overwrite prefetch-----------
+Fetch Row from PHP
+array(2) {
+ [0]=>
+ string(1) "0"
+ [1]=>
+ string(5) "test0"
+}
+Fetch Row from PL/SQL
+int(101)
+string(%d) "test101"
+Done
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--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => true); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
+// Note: with TimesTen, the column will be called "EXP"
+
require dirname(__FILE__)."/connect.inc";
$pc = oci_pconnect($user, $password, $dbase);
@@ -23,13 +28,13 @@ echo "Done\n";
array(2) {
[0]=>
string(1) "4"
- ["1+3"]=>
+ ["%r(1\+3|EXP)%r"]=>
string(1) "4"
}
array(2) {
[0]=>
string(1) "4"
- ["1+3"]=>
+ ["%r(1\+3|EXP)%r"]=>
string(1) "4"
}
Done
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--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
-<?php if (!extension_loaded("simplexml")) die("skip no simplexml extension"); ?>
+<?php
+if (!extension_loaded("simplexml")) die("skip no simplexml extension");
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
--FILE--
<?php
@@ -10,7 +12,7 @@ require(dirname(__FILE__)."/connect.inc");
// Initialization
-$stmts = array(
+$stmtarray = array(
"drop table xtt",
"create table xtt
(xt_id number, xt_spec xmltype)
@@ -31,16 +33,7 @@ $stmts = array(
</Xt>'))"
);
-foreach ($stmts as $q) {
- $s = oci_parse($c, $q);
- $r = @oci_execute($s);
- if (!$r) {
- $m = oci_error($s);
- if ($m['code'] != 942) { // table or view doesn't exist
- echo $m['message'], "\n";
- }
- }
-}
+oci8_test_sql_execute($c, $stmtarray);
function do_query($c)
{
@@ -78,14 +71,11 @@ $data = do_query($c);
// Cleanup
-$stmts = array(
+$stmtarray = array(
"drop table xtt",
);
-foreach ($stmts as $q) {
- $s = oci_parse($c, $q);
- @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
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--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
@@ -14,20 +17,7 @@ $stmtarray = array(
"create table xmltype_02_tab (warehouse_id number, warehouse_spec xmltype)",
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- $r = @oci_execute($s);
- if (!$r) {
- $m = oci_error($s);
- if (!in_array($m['code'], array( // ignore expected errors
- 942 // table or view does not exist
- , 2289 // sequence does not exist
- , 4080 // trigger does not exist
- ))) {
- echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
- }
- }
-}
+oci8_test_sql_execute($c, $stmtarray);
// Run Test
@@ -109,18 +99,11 @@ $row[0]->free();
// Clean up
-//require(dirname(__FILE__).'/drop_table.inc');
-
$stmtarray = array(
"drop table xmltype_02_tab"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
-
-oci_close($c);
+oci8_test_sql_execute($c, $stmtarray);
?>
===DONE===
@@ -130,57 +113,57 @@ Test 1 Insert new XML data using a temporary CLOB
array(1) {
[0]=>
object(OCI-Lob)#%d (1) {
- [%u|b%"descriptor"]=>
+ ["descriptor"]=>
resource(%d) of type (oci8 descriptor)
}
}
Test 2 Manipulate the data using SimpleXML
object(SimpleXMLElement)#%d (10) {
- [%u|b%"WarehouseId"]=>
- %unicode|string%(1) "1"
- [%u|b%"WarehouseName"]=>
- %unicode|string%(16) "Southlake, Texas"
- [%u|b%"Building"]=>
- %unicode|string%(5) "Owned"
- [%u|b%"Area"]=>
- %unicode|string%(5) "25000"
- [%u|b%"Docks"]=>
- %unicode|string%(1) "2"
- [%u|b%"DockType"]=>
- %unicode|string%(9) "Rear load"
- [%u|b%"WaterAccess"]=>
- %unicode|string%(4) "true"
- [%u|b%"RailAccess"]=>
- %unicode|string%(1) "N"
- [%u|b%"Parking"]=>
- %unicode|string%(6) "Street"
- [%u|b%"VClearance"]=>
- %unicode|string%(2) "10"
+ ["WarehouseId"]=>
+ string(1) "1"
+ ["WarehouseName"]=>
+ string(16) "Southlake, Texas"
+ ["Building"]=>
+ string(5) "Owned"
+ ["Area"]=>
+ string(5) "25000"
+ ["Docks"]=>
+ string(1) "2"
+ ["DockType"]=>
+ string(9) "Rear load"
+ ["WaterAccess"]=>
+ string(4) "true"
+ ["RailAccess"]=>
+ string(1) "N"
+ ["Parking"]=>
+ string(6) "Street"
+ ["VClearance"]=>
+ string(2) "10"
}
object(SimpleXMLElement)#%d (10) {
- [%u|b%"WarehouseId"]=>
- %unicode|string%(1) "1"
- [%u|b%"WarehouseName"]=>
- %unicode|string%(16) "Southlake, Texas"
- [%u|b%"Building"]=>
- %unicode|string%(5) "Owned"
- [%u|b%"Area"]=>
- %unicode|string%(5) "25000"
- [%u|b%"Docks"]=>
- %unicode|string%(1) "1"
- [%u|b%"DockType"]=>
- %unicode|string%(9) "Rear load"
- [%u|b%"WaterAccess"]=>
- %unicode|string%(4) "true"
- [%u|b%"RailAccess"]=>
- %unicode|string%(1) "N"
- [%u|b%"Parking"]=>
- %unicode|string%(6) "Street"
- [%u|b%"VClearance"]=>
- %unicode|string%(2) "10"
+ ["WarehouseId"]=>
+ string(1) "1"
+ ["WarehouseName"]=>
+ string(16) "Southlake, Texas"
+ ["Building"]=>
+ string(5) "Owned"
+ ["Area"]=>
+ string(5) "25000"
+ ["Docks"]=>
+ string(1) "1"
+ ["DockType"]=>
+ string(9) "Rear load"
+ ["WaterAccess"]=>
+ string(4) "true"
+ ["RailAccess"]=>
+ string(1) "N"
+ ["Parking"]=>
+ string(6) "Street"
+ ["VClearance"]=>
+ string(2) "10"
}
Test 3: Update changes using a temporary CLOB
-%unicode|string%(331) "<?xml version="1.0"?>
+string(331) "<?xml version="1.0"?>
<Warehouse>
<WarehouseId>1</WarehouseId>
<WarehouseName>Southlake, Texas</WarehouseName>