summaryrefslogtreecommitdiff
path: root/ext/oci8
diff options
context:
space:
mode:
authorOndřej Surý <ondrej@sury.org>2011-08-19 10:22:38 +0200
committerOndřej Surý <ondrej@sury.org>2011-08-19 10:27:52 +0200
commit25a8012220abbcafac709672188415f9bd6f8860 (patch)
treee3fb0c5b666877235611beb0a718ae36130c4582 /ext/oci8
parent8792636b0110fe5d6a084ad8648b3a39421263bd (diff)
downloadphp-25a8012220abbcafac709672188415f9bd6f8860.tar.gz
Imported Upstream version 5.3.7
Diffstat (limited to 'ext/oci8')
-rw-r--r--ext/oci8/config.m473
-rw-r--r--ext/oci8/oci8.c99
-rw-r--r--ext/oci8/oci8_interface.c56
-rw-r--r--ext/oci8/oci8_lob.c13
-rw-r--r--ext/oci8/oci8_statement.c6
-rw-r--r--ext/oci8/package.xml63
-rw-r--r--ext/oci8/php_oci8.h4
-rw-r--r--ext/oci8/php_oci8_int.h5
-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.phpt30
-rw-r--r--ext/oci8/tests/bind_char_1_11gR1.phpt12
-rw-r--r--ext/oci8/tests/bind_char_2.phpt30
-rw-r--r--ext/oci8/tests/bind_char_2_11gR1.phpt12
-rw-r--r--ext/oci8/tests/bind_char_3.phpt34
-rw-r--r--ext/oci8/tests/bind_char_3_11gR1.phpt14
-rw-r--r--ext/oci8/tests/bind_char_4.phpt32
-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.phpt50
-rw-r--r--ext/oci8/tests/bug27303_1_11gR1.phpt32
-rw-r--r--ext/oci8/tests/bug27303_2.phpt48
-rw-r--r--ext/oci8/tests/bug27303_2_11gR1.phpt28
-rw-r--r--ext/oci8/tests/bug27303_4.phpt18
-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.phpt17
-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/clientversion.phpt20
-rw-r--r--ext/oci8/tests/clientversion_92.phpt20
-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.phpt18
-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.phpt6
-rw-r--r--ext/oci8/tests/pecl_bug10194_blob.phpt21
-rw-r--r--ext/oci8/tests/pecl_bug10194_blob_64.phpt4
-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.phpt134
276 files changed, 5884 insertions, 2275 deletions
diff --git a/ext/oci8/config.m4 b/ext/oci8/config.m4
index 5b7010f35..38c3fa8fa 100644
--- a/ext/oci8/config.m4
+++ b/ext/oci8/config.m4
@@ -1,5 +1,5 @@
dnl
-dnl $Id: config.m4 300753 2010-06-25 21:18:09Z sixd $
+dnl $Id: config.m4 309823 2011-03-29 21:37:45Z sixd $
dnl
if test -z "$SED"; then
@@ -47,48 +47,37 @@ AC_DEFUN([AC_OCI8_CHECK_LIB_DIR],[
])
AC_DEFUN([AC_OCI8IC_VERSION],[
- AC_MSG_CHECKING([Oracle Instant Client version])
- if test -f $PHP_OCI8_INSTANT_CLIENT/libnnz11.$SHLIB_SUFFIX_NAME; then
- if test -f $PHP_OCI8_INSTANT_CLIENT/libclntsh.$SHLIB_SUFFIX_NAME.11.1; then
- if test ! -f $PHP_OCI8_INSTANT_CLIENT/libclntsh.$SHLIB_SUFFIX_NAME; then
- AC_MSG_ERROR([Link from $PHP_OCI8_INSTANT_CLIENT/libclntsh.$SHLIB_SUFFIX_NAME to libclntsh.$SHLIB_SUFFIX_NAME.11.1 not found])
- fi
- OCI8_ORACLE_VERSION=11.1
- else
- AC_MSG_ERROR([Oracle Instant Client library version not supported])
- fi
- elif test -f $PHP_OCI8_INSTANT_CLIENT/libnnz10.$SHLIB_SUFFIX_NAME; then
- if test -f $PHP_OCI8_INSTANT_CLIENT/libclntsh.$SHLIB_SUFFIX_NAME.10.1; then
- if test ! -f $PHP_OCI8_INSTANT_CLIENT/libclntsh.$SHLIB_SUFFIX_NAME; then
- AC_MSG_ERROR([Link from $PHP_OCI8_INSTANT_CLIENT/libclntsh.$SHLIB_SUFFIX_NAME to libclntsh.$SHLIB_SUFFIX_NAME.10.1 not found])
- fi
- OCI8_ORACLE_VERSION=10.1
- else
- AC_MSG_ERROR([Oracle Instant Client library version not supported])
+ AC_MSG_CHECKING([Oracle Instant Client library version compatibility])
+ OCI8_LCS_BASE=$PHP_OCI8_INSTANT_CLIENT/libclntsh.$SHLIB_SUFFIX_NAME
+ OCI8_LCS=`ls $OCI8_LCS_BASE.*.1 2> /dev/null | tail -1` # Oracle 10g, 11g etc
+ OCI8_NNZ=`ls $PHP_OCI8_INSTANT_CLIENT/libnnz*.$SHLIB_SUFFIX_NAME 2> /dev/null | tail -1`
+ if test -f "$OCI8_NNZ" && test -f "$OCI8_LCS"; then
+ if test ! -f "$OCI8_LCS_BASE"; then
+ AC_MSG_ERROR([Link from $OCI8_LCS_BASE to $OCI8_LCS_BASE.*.1 not found])
fi
+ OCI8_ORACLE_VERSION=`echo $OCI8_LCS | $PHP_OCI8_SED -e 's/.*\.\(.*\)\.1$/\1.1/'`
else
- AC_MSG_ERROR([Oracle Instant Client libraries not found])
+ AC_MSG_ERROR([Oracle Instant Client libraries libnnz.$SHLIB_SUFFIX_NAME and libclntsh.$SHLIB_SUFFIX_NAME not found])
fi
AC_MSG_RESULT([$OCI8_ORACLE_VERSION])
])
-
AC_DEFUN([AC_OCI8_ORACLE_VERSION],[
- AC_MSG_CHECKING([Oracle version])
+ AC_MSG_CHECKING([Oracle library version compatibility])
+ OCI8_LCS_BASE=$OCI8_DIR/$OCI8_LIB_DIR/libclntsh.$SHLIB_SUFFIX_NAME
+ OCI8_LCS=`ls $OCI8_LCS_BASE.*.1 2> /dev/null | tail -1` # Oracle 10g, 11g etc
if test -s "$OCI8_DIR/orainst/unix.rgs"; then
OCI8_ORACLE_VERSION=`grep '"ocommon"' $OCI8_DIR/orainst/unix.rgs | $PHP_OCI8_SED 's/[ ][ ]*/:/g' | cut -d: -f 6 | cut -c 2-4`
test -z "$OCI8_ORACLE_VERSION" && OCI8_ORACLE_VERSION=7.3
- elif test -f $OCI8_DIR/$OCI8_LIB_DIR/libclntsh.$SHLIB_SUFFIX_NAME.11.1; then
- OCI8_ORACLE_VERSION=11.1
- elif test -f $OCI8_DIR/$OCI8_LIB_DIR/libclntsh.$SHLIB_SUFFIX_NAME.10.1; then
- dnl There is no case for Oracle 10.2. Oracle 10.2 libraries have a 10.1 suffix for drop-in compatibility with Oracle 10.1
- OCI8_ORACLE_VERSION=10.1
- elif test -f $OCI8_DIR/$OCI8_LIB_DIR/libclntsh.$SHLIB_SUFFIX_NAME.9.0; then
+ elif test -f "$OCI8_LCS"; then
+ dnl Oracle 10g, 11g etc. The x.2 version libraries are named x.1 for drop in compatibility
+ OCI8_ORACLE_VERSION=`echo $OCI8_LCS | $PHP_OCI8_SED -e 's/.*\.\(.*\)\.1$/\1.1/'`
+ elif test -f $OCI8_LCS_BASE.9.0; then
dnl There is no case for Oracle 9.2. Oracle 9.2 libraries have a 9.0 suffix for drop-in compatibility with Oracle 9.0
OCI8_ORACLE_VERSION=9.0
- elif test -f $OCI8_DIR/$OCI8_LIB_DIR/libclntsh.$SHLIB_SUFFIX_NAME.8.0; then
+ elif test -f $OCI8_LCS_BASE.8.0; then
OCI8_ORACLE_VERSION=8.1
- elif test -f $OCI8_DIR/$OCI8_LIB_DIR/libclntsh.$SHLIB_SUFFIX_NAME.1.0; then
+ elif test -f $OCI8_LCS_BASE.1.0; then
OCI8_ORACLE_VERSION=8.0
elif test -f $OCI8_DIR/$OCI8_LIB_DIR/libclntsh.a; then
if test -f $OCI8_DIR/$OCI8_LIB_DIR/libcore4.a; then
@@ -97,7 +86,7 @@ AC_DEFUN([AC_OCI8_ORACLE_VERSION],[
OCI8_ORACLE_VERSION=8.1
fi
else
- AC_MSG_ERROR(Oracle client libraries not found)
+ AC_MSG_ERROR(Oracle libclntsh.$SHLIB_SUFFIX_NAME client library not found)
fi
AC_MSG_RESULT($OCI8_ORACLE_VERSION)
])
@@ -106,8 +95,8 @@ AC_DEFUN([AC_OCI8_ORACLE_VERSION],[
dnl --with-oci8=shared,instantclient,/path/to/client/dir/lib
dnl or
dnl --with-oci8=shared,/path/to/oracle/home
-PHP_ARG_WITH(oci8, for Oracle (OCI8) support,
-[ --with-oci8[=DIR] Include Oracle (OCI8) support. DIR defaults to \$ORACLE_HOME.
+PHP_ARG_WITH(oci8, for Oracle Database OCI8 support,
+[ --with-oci8[=DIR] Include Oracle Database OCI8 support. DIR defaults to \$ORACLE_HOME.
Use --with-oci8=instantclient,/path/to/instant/client/lib
to use an Oracle Instant Client installation])
@@ -258,12 +247,8 @@ if test "$PHP_OCI8" != "no"; then
])
;;
- 10.1|11.1)
- AC_DEFINE(HAVE_OCI_LOB_READ2,1,[ ])
- ;;
-
*)
- AC_MSG_ERROR([Oracle version $OCI8_ORACLE_VERSION is not supported])
+ AC_DEFINE(HAVE_OCI_LOB_READ2,1,[ ])
;;
esac
@@ -335,16 +320,8 @@ if test "$PHP_OCI8" != "no"; then
fi
AC_OCI8IC_VERSION($PHP_OCI8_INSTANT_CLIENT)
- case $OCI8_ORACLE_VERSION in
- 10.1|11.1)
- PHP_ADD_LIBRARY(clntsh, 1, OCI8_SHARED_LIBADD)
- PHP_ADD_LIBPATH($PHP_OCI8_INSTANT_CLIENT, OCI8_SHARED_LIBADD)
- ;;
-
- *)
- AC_MSG_ERROR([Oracle Instant Client version $PHP_OCI8_INSTANT_CLIENT is not supported])
- ;;
- esac
+ PHP_ADD_LIBRARY(clntsh, 1, OCI8_SHARED_LIBADD)
+ PHP_ADD_LIBPATH($PHP_OCI8_INSTANT_CLIENT, OCI8_SHARED_LIBADD)
AC_DEFINE(HAVE_OCI_INSTANT_CLIENT,1,[ ])
AC_DEFINE(HAVE_OCI_LOB_READ2,1,[ ])
diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c
index e0497bf67..b2a42ed46 100644
--- a/ext/oci8/oci8.c
+++ b/ext/oci8/oci8.c
@@ -26,7 +26,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: oci8.c 306939 2011-01-01 02:19:59Z felipe $ */
+/* $Id: oci8.c 313688 2011-07-25 23:40:57Z sixd $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -37,6 +37,13 @@
#include "php_ini.h"
#include "ext/standard/php_smart_str.h"
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
+#ifdef PHP_WIN32
+#include "win32/php_stdint.h"
+#endif
+
#if HAVE_OCI8
#if PHP_MAJOR_VERSION > 5
@@ -51,6 +58,14 @@
#include "php_oci8_int.h"
#include "zend_hash.h"
+#if defined(HAVE_STDINT_H) || defined(PHP_WIN32)
+#define OCI8_INT_TO_PTR(I) ((void *)(intptr_t)(I))
+#define OCI8_PTR_TO_INT(P) ((int)(intptr_t)(P))
+#else
+#define OCI8_INT_TO_PTR(I) ((void *)(I))
+#define OCI8_PTR_TO_INT(P) ((int)(P))
+#endif
+
ZEND_DECLARE_MODULE_GLOBALS(oci)
#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 1) || (PHP_MAJOR_VERSION > 5)
/* This "if" allows PECL builds from this file to be portable to older PHP releases */
@@ -447,6 +462,9 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_result, 0, 0, 2)
ZEND_ARG_INFO(0, column_number_or_name)
ZEND_END_ARG_INFO()
+ZEND_BEGIN_ARG_INFO(arginfo_oci_client_version, 0)
+ZEND_END_ARG_INFO()
+
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_server_version, 0, 0, 1)
ZEND_ARG_INFO(0, connection_resource)
ZEND_END_ARG_INFO()
@@ -681,6 +699,7 @@ static unsigned char arginfo_oci_bind_array_by_name[] = { 3, BYREF_NONE, BYREF_N
#define arginfo_oci_password_change NULL
#define arginfo_oci_new_cursor NULL
#define arginfo_oci_result NULL
+#define arginfo_oci_client_version NULL
#define arginfo_oci_server_version NULL
#define arginfo_oci_statement_type NULL
#define arginfo_oci_num_rows NULL
@@ -761,6 +780,7 @@ PHP_FUNCTION(oci_num_fields);
PHP_FUNCTION(oci_parse);
PHP_FUNCTION(oci_new_cursor);
PHP_FUNCTION(oci_result);
+PHP_FUNCTION(oci_client_version);
PHP_FUNCTION(oci_server_version);
PHP_FUNCTION(oci_statement_type);
PHP_FUNCTION(oci_num_rows);
@@ -836,6 +856,7 @@ zend_function_entry php_oci_functions[] = {
PHP_FE(oci_parse, arginfo_oci_parse)
PHP_FE(oci_new_cursor, arginfo_oci_new_cursor)
PHP_FE(oci_result, arginfo_oci_result)
+ PHP_FE(oci_client_version, arginfo_oci_client_version)
PHP_FE(oci_server_version, arginfo_oci_server_version)
PHP_FE(oci_statement_type, arginfo_oci_statement_type)
PHP_FE(oci_num_rows, arginfo_oci_num_rows)
@@ -931,7 +952,11 @@ zend_function_entry php_oci_functions[] = {
PHP_FALIAS(ocicollsize, oci_collection_size, arginfo_oci_collection_size)
PHP_FALIAS(ocicollmax, oci_collection_max, arginfo_oci_collection_max)
PHP_FALIAS(ocicolltrim, oci_collection_trim, arginfo_oci_collection_trim)
+#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION == 3 && PHP_RELEASE_VERSION >= 7) || (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 4) || (PHP_MAJOR_VERSION > 5)
+ PHP_FE_END
+#else
{NULL,NULL,NULL}
+#endif
};
static
@@ -962,7 +987,11 @@ zend_function_entry php_oci_lob_class_functions[] = {
PHP_FALIAS(save, oci_lob_save, arginfo_oci_lob_save_method)
PHP_FALIAS(savefile, oci_lob_import, arginfo_oci_lob_import_method)
PHP_FALIAS(free, oci_free_descriptor, arginfo_oci_free_descriptor_method)
+#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION == 3 && PHP_RELEASE_VERSION >= 7) || (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 4) || (PHP_MAJOR_VERSION > 5)
+ PHP_FE_END
+#else
{NULL,NULL,NULL}
+#endif
};
static
@@ -979,7 +1008,11 @@ zend_function_entry php_oci_coll_class_functions[] = {
PHP_FALIAS(max, oci_collection_max, arginfo_oci_collection_max_method)
PHP_FALIAS(trim, oci_collection_trim, arginfo_oci_collection_trim_method)
PHP_FALIAS(free, oci_free_collection, arginfo_oci_collection_free_method)
+#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION == 3 && PHP_RELEASE_VERSION >= 7) || (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 4) || (PHP_MAJOR_VERSION > 5)
+ PHP_FE_END
+#else
{NULL,NULL,NULL}
+#endif
};
zend_module_entry oci8_module_entry = {
@@ -1042,7 +1075,7 @@ static void php_oci_init_global_handles(TSRMLS_D)
#endif
if (OCI_G(env)
&& OCIErrorGet(OCI_G(env), (ub4)1, NULL, &ora_error_code, tmp_buf, (ub4)PHP_OCI_ERRBUF_LEN, (ub4)OCI_HTYPE_ENV) == OCI_SUCCESS
- && *tmp_buf) {
+ && *tmp_buf) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", tmp_buf);
}
@@ -1295,17 +1328,23 @@ PHP_RSHUTDOWN_FUNCTION(oci)
PHP_MINFO_FUNCTION(oci)
{
char buf[32];
+ char *ver;
php_info_print_table_start();
php_info_print_table_row(2, "OCI8 Support", "enabled");
php_info_print_table_row(2, "Version", PHP_OCI8_VERSION);
- php_info_print_table_row(2, "Revision", "$Revision: 306939 $");
+ php_info_print_table_row(2, "Revision", "$Revision: 313688 $");
snprintf(buf, sizeof(buf), "%ld", OCI_G(num_persistent));
php_info_print_table_row(2, "Active Persistent Connections", buf);
snprintf(buf, sizeof(buf), "%ld", OCI_G(num_links));
php_info_print_table_row(2, "Active Connections", buf);
+#if ((OCI_MAJOR_VERSION > 10) || ((OCI_MAJOR_VERSION == 10) && (OCI_MINOR_VERSION >= 2)))
+ php_oci_client_get_version(&ver TSRMLS_CC);
+ php_info_print_table_row(2, "Oracle Run-time Client Library Version", ver);
+ efree(ver);
+#endif
#if defined(OCI_MAJOR_VERSION) && defined(OCI_MINOR_VERSION)
snprintf(buf, sizeof(buf), "%d.%d", OCI_MAJOR_VERSION, OCI_MINOR_VERSION);
#elif defined(PHP_OCI8_ORACLE_VERSION)
@@ -1754,13 +1793,13 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Privileged connect is disabled. Enable oci8.privileged_connect to be able to connect as SYSOPER or SYSDBA");
return NULL;
}
- /* Disable privileged connections in Safe Mode (N.b. safe mode has been removed in PHP
- * 6 anyway)
- */
+#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION < 4) || (PHP_MAJOR_VERSION < 5)
+ /* Safe mode has been removed in PHP 5.4 */
if (PG(safe_mode)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Privileged connect is disabled in Safe Mode");
return NULL;
}
+#endif
}
}
@@ -1853,7 +1892,7 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char
int type, link;
void *ptr;
- link = (int) le->ptr;
+ link = OCI8_PTR_TO_INT(le->ptr);
ptr = zend_list_find(link,&type);
if (ptr && (type == le_connection)) {
connection = (php_oci_connection *)ptr;
@@ -1922,7 +1961,11 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char
memcmp(tmp->hash_key, hashed_details.c, hashed_details.len) == 0 && zend_list_addref(connection->rsrc_id) == SUCCESS) {
/* do nothing */
} else {
+#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 3) || (PHP_MAJOR_VERSION > 5)
+ connection->rsrc_id = zend_list_insert(connection, le_pconnection TSRMLS_CC);
+#else
connection->rsrc_id = zend_list_insert(connection, le_pconnection);
+#endif
/* Persistent connections: For old close semantics we artificially
* bump up the refcount to prevent the non-persistent destructor
* from getting called until request shutdown. The refcount is
@@ -2066,7 +2109,11 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char
new_le.ptr = connection;
new_le.type = le_pconnection;
connection->used_this_request = 1;
+#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 3) || (PHP_MAJOR_VERSION > 5)
+ connection->rsrc_id = zend_list_insert(connection, le_pconnection TSRMLS_CC);
+#else
connection->rsrc_id = zend_list_insert(connection, le_pconnection);
+#endif
/* Persistent connections: For old close semantics we artificially bump up the refcount to
* prevent the non-persistent destructor from getting called until request shutdown. The
@@ -2079,13 +2126,21 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char
OCI_G(num_persistent)++;
OCI_G(num_links)++;
} else if (!exclusive) {
+#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 3) || (PHP_MAJOR_VERSION > 5)
+ connection->rsrc_id = zend_list_insert(connection, le_connection TSRMLS_CC);
+#else
connection->rsrc_id = zend_list_insert(connection, le_connection);
- new_le.ptr = (void *)connection->rsrc_id;
+#endif
+ new_le.ptr = OCI8_INT_TO_PTR(connection->rsrc_id);
new_le.type = le_index_ptr;
zend_hash_update(&EG(regular_list), connection->hash_key, strlen(connection->hash_key)+1, (void *)&new_le, sizeof(zend_rsrc_list_entry), NULL);
OCI_G(num_links)++;
} else {
+#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 3) || (PHP_MAJOR_VERSION > 5)
+ connection->rsrc_id = zend_list_insert(connection, le_connection TSRMLS_CC);
+#else
connection->rsrc_id = zend_list_insert(connection, le_connection);
+#endif
OCI_G(num_links)++;
}
@@ -2368,6 +2423,30 @@ int php_oci_password_change(php_oci_connection *connection, char *user, int user
return 0;
} /* }}} */
+
+/* {{{ php_oci_client_get_version()
+ *
+ * Get Oracle client library version
+ */
+void php_oci_client_get_version(char **version TSRMLS_DC)
+{
+ char version_buff[256];
+ sword major_version = 0;
+ sword minor_version = 0;
+ sword update_num = 0;
+ sword patch_num = 0;
+ sword port_update_num = 0;
+
+#if ((OCI_MAJOR_VERSION > 10) || ((OCI_MAJOR_VERSION == 10) && (OCI_MINOR_VERSION >= 2))) /* OCIClientVersion only available 10.2 onwards */
+ PHP_OCI_CALL(OCIClientVersion, (&major_version, &minor_version, &update_num, &patch_num, &port_update_num));
+ snprintf(version_buff, sizeof(version_buff), "%d.%d.%d.%d.%d", major_version, minor_version, update_num, patch_num, port_update_num);
+#else
+ memcpy(version_buff, "Unknown", sizeof("Unknown"));
+#endif
+ *version = estrdup(version_buff);
+} /* }}} */
+
+
/* {{{ php_oci_server_get_version()
*
* Get Oracle server version
@@ -2778,7 +2857,11 @@ static php_oci_spool *php_oci_get_spool(char *username, int username_len, char *
}
spool_le.ptr = session_pool;
spool_le.type = le_psessionpool;
+#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 3) || (PHP_MAJOR_VERSION > 5)
+ zend_list_insert(session_pool, le_psessionpool TSRMLS_CC);
+#else
zend_list_insert(session_pool, le_psessionpool);
+#endif
zend_hash_update(&EG(persistent_list), session_pool->spool_hash_key, strlen(session_pool->spool_hash_key)+1,(void *)&spool_le, sizeof(zend_rsrc_list_entry),NULL);
} else if (spool_out_le->type == le_psessionpool &&
strlen(((php_oci_spool *)(spool_out_le->ptr))->spool_hash_key) == spool_hashed_details.len &&
diff --git a/ext/oci8/oci8_interface.c b/ext/oci8/oci8_interface.c
index 63b359dc0..e405f12f4 100644
--- a/ext/oci8/oci8_interface.c
+++ b/ext/oci8/oci8_interface.c
@@ -25,7 +25,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: oci8_interface.c 306939 2011-01-01 02:19:59Z felipe $ */
+/* $Id: oci8_interface.c 312017 2011-06-10 17:38:07Z sixd $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -233,26 +233,37 @@ PHP_FUNCTION(oci_lob_import)
int filename_len;
if (getThis()) {
+#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 3) || (PHP_MAJOR_VERSION > 5)
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &filename, &filename_len) == FAILURE) {
+#else
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &filename, &filename_len) == FAILURE) {
+#endif
return;
}
}
else {
+#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 3) || (PHP_MAJOR_VERSION > 5)
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Op", &z_descriptor, oci_lob_class_entry_ptr, &filename, &filename_len) == FAILURE) {
+#else
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Os", &z_descriptor, oci_lob_class_entry_ptr, &filename, &filename_len) == FAILURE) {
+#endif
return;
}
}
+#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION < 4) || (PHP_MAJOR_VERSION < 5)
+ /* The "p" parsing parameter handles this case in PHP 5.4+ */
if (strlen(filename) != filename_len) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Filename cannot contain null bytes");
RETURN_FALSE;
}
+#endif
if (zend_hash_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
RETURN_FALSE;
}
-
+
PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor);
if (php_oci_lob_import(descriptor, filename TSRMLS_CC)) {
@@ -641,12 +652,12 @@ PHP_FUNCTION(oci_lob_erase)
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ll", &offset, &length) == FAILURE) {
return;
}
-
+
if (ZEND_NUM_ARGS() > 0 && offset < 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset must be greater than or equal to 0");
RETURN_FALSE;
}
-
+
if (ZEND_NUM_ARGS() > 1 && length < 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length must be greater than or equal to 0");
RETURN_FALSE;
@@ -656,7 +667,7 @@ PHP_FUNCTION(oci_lob_erase)
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|ll", &z_descriptor, oci_lob_class_entry_ptr, &offset, &length) == FAILURE) {
return;
}
-
+
if (ZEND_NUM_ARGS() > 1 && offset < 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset must be greater than or equal to 0");
RETURN_FALSE;
@@ -674,7 +685,7 @@ PHP_FUNCTION(oci_lob_erase)
}
PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor);
-
+
if (php_oci_lob_erase(descriptor, offset, length, &bytes_erased TSRMLS_CC)) {
RETURN_FALSE;
}
@@ -872,7 +883,11 @@ PHP_FUNCTION(oci_lob_export)
ub4 lob_length;
if (getThis()) {
+#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 3) || (PHP_MAJOR_VERSION > 5)
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|ll", &filename, &filename_len, &start, &length) == FAILURE) {
+#else
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ll", &filename, &filename_len, &start, &length) == FAILURE) {
+#endif
return;
}
@@ -886,7 +901,11 @@ PHP_FUNCTION(oci_lob_export)
}
}
else {
+#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 3) || (PHP_MAJOR_VERSION > 5)
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Op|ll", &z_descriptor, oci_lob_class_entry_ptr, &filename, &filename_len, &start, &length) == FAILURE) {
+#else
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Os|ll", &z_descriptor, oci_lob_class_entry_ptr, &filename, &filename_len, &start, &length) == FAILURE) {
+#endif
return;
}
@@ -900,10 +919,13 @@ PHP_FUNCTION(oci_lob_export)
}
}
+#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION < 4) || (PHP_MAJOR_VERSION < 5)
+ /* The "p" parsing parameter handles this case in PHP 5.4+ */
if (strlen(filename) != filename_len) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Filename cannot contain null bytes");
RETURN_FALSE;
}
+#endif
if (zend_hash_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
@@ -929,15 +951,22 @@ PHP_FUNCTION(oci_lob_export)
RETURN_FALSE;
}
+#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION < 4) || (PHP_MAJOR_VERSION < 5)
+ /* Safe mode has been removed in PHP 5.4 */
if (PG(safe_mode) && (!php_checkuid(filename, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
RETURN_FALSE;
}
+#endif
if (php_check_open_basedir(filename TSRMLS_CC)) {
RETURN_FALSE;
}
+#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 3) || (PHP_MAJOR_VERSION > 5)
+ stream = php_stream_open_wrapper_ex(filename, "w", REPORT_ERRORS, NULL, NULL);
+#else
stream = php_stream_open_wrapper_ex(filename, "w", ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL, NULL);
+#endif
block_length = PHP_OCI_LOB_BUFFER_SIZE;
if (block_length > length) {
@@ -1881,11 +1910,13 @@ PHP_FUNCTION(oci_password_change)
int user_len, pass_old_len, pass_new_len, dbname_len;
php_oci_connection *connection;
- /* Disable in Safe Mode */
+#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION < 4) || (PHP_MAJOR_VERSION < 5)
+ /* Safe mode has been removed in PHP 5.4 */
if (PG(safe_mode)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "is disabled in Safe Mode");
RETURN_FALSE;
}
+#endif
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "rsss", &z_connection, &user, &user_len, &pass_old, &pass_old_len, &pass_new, &pass_new_len) == SUCCESS) {
PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection);
@@ -1971,6 +2002,17 @@ PHP_FUNCTION(oci_result)
}
/* }}} */
+/* {{{ proto string oci_client_version()
+ Return a string containing runtime client library version information */
+PHP_FUNCTION(oci_client_version)
+{
+ char *version = NULL;
+
+ php_oci_client_get_version(&version TSRMLS_CC);
+ RETURN_STRING(version, 0);
+}
+/* }}} */
+
/* {{{ proto string oci_server_version(resource connection)
Return a string containing server version information */
PHP_FUNCTION(oci_server_version)
diff --git a/ext/oci8/oci8_lob.c b/ext/oci8/oci8_lob.c
index f24294e3e..1045e35c1 100644
--- a/ext/oci8/oci8_lob.c
+++ b/ext/oci8/oci8_lob.c
@@ -25,7 +25,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: oci8_lob.c 306939 2011-01-01 02:19:59Z felipe $ */
+/* $Id: oci8_lob.c 313754 2011-07-27 00:04:23Z sixd $ */
@@ -724,7 +724,12 @@ int php_oci_lob_import (php_oci_descriptor *descriptor, char *filename TSRMLS_DC
char buf[8192];
ub4 offset = 1;
+#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 3) || (PHP_MAJOR_VERSION > 5)
+ /* Safe mode has been removed in PHP 5.4 */
+ if (php_check_open_basedir(filename TSRMLS_CC)) {
+#else
if ((PG(safe_mode) && (!php_checkuid(filename, NULL, CHECKUID_CHECK_FILE_AND_DIR))) || php_check_open_basedir(filename TSRMLS_CC)) {
+#endif
return 1;
}
@@ -888,7 +893,7 @@ int php_oci_lob_is_equal (php_oci_descriptor *descriptor_first, php_oci_descript
/* {{{ php_oci_lob_write_tmp()
Create temporary LOB and write data to it */
-int php_oci_lob_write_tmp (php_oci_descriptor *descriptor, ub1 type, char *data, int data_len TSRMLS_DC)
+int php_oci_lob_write_tmp (php_oci_descriptor *descriptor, long type, char *data, int data_len TSRMLS_DC)
{
php_oci_connection *connection = descriptor->connection;
OCILobLocator *lob = descriptor->descriptor;
@@ -900,7 +905,7 @@ int php_oci_lob_write_tmp (php_oci_descriptor *descriptor, ub1 type, char *data,
/* only these two are allowed */
break;
default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid temporary lob type: %d", type);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid temporary lob type: %ld", type);
return 1;
break;
}
@@ -916,7 +921,7 @@ int php_oci_lob_write_tmp (php_oci_descriptor *descriptor, ub1 type, char *data,
lob,
OCI_DEFAULT,
OCI_DEFAULT,
- type,
+ (ub1)type,
OCI_ATTR_NOCACHE,
OCI_DURATION_SESSION
)
diff --git a/ext/oci8/oci8_statement.c b/ext/oci8/oci8_statement.c
index e1f3ba4a6..fe5ba8399 100644
--- a/ext/oci8/oci8_statement.c
+++ b/ext/oci8/oci8_statement.c
@@ -25,7 +25,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: oci8_statement.c 306939 2011-01-01 02:19:59Z felipe $ */
+/* $Id: oci8_statement.c 313754 2011-07-27 00:04:23Z sixd $ */
#ifdef HAVE_CONFIG_H
@@ -887,7 +887,7 @@ int php_oci_bind_post_exec(void *data TSRMLS_DC)
* their reallocation but (i) any IN binds either interned or
* not should already be null terminated and (ii) for OUT
* binds, php_oci_bind_out_callback() should have allocated a
- * new string that can be realloced.
+ * new string that we can modify here.
*/
Z_STRVAL_P(bind->zval) = erealloc(Z_STRVAL_P(bind->zval), Z_STRLEN_P(bind->zval)+1);
Z_STRVAL_P(bind->zval)[ Z_STRLEN_P(bind->zval) ] = '\0';
@@ -1480,7 +1480,7 @@ int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, int nam
name_len,
(dvoid *) bindp->array.elements,
(sb4) bind->array.max_length,
- type,
+ (ub2)type,
(dvoid *)bindp->array.indicators,
(ub2 *)bind->array.element_lengths,
(ub2 *)0, /* bindp->array.retcodes, */
diff --git a/ext/oci8/package.xml b/ext/oci8/package.xml
index 5c15108a3..0bb6eb532 100644
--- a/ext/oci8/package.xml
+++ b/ext/oci8/package.xml
@@ -33,12 +33,12 @@ http://pear.php.net/dtd/package-2.0.xsd">
<active>no</active>
</lead>
- <date>2010-12-09</date>
- <time>20:00:00</time>
+ <date>2011-06-10</date>
+ <time>12:00:00</time>
<version>
- <release>1.4.5</release>
- <api>1.4.5</api>
+ <release>1.4.6</release>
+ <api>1.4.6</api>
</version>
<stability>
<release>stable</release>
@@ -46,7 +46,8 @@ http://pear.php.net/dtd/package-2.0.xsd">
</stability>
<license uri="http://www.php.net/license">PHP</license>
<notes>
- Protect against null bytes in LOB filenames (http://news.php.net/php.internals/50202)
+ Added oci_client_version() returning the runtime Oracle client library version
+ Made OCI8 extension buildable with PHP 5.4-development code
</notes>
<contents>
<dir name="/">
@@ -87,8 +88,20 @@ http://pear.php.net/dtd/package-2.0.xsd">
<file name="bind_empty.phpt" role="test" />
<file name="bind_long.phpt" role="test" />
<file name="bind_long_raw.phpt" role="test" />
+ <file name="bind_misccoltypes_errs.phpt" role="test" />
+ <file name="bind_misccoltypes.phpt" role="test" />
+ <file name="bind_number.phpt" role="test" />
+ <file name="bind_query.phpt" role="test" />
<file name="bind_raw.phpt" role="test" />
<file name="bind_rowid.phpt" role="test" />
+ <file name="bind_sqltafc.phpt" role="test" />
+ <file name="bind_sqltchr_1.phpt" role="test" />
+ <file name="bind_sqltchr_2.phpt" role="test" />
+ <file name="bind_sqltint.phpt" role="test" />
+ <file name="bind_sqltnum.phpt" role="test" />
+ <file name="bind_unsupported_1.phpt" role="test" />
+ <file name="bind_unsupported_2.phpt" role="test" />
+ <file name="bind_unsupported_3.phpt" role="test" />
<file name="bug26133.phpt" role="test" />
<file name="bug27303_1_11gR1.phpt" role="test" />
<file name="bug27303_1.phpt" role="test" />
@@ -125,8 +138,12 @@ http://pear.php.net/dtd/package-2.0.xsd">
<file name="bug46994.phpt" role="test" />
<file name="bug47189.phpt" role="test" />
<file name="bug47281.phpt" role="test" />
+ <file name="bug47281_tt.phpt" role="test" />
<file name="bug51253.phpt" role="test" />
- <file name="bug51291.phpt" role="test" />
+ <file name="bug51291_1.phpt" role="test" />
+ <file name="bug51291_2.phpt" role="test" />
+ <file name="clientversion_92.phpt" role="test" />
+ <file name="clientversion.phpt" role="test" />
<file name="close.phpt" role="test" />
<file name="coll_001.phpt" role="test" />
<file name="coll_002_func.phpt" role="test" />
@@ -193,15 +210,19 @@ http://pear.php.net/dtd/package-2.0.xsd">
<file name="cursor_bind.phpt" role="test" />
<file name="cursors_old.phpt" role="test" />
<file name="cursors.phpt" role="test" />
+ <file name="dbmsoutput.phpt" role="test" />
<file name="debug.phpt" role="test" />
+ <file name="default_prefetch0.phpt" role="test" />
<file name="default_prefetch1.phpt" role="test" />
<file name="default_prefetch2.phpt" role="test" />
<file name="default_prefetch.phpt" role="test" />
+ <file name="define0.phpt" role="test" />
<file name="define1.phpt" role="test" />
<file name="define2.phpt" role="test" />
<file name="define3.phpt" role="test" />
<file name="define4.phpt" role="test" />
<file name="define5.phpt" role="test" />
+ <file name="define6.phpt" role="test" />
<file name="define_old.phpt" role="test" />
<file name="define.phpt" role="test" />
<file name="descriptors.phpt" role="test" />
@@ -225,6 +246,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
<file name="driver_name.phpt" role="test" />
<file name="drop_table.inc" role="test" />
<file name="drop_type.inc" role="test" />
+ <file name="dupcolnames.phpt" role="test" />
<file name="edition_1.phpt" role="test" />
<file name="edition_2.phpt" role="test" />
<file name="error1.phpt" role="test" />
@@ -239,6 +261,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
<file name="extauth_02.phpt" role="test" />
<file name="extauth_03.phpt" role="test" />
<file name="extauth_04.phpt" role="test" />
+ <file name="fetch_all1.phpt" role="test" />
<file name="fetch_all2.phpt" role="test" />
<file name="fetch_all3.phpt" role="test" />
<file name="fetch_all4.phpt" role="test" />
@@ -249,12 +272,15 @@ http://pear.php.net/dtd/package-2.0.xsd">
<file name="fetch_into1.phpt" role="test" />
<file name="fetch_into2.phpt" role="test" />
<file name="fetch_into.phpt" role="test" />
+ <file name="fetch_object_1.phpt" role="test" />
<file name="fetch_object_2.phpt" role="test" />
<file name="fetch_object.phpt" role="test" />
<file name="fetch.phpt" role="test" />
<file name="fetch_row.phpt" role="test" />
+ <file name="field_funcs0.phpt" role="test" />
<file name="field_funcs1.phpt" role="test" />
<file name="field_funcs2.phpt" role="test" />
+ <file name="field_funcs3.phpt" role="test" />
<file name="field_funcs_old.phpt" role="test" />
<file name="field_funcs.phpt" role="test" />
<file name="function_aliases.phpt" role="test" />
@@ -302,6 +328,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
<file name="lob_041.phpt" role="test" />
<file name="lob_042.phpt" role="test" />
<file name="lob_043.phpt" role="test" />
+ <file name="lob_044.phpt" role="test" />
<file name="lob_aliases.phpt" role="test" />
<file name="lob_null.phpt" role="test" />
<file name="lob_temp1.phpt" role="test" />
@@ -309,6 +336,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
<file name="minfo.phpt" role="test" />
<file name="null_byte_1.phpt" role="test" />
<file name="null_byte_2.phpt" role="test" />
+ <file name="null_byte_3.phpt" role="test" />
<file name="num.phpt" role="test" />
<file name="oci8safemode.phpt" role="test" />
<file name="oci_execute_segfault.phpt" role="test" />
@@ -333,6 +361,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
<file name="refcur_prefetch_1.phpt" role="test" />
<file name="refcur_prefetch_2.phpt" role="test" />
<file name="refcur_prefetch_3.phpt" role="test" />
+ <file name="refcur_prefetch_4.phpt" role="test" />
<file name="reflection1.phpt" role="test" />
<file name="reflection2.phpt" role="test" />
<file name="select_null.phpt" role="test" />
@@ -366,8 +395,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
<required>
<php>
<min>4.3.9</min>
- <max>6.0.0</max>
- <exclude>6.0.0</exclude>
+ <max>5.4.99</max>
</php>
<pearinstaller>
<min>1.4.0b1</min>
@@ -382,6 +410,21 @@ http://pear.php.net/dtd/package-2.0.xsd">
<release>
<version>
+ <release>1.4.5</release>
+ <api>1.4.5</api>
+ </version>
+ <stability>
+ <release>stable</release>
+ <api>stable</api>
+ </stability>
+ <license uri="http://www.php.net/license">PHP</license>
+ <notes>
+ Protect against null bytes in LOB filenames (http://news.php.net/php.internals/50202)
+ </notes>
+</release>
+
+<release>
+ <version>
<release>1.4.4</release>
<api>1.4.4</api>
</version>
@@ -464,7 +507,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
oci_set_action
oci_set_client_info
oci_set_client_identifier
-
+
These set values that are visible/used by the database. They
are useful for tracing, authentication and auditing.
@@ -493,7 +536,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
oci_bind_by_name
7. Bug fixes:
- PECL bug #16842 (oci_error returns false when NO_DATA_FOUND is raised)
+ PECL bug #16842 (oci_error returns false when NO_DATA_FOUND is raised)
</notes>
</release>
diff --git a/ext/oci8/php_oci8.h b/ext/oci8/php_oci8.h
index 309b1623c..5a5c8d0b7 100644
--- a/ext/oci8/php_oci8.h
+++ b/ext/oci8/php_oci8.h
@@ -25,7 +25,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_oci8.h 306939 2011-01-01 02:19:59Z felipe $ */
+/* $Id: php_oci8.h 312535 2011-06-27 17:24:55Z sixd $ */
#if HAVE_OCI8
# ifndef PHP_OCI8_H
@@ -46,7 +46,7 @@
*/
#undef PHP_OCI8_VERSION
#endif
-#define PHP_OCI8_VERSION "1.4.5"
+#define PHP_OCI8_VERSION "1.4.6"
extern zend_module_entry oci8_module_entry;
#define phpext_oci8_ptr &oci8_module_entry
diff --git a/ext/oci8/php_oci8_int.h b/ext/oci8/php_oci8_int.h
index 0f3cf0f58..c88284816 100644
--- a/ext/oci8/php_oci8_int.h
+++ b/ext/oci8/php_oci8_int.h
@@ -25,7 +25,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_oci8_int.h 306939 2011-01-01 02:19:59Z felipe $ */
+/* $Id: php_oci8_int.h 313754 2011-07-27 00:04:23Z sixd $ */
#if HAVE_OCI8
# ifndef PHP_OCI8_INT_H
@@ -385,6 +385,7 @@ int php_oci_connection_commit(php_oci_connection * TSRMLS_DC);
int php_oci_connection_release(php_oci_connection *connection TSRMLS_DC);
int php_oci_password_change(php_oci_connection *, char *, int, char *, int, char *, int TSRMLS_DC);
+void php_oci_client_get_version(char ** TSRMLS_DC);
int php_oci_server_get_version(php_oci_connection *, char ** TSRMLS_DC);
void php_oci_fetch_row(INTERNAL_FUNCTION_PARAMETERS, int, int);
@@ -404,7 +405,7 @@ int php_oci_lob_get_buffering (php_oci_descriptor *);
int php_oci_lob_copy (php_oci_descriptor *, php_oci_descriptor *, long TSRMLS_DC);
int php_oci_lob_close (php_oci_descriptor * TSRMLS_DC);
int php_oci_temp_lob_close (php_oci_descriptor * TSRMLS_DC);
-int php_oci_lob_write_tmp (php_oci_descriptor *, ub1, char *, int TSRMLS_DC);
+int php_oci_lob_write_tmp (php_oci_descriptor *, long, char *, int TSRMLS_DC);
void php_oci_lob_free(php_oci_descriptor * TSRMLS_DC);
int php_oci_lob_import(php_oci_descriptor *descriptor, char * TSRMLS_DC);
int php_oci_lob_append (php_oci_descriptor *, php_oci_descriptor * TSRMLS_DC);
diff --git a/ext/oci8/tests/array_bind_001.phpt b/ext/oci8/tests/array_bind_001.phpt
index 1310325ad..6a3746c2d 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 4c76df42f..82b57dc73 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 497e46e49..94bce02e3 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 1ddf85149..1eb1fc7fa 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 58dadc20c..eaa3c4ea2 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 e229dd872..f13aca399 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 10c92a8e7..c926bc0ab 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 c44304c11..df2c35ccb 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 a77ed913e..ede82c97f 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 e8e00a809..9f43d1ac9 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 2208f0b3b..38e1701a4 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 bd9fdf133..9ab023635 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 63da558f9..926d7cfab 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 ebf767570..c8c1f1a5e 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 1aafb2431..5246f6380 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 ead85890f..53b551f1c 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 3c8bfd4f5..2f34979f2 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 5e06de876..49fea2aa0 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 c8e1e0cdb..87291bd17 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 af4dbfe22..3f60ee8c2 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 9f04f302c..291122917 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 08f5f528c..ae96953d7 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 0decb3487..cc57c20d6 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 24ab1fc82..a668294d4 100644
--- a/ext/oci8/tests/bind_char_1.phpt
+++ b/ext/oci8/tests/bind_char_1.phpt
@@ -4,20 +4,14 @@ 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");
}
?>
+--ENV--
+NLS_LANG=
--FILE--
<?php
@@ -33,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
@@ -206,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_1_11gR1.phpt b/ext/oci8/tests/bind_char_1_11gR1.phpt
index 60b7142ff..55973a61b 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 fa2e547db..53785e066 100644
--- a/ext/oci8/tests/bind_char_2.phpt
+++ b/ext/oci8/tests/bind_char_2.phpt
@@ -4,20 +4,14 @@ 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");
}
?>
+--ENV--
+NLS_LANG=
--FILE--
<?php
@@ -32,10 +26,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 +86,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 68a872fc4..357a716e6 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 052981ace..a459f616b 100644
--- a/ext/oci8/tests/bind_char_3.phpt
+++ b/ext/oci8/tests/bind_char_3.phpt
@@ -4,20 +4,14 @@ 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");
}
?>
+--ENV--
+NLS_LANG=
--FILE--
<?php
@@ -28,11 +22,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 +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_3_11gR1.phpt b/ext/oci8/tests/bind_char_3_11gR1.phpt
index aaa537119..1e7da47ed 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 fd38d902c..34d703c52 100644
--- a/ext/oci8/tests/bind_char_4.phpt
+++ b/ext/oci8/tests/bind_char_4.phpt
@@ -4,20 +4,14 @@ 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");
}
?>
+--ENV--
+NLS_LANG=
--FILE--
<?php
@@ -31,10 +25,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 +236,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 c4f7968e1..87b7daba8 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 ba6bd4d04..40c579992 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 2a9962eac..e48bbd33e 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 000000000..0da8c8bf8
--- /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 000000000..20401fb8e
--- /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 000000000..6412b5f82
--- /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 000000000..e4edc9329
--- /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 c9087e552..c2e8e0876 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 f15d8f8bb..122ad5e18 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 000000000..8d2ce2ae6
--- /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 000000000..aabf9bda5
--- /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 000000000..47d08d2bc
--- /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 000000000..f01791d3b
--- /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 000000000..d3828b73e
--- /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 000000000..544b44678
--- /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 000000000..d3e5375df
--- /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 000000000..5c9dec372
--- /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 2463e70c7..59f8a17f3 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 6d491966a..028f5b793 100644
--- a/ext/oci8/tests/bug27303_1.phpt
+++ b/ext/oci8/tests/bug27303_1.phpt
@@ -4,35 +4,27 @@ 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");
}
?>
+--ENV--
+NLS_LANG=
--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 +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";
?>
@@ -263,4 +253,4 @@ string(3) "196"
string(3) "197"
string(3) "198"
string(3) "199"
-Done \ No newline at end of file
+Done
diff --git a/ext/oci8/tests/bug27303_1_11gR1.phpt b/ext/oci8/tests/bug27303_1_11gR1.phpt
index fe5c17c3e..20097613f 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 3d0c08770..e7564ac21 100644
--- a/ext/oci8/tests/bug27303_2.phpt
+++ b/ext/oci8/tests/bug27303_2.phpt
@@ -4,35 +4,27 @@ 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");
}
?>
+--ENV--
+NLS_LANG=
--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)";
+$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 +46,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";
?>
@@ -265,4 +255,4 @@ string(3) "196"
string(3) "197"
string(3) "198"
string(3) "199"
-Done \ No newline at end of file
+Done
diff --git a/ext/oci8/tests/bug27303_2_11gR1.phpt b/ext/oci8/tests/bug27303_2_11gR1.phpt
index e1daef053..c2b5c433c 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 20dec54da..0dcfed913 100644
--- a/ext/oci8/tests/bug27303_4.phpt
+++ b/ext/oci8/tests/bug27303_4.phpt
@@ -4,20 +4,14 @@ 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");
}
?>
+--ENV--
+NLS_LANG=
--FILE--
<?php
diff --git a/ext/oci8/tests/bug32325.phpt b/ext/oci8/tests/bug32325.phpt
index 257c6977b..854e5c159 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 81e1e58ba..3f4299ea2 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 d451f3f2f..d18104687 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 44b3a6ddc..2ec366b46 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 68c5f7b0a..53dae694e 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 6743165b7..fd91dc73d 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
@@ -43,7 +43,7 @@ oci_execute($stmt);
while ($row = oci_fetch_array($stmt, OCI_ASSOC+OCI_RETURN_NULLS)) {
foreach ($row as $item) {
- echo $item."\n";
+ echo trim($item)."\n";
}
echo "\n";
}
@@ -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 ec86c5195..1c00f68d3 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 b92df9e39..901f6f7bf 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 4a234e176..4070221ee 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 1ebc249d3..fcccfe716 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 b3a1b9969..5daa46d6f 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 2b0e3707d..10b7ef160 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 501ed75cd..d5e2f70c1 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 4d7e2c585..abf6cc8c7 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 e2800bbd8..8c4b79141 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 921c8149d..a86d1ca84 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 d28aabfce..e84fa4255 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 fcf96e984..61511cf6d 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 1ea46b40d..600fb047b 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 e2cb1ce48..932a863d7 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 fd10b26b8..faacdc625 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 eee21c3ae..aa4f2bb8e 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 e5771e418..63805bf6e 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 b1dc7720c..b257f1fc0 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 0504952f6..604b57f26 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 073b410fc..c82d2cd73 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 710246738..6b94bdef2 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 000000000..4b4e92ede
--- /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 fea3333cc..a97272f65 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 75851d63b..789b94ea0 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 000000000..d5dbf6f82
--- /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/clientversion.phpt b/ext/oci8/tests/clientversion.phpt
new file mode 100644
index 000000000..db70b5aff
--- /dev/null
+++ b/ext/oci8/tests/clientversion.phpt
@@ -0,0 +1,20 @@
+--TEST--
+oci_client_version()
+--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
+
+echo oci_client_version(), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+%d.%d.%d.%d.%d
+===DONE===
diff --git a/ext/oci8/tests/clientversion_92.phpt b/ext/oci8/tests/clientversion_92.phpt
new file mode 100644
index 000000000..d4b92cd35
--- /dev/null
+++ b/ext/oci8/tests/clientversion_92.phpt
@@ -0,0 +1,20 @@
+--TEST--
+oci_client_version() for Oracle 9.2 client libraries
+--SKIPIF--
+<?php
+if (!extension_loaded('oci8')) die("skip no oci8 extension");
+if (preg_match('/Unknown/', oci_client_version()) != 1) {
+ die("skip test expected to work only with Oracle 9gR2 client libraries");
+}
+?>
+--FILE--
+<?php
+
+echo oci_client_version(), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Unknown
+===DONE===
diff --git a/ext/oci8/tests/coll_001.phpt b/ext/oci8/tests/coll_001.phpt
index 57d3cf1b4..625d71a29 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 6d3051989..cd068ff0b 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 58e641ee2..9d8e4cf97 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 b5236ef6f..d7c52fe8e 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 f5c6dc7f3..58655a55f 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 eb2ac7e26..f71db4d0f 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 57dff2eb3..8f24363e1 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 0f4006996..84084e7dd 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 cf258cbe3..4799eb6b7 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 56707d608..3d6560614 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 31e10c065..86ce62f79 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 57d44cc9a..431d5d635 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 296d6493e..917af5f2c 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 3ed416ce0..0c5b46ddd 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 6f72dd16c..da088e919 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 7b63a276f..c5379ac9f 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 7d805d3f7..3e8aa9d6a 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 dca640e84..3871dd90e 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 543dafd90..4b912a80f 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 fd1019e41..574281d14 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 00d88bb9a..04f549845 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 0d01bc174..1992b94f6 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 8458525ae..e89f4a37b 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 a0fe555b6..7d771633d 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 64b0aea10..c422d211b 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 eeed7839a..18e21dd93 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 c2af9cc22..2e06e2959 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 cde26f22f..67830af25 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 42347ba6f..56f509965 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 914844ae6..3440195fe 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 f97cc49e7..a3f0b29ce 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 15a673d71..371c802ed 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 836d2cd1d..806fb193a 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 1819fe116..4079ac0c3 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 196e0650c..012fc0237 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 c7c1b870e..ad508a2ed 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 4765d5eb7..107250352 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 8b6d92123..be8d3306d 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 9f55f5326..b1a22858a 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 9f6b6c724..d694ec06a 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 5e340cf6f..06d134856 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 d6d16f17e..d265d1da9 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 7017493f5..7d05c1141 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 a881ea6ea..7f26d4334 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 9e6b5ce2e..94adb85e9 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 1cd44b021..e7891a107 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 9b4cd1f27..40369c67b 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 121fb33dc..3afc87b91 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 3347543ab..d7b4edfdb 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 be99a8bd6..1620803db 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 602d55ff8..5a731337a 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 9bb42e75a..c7cfecf39 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 afd1fceb9..733598068 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 c2ce15cb3..740402e7e 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 33bd04b6d..197aad1d1 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 22c89c9c5..0919e4411 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 73447c82b..d60e2ff1e 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 000000000..eaace0fa0
--- /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 47191c858..cc70c6ecb 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 000000000..cc70c6ecb
--- /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 bcd66fa38..bc7882936 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 7b3f29f29..d8a76dbb0 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 d99bc7e1a..c6ce7bd9b 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 000000000..f2f06e315
--- /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 341bc9ed8..6e4b74e3b 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 46e11bf88..c53bebd2e 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 892e8e380..77714a92f 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 8d83f73ac..266fd7edd 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 63541ce9d..68fa01d09 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 000000000..50e23ecf4
--- /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 618f9d5f5..f65e6b808 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 8be4f3a06..9193fddde 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 922b8c4f4..4c07e636e 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 bf619a4ef..25395dc18 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 26adb21f3..f6b24446c 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 9af20625e..45b5ee4bd 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 187d7e186..bf86e66e7 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 000000000..bf0749717
--- /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 9a4b0f3b6..b9c8fd817 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 f7ab979bc..030e6a673 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 743820f90..7fedd0dda 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 25a3f09e9..c6fba2e83 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 13ea6cebe..12eab61a6 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 ad66ad59f..6ee26ee82 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 a6889c897..c6f9cd300 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 8100e3170..458df8715 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 83aae69f7..52d515ffc 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 520632494..e48aeefd8 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 a007bac83..4fc41daad 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 000000000..4fc41daad
--- /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 ff44cac70..483e51573 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 42fe617dc..1748ea565 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 9b82262e3..1d3c9677e 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 bb9061a44..a6bb3c3f1 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 e2f32483d..db5c6c554 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 7dacf2e5b..5c4c91e1d 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 17e06e1cf..45a6a8132 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 263590d14..8f7a6bdeb 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 c196d39f6..7bef2c082 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 674a88ff2..1c290d5e9 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 000000000..4f14a5ec0
--- /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 b078ebb1d..1814446aa 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 c6084d4fe..2b28634ab 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 18143f6f1..92b77187a 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 000000000..5448fcbc3
--- /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 0b4ad76b3..c14ee8957 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 000000000..e51949cf2
--- /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 e0d24cd7b..629c5508f 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 cbcb92e7e..cb94bfae1 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 ebbef1815..7417f9c12 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 8a492d16c..4775444e2 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 32de4a012..3f583c67a 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 e1ac6e534..a1e3c3bd8 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 3192ebc90..ae6b37c96 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 1fe63092c..1ca236ea2 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 a36bb4a34..6f4cc0564 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 b9f740112..4702e61ac 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 59f3e145f..3361c4b9b 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 b074e1730..7580d4caf 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 2061969bc..99b971a0b 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 c56de5619..556e56dc3 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 1ba29ee64..2a1a6bed6 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 297d5b497..b4a19684a 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 642e7195e..e0f78e6a9 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 ed12cc468..d27a09052 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 35cec4bd7..352cd5033 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 fb9a3c818..19c21f4a7 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 6564dede9..3faa89ff7 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 0ae6b377a..b7489271b 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 5fb9dfab0..94d175b3b 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 0c352956d..6416fb45a 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 9a7f53240..ed9b56727 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 5b5e845a7..1566944cb 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 157d78a2b..aa4c254dd 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 8b49b1ac5..49850635c 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 8ac2da3a3..8da7a8af8 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 6826f36cd..85b230e90 100644
--- a/ext/oci8/tests/lob_029.phpt
+++ b/ext/oci8/tests/lob_029.phpt
@@ -1,16 +1,24 @@
--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");
+}
+if (substr(PHP_OS, 0, 3) == 'WIN') die("skip Test script not ported to Windows");
?>
--FILE--
<?php
-require dirname(__FILE__).'/connect.inc';
+require(dirname(__FILE__).'/connect.inc');
-$realdirname = dirname(__FILE__);
+$realdirname = "/tmp"; // Use /tmp because a local dir can give ORA-22288 depending on perms
$realfilename1 = "oci8bfiletest1.txt";
$fullname1 = $realdirname."/".$realfilename1;
$realfilename2 = "oci8bfiletest2.txt";
diff --git a/ext/oci8/tests/lob_030.phpt b/ext/oci8/tests/lob_030.phpt
index 86b2956a5..d7fd21b96 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 a27d53bb3..39d27fd4a 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 5d6ff6ec9..97b63c984 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 5647cd9a4..cdce2d086 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 6bf4058e7..7561f64ff 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 6e1f5a735..37e010ce7 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 e72c1cf08..060b1713c 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 228f5e812..75db589aa 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 91dac66c0..34b7b48b6 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 5675f5a92..02d057e2b 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 3f8a73dc5..0a29dc1b9 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 d04b43606..aa1ea98a5 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 25309d6fc..264c61045 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 0280ef6de..ade79a200 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 000000000..28599cc33
--- /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 faa59bf12..3ece9a589 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 227ebb89f..be3e53453 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 cad2d3905..9a07fb5ac 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 2482d65f6..e27ea6d47 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 b4c9b61ad..01fb87235 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 000000000..73d5c26c0
--- /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 e9dc6a8ac..0fe85ccdd 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 9ba7d770f..59eb8013e 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 7133d8bae..1738702cb 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 71423e717..ceba0bba8 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 ba6baa964..8041699f9 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 abcaeb1e5..3ff726d2b 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 4714fadcd..6a9044b1a 100644
--- a/ext/oci8/tests/pecl_bug10194.phpt
+++ b/ext/oci8/tests/pecl_bug10194.phpt
@@ -1,7 +1,11 @@
--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 ($stress_test !== true) die ('skip Test not run when $stress_test is FALSE');
+?>
--INI--
memory_limit=10M
--FILE--
diff --git a/ext/oci8/tests/pecl_bug10194_blob.phpt b/ext/oci8/tests/pecl_bug10194_blob.phpt
index 4c6aa4f1c..75632ce47 100644
--- a/ext/oci8/tests/pecl_bug10194_blob.phpt
+++ b/ext/oci8/tests/pecl_bug10194_blob.phpt
@@ -1,22 +1,23 @@
--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");
-?>
+if ($stress_test !== true) die ('skip Test not run when $stress_test is FALSE');
+?>
--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 +31,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 +49,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 433d586a4..da7ec592f 100644
--- a/ext/oci8/tests/pecl_bug10194_blob_64.phpt
+++ b/ext/oci8/tests/pecl_bug10194_blob_64.phpt
@@ -2,8 +2,10 @@
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");
+if ($stress_test !== true) die ('skip Test not run when $stress_test is FALSE');
?>
--INI--
memory_limit=6M
diff --git a/ext/oci8/tests/pecl_bug16035.phpt b/ext/oci8/tests/pecl_bug16035.phpt
index fc91bc91b..29ff6439d 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 d796d2506..dbf7e6bb8 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 c369711fc..71771b210 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 26762601d..b163a89e9 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 c2ac8fe84..ac43771c6 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 904e4da1f..ea09fbcd9 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 751ffa78f..8d6525107 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 0666a96e9..8c0414042 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 000000000..d24398c00
--- /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 87c5b815f..450c81a87 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 bf32fe4b5..6cbb5aaad 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 ed0992c8d..0ae2876e2 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 19e69d4c2..4c48d3f1d 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 a9458c83d..21aca6cc1 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 9b6fa8ad3..28e9401ba 100644
--- a/ext/oci8/tests/xmltype_02.phpt
+++ b/ext/oci8/tests/xmltype_02.phpt
@@ -1,7 +1,11 @@
--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');
+if (!extension_loaded("simplexml")) die ("skip no simplexml extension");
+?>
--FILE--
<?php
@@ -14,20 +18,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 +100,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,68 +114,68 @@ 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(%d) "<?xml version="1.0"?>
<Warehouse>
-<WarehouseId>1</WarehouseId>
-<WarehouseName>Southlake, Texas</WarehouseName>
-<Building>Owned</Building>
-<Area>25000</Area>
-<Docks>1</Docks>
-<DockType>Rear load</DockType>
-<WaterAccess>true</WaterAccess>
-<RailAccess>N</RailAccess>
-<Parking>Street</Parking>
-<VClearance>10</VClearance>
+%sWarehouseId>1</WarehouseId>
+%sWarehouseName>Southlake, Texas</WarehouseName>
+%sBuilding>Owned</Building>
+%sArea>25000</Area>
+%sDocks>1</Docks>
+%sDockType>Rear load</DockType>
+%sWaterAccess>true</WaterAccess>
+%sRailAccess>N</RailAccess>
+%sParking>Street</Parking>
+%sVClearance>10</VClearance>
</Warehouse>
"
===DONE=== \ No newline at end of file