summaryrefslogtreecommitdiff
path: root/ext/oci8
diff options
context:
space:
mode:
Diffstat (limited to 'ext/oci8')
-rw-r--r--ext/oci8/README10
-rw-r--r--ext/oci8/config.m4144
-rw-r--r--ext/oci8/oci8.c603
-rw-r--r--ext/oci8/oci8_collection.c258
-rw-r--r--ext/oci8/oci8_dtrace.d36
-rw-r--r--ext/oci8/oci8_interface.c94
-rw-r--r--ext/oci8/oci8_lob.c253
-rw-r--r--ext/oci8/oci8_statement.c391
-rw-r--r--ext/oci8/package.xml193
-rw-r--r--ext/oci8/php_oci8.h2
-rw-r--r--ext/oci8/php_oci8_int.h276
-rw-r--r--ext/oci8/tests/bind_char_1.phpt13
-rw-r--r--ext/oci8/tests/bind_char_1_11gR1.phpt10
-rw-r--r--ext/oci8/tests/bind_char_2.phpt13
-rw-r--r--ext/oci8/tests/bind_char_2_11gR1.phpt10
-rw-r--r--ext/oci8/tests/bind_char_3.phpt13
-rw-r--r--ext/oci8/tests/bind_char_3_11gR1.phpt10
-rw-r--r--ext/oci8/tests/bind_char_4.phpt13
-rw-r--r--ext/oci8/tests/bind_char_4_11gR1.phpt10
-rw-r--r--ext/oci8/tests/bind_unsupported_2.phpt3
-rw-r--r--ext/oci8/tests/bug27303_1.phpt13
-rw-r--r--ext/oci8/tests/bug27303_1_11gR1.phpt13
-rw-r--r--ext/oci8/tests/bug27303_2.phpt13
-rw-r--r--ext/oci8/tests/bug27303_2_11gR1.phpt13
-rw-r--r--ext/oci8/tests/bug27303_4.phpt14
-rw-r--r--ext/oci8/tests/bug27303_4_11gR1.phpt13
-rw-r--r--ext/oci8/tests/bug36403.phpt5
-rw-r--r--ext/oci8/tests/bug43497.phpt5
-rw-r--r--ext/oci8/tests/bug47281.phpt7
-rw-r--r--ext/oci8/tests/commit_001.phpt36
-rw-r--r--ext/oci8/tests/conn_attr.inc42
-rw-r--r--ext/oci8/tests/conn_attr_1.phpt12
-rw-r--r--ext/oci8/tests/conn_attr_2.phpt36
-rw-r--r--ext/oci8/tests/conn_attr_3.phpt11
-rw-r--r--ext/oci8/tests/conn_attr_4.phpt18
-rw-r--r--ext/oci8/tests/conn_attr_5.phpt11
-rw-r--r--ext/oci8/tests/connect_without_oracle_home.phpt4
-rw-r--r--ext/oci8/tests/connect_without_oracle_home_11.phpt6
-rw-r--r--ext/oci8/tests/connect_without_oracle_home_old_11.phpt6
-rw-r--r--ext/oci8/tests/cursors_old.phpt16
-rw-r--r--ext/oci8/tests/debug.phpt7
-rw-r--r--ext/oci8/tests/define.phpt2
-rw-r--r--ext/oci8/tests/define1.phpt2
-rw-r--r--ext/oci8/tests/define4.phpt14
-rw-r--r--ext/oci8/tests/define5.phpt8
-rw-r--r--ext/oci8/tests/define_old.phpt2
-rw-r--r--ext/oci8/tests/details.inc4
-rw-r--r--ext/oci8/tests/edition_1.phpt47
-rw-r--r--ext/oci8/tests/edition_2.phpt10
-rw-r--r--ext/oci8/tests/error_set.phpt72
-rw-r--r--ext/oci8/tests/extauth_01.phpt48
-rw-r--r--ext/oci8/tests/extauth_02.phpt48
-rw-r--r--ext/oci8/tests/extauth_03.phpt48
-rw-r--r--ext/oci8/tests/fetch.phpt12
-rw-r--r--ext/oci8/tests/fetch_all.phpt32
-rw-r--r--ext/oci8/tests/fetch_all1.phpt32
-rw-r--r--ext/oci8/tests/fetch_all3.phpt336
-rw-r--r--ext/oci8/tests/fetch_all4.phpt4
-rw-r--r--ext/oci8/tests/fetch_all5.phpt32
-rw-r--r--ext/oci8/tests/fetch_into.phpt16
-rw-r--r--ext/oci8/tests/fetch_object.phpt36
-rw-r--r--ext/oci8/tests/fetch_row.phpt12
-rw-r--r--ext/oci8/tests/field_funcs1.phpt4
-rw-r--r--ext/oci8/tests/function_aliases.phpt2
-rw-r--r--ext/oci8/tests/imp_res_1.phpt630
-rw-r--r--ext/oci8/tests/imp_res_2.phpt99
-rw-r--r--ext/oci8/tests/imp_res_3.phpt1257
-rw-r--r--ext/oci8/tests/imp_res_4.phpt82
-rw-r--r--ext/oci8/tests/imp_res_5.phpt84
-rw-r--r--ext/oci8/tests/imp_res_6.phpt118
-rw-r--r--ext/oci8/tests/imp_res_7.phpt873
-rw-r--r--ext/oci8/tests/imp_res_call_error.phpt61
-rw-r--r--ext/oci8/tests/imp_res_cancel.phpt68
-rw-r--r--ext/oci8/tests/imp_res_close.phpt69
-rw-r--r--ext/oci8/tests/imp_res_cursor.phpt99
-rw-r--r--ext/oci8/tests/imp_res_dbmsoutput.phpt136
-rw-r--r--ext/oci8/tests/imp_res_field.phpt227
-rw-r--r--ext/oci8/tests/imp_res_func_error.phpt67
-rw-r--r--ext/oci8/tests/imp_res_get_1.phpt109
-rw-r--r--ext/oci8/tests/imp_res_get_2.phpt107
-rw-r--r--ext/oci8/tests/imp_res_get_3.phpt267
-rw-r--r--ext/oci8/tests/imp_res_get_4.phpt146
-rw-r--r--ext/oci8/tests/imp_res_get_5.phpt124
-rw-r--r--ext/oci8/tests/imp_res_get_all.phpt120
-rw-r--r--ext/oci8/tests/imp_res_get_cancel.phpt56
-rw-r--r--ext/oci8/tests/imp_res_get_close_1.phpt68
-rw-r--r--ext/oci8/tests/imp_res_get_close_2.phpt64
-rw-r--r--ext/oci8/tests/imp_res_get_close_3.phpt65
-rw-r--r--ext/oci8/tests/imp_res_get_cursor.phpt101
-rw-r--r--ext/oci8/tests/imp_res_get_dbmsoutput.phpt156
-rw-r--r--ext/oci8/tests/imp_res_get_exec.phpt55
-rw-r--r--ext/oci8/tests/imp_res_get_none.phpt46
-rw-r--r--ext/oci8/tests/imp_res_insert.phpt152
-rw-r--r--ext/oci8/tests/imp_res_lob.phpt101
-rw-r--r--ext/oci8/tests/imp_res_prefetch.phpt185
-rw-r--r--ext/oci8/tests/lob_015.phpt2
-rw-r--r--ext/oci8/tests/lob_temp2.phpt40
-rw-r--r--ext/oci8/tests/minfo.phpt6
-rw-r--r--ext/oci8/tests/password.phpt16
-rw-r--r--ext/oci8/tests/password_2.phpt16
-rw-r--r--ext/oci8/tests/password_new.phpt24
-rw-r--r--ext/oci8/tests/password_old.phpt24
-rw-r--r--ext/oci8/tests/refcur_prefetch_3.phpt20
-rw-r--r--ext/oci8/tests/reflection1.phpt8
104 files changed, 8071 insertions, 1356 deletions
diff --git a/ext/oci8/README b/ext/oci8/README
index 420d5dac58..af5beeb5c0 100644
--- a/ext/oci8/README
+++ b/ext/oci8/README
@@ -6,8 +6,8 @@ Use the OCI8 extension to access Oracle Database.
Documentation is at http://php.net/oci8
The extension can be built with PHP versions 4.3.9 to 5.x using Oracle
-9.2, 10, or 11 client libraries. Oracle's standard cross-version
-connectivity applies. For example PHP linked with Oracle 11.2 client
-libraries can connect to Oracle Database 9.2 onwards. See Oracle's
-note "Oracle Client / Server Interoperability Support" (ID 207303.1)
-for details.
+Database 9.2, 10, 11 or 12 client libraries. Oracle's standard
+cross-version connectivity applies. For example PHP linked with
+Oracle 11.2 client libraries can connect to Oracle Database 9.2
+onwards. See Oracle's note "Oracle Client / Server Interoperability
+Support" (ID 207303.1) for details.
diff --git a/ext/oci8/config.m4 b/ext/oci8/config.m4
index 39c037548a..49998d18f0 100644
--- a/ext/oci8/config.m4
+++ b/ext/oci8/config.m4
@@ -15,22 +15,6 @@ else
PHP_OCI8_TAIL1="tail -1"
fi
-AC_DEFUN([PHP_OCI_IF_DEFINED],[
- old_CPPFLAGS=$CPPFLAGS
- CPPFLAGS=$3
- AC_EGREP_CPP(yes,[
-#include <oci.h>
-#if defined($1)
- yes
-#endif
- ],[
- CPPFLAGS=$old_CPPFLAGS
- $2
- ],[
- CPPFLAGS=$old_CPPFLAGS
- ])
-])
-
AC_DEFUN([AC_OCI8_CHECK_LIB_DIR],[
AC_MSG_CHECKING([ORACLE_HOME library validity])
if test ! -d "$OCI8_DIR"; then
@@ -98,13 +82,99 @@ AC_DEFUN([AC_OCI8_ORACLE_VERSION],[
AC_MSG_RESULT($OCI8_ORACLE_VERSION)
])
+dnl
+dnl OCI8_INIT_DTRACE(providerdesc, header-file, sources)
+dnl This mimics PHP_INIT_DTRACE from PHP 5.4's acinclude.m4. It is
+dnl necessarily different from PHP_INIT_DTRACE which doesn't currently
+dnl support DTrace for extensions. Creating OCI8_INIT_DTRACE
+dnl independently instead of using a refactored PHP_INIT_DTRACE allows
+dnl OCI8 to be DTraced on versions of PHP where core PHP DTrace support
+dnl isn't available.
+dnl
+AC_DEFUN([OCI8_INIT_DTRACE],[
+ ac_srcdir=[]PHP_EXT_SRCDIR([oci8])/
+ ac_bdir=[]PHP_EXT_BUILDDIR([oci8])/
+
+dnl providerdesc
+ ac_provsrc=$1
+
+dnl header-file
+ ac_hdrobj=$2
+
+dnl DTrace objects
+ old_IFS=[$]IFS
+ for ac_src in $3; do
+ IFS=.
+ set $ac_src
+ ac_obj=[$]1
+ IFS=$old_IFS
+
+ OCI8_DTRACE_OBJS="[$]OCI8_DTRACE_OBJS [$]ac_bdir[$]ac_obj.lo"
+ done;
+
+ for ac_lo in $OCI8_DTRACE_OBJS; do
+ dtrace_oci8_objs="[$]dtrace_oci8_objs `echo $ac_lo | $SED -e 's,\.lo$,.o,' -e 's#\(.*\)\/#\1\/.libs\/#'`"
+ done;
+
+dnl Generate Makefile.objects entry
+dnl The empty $ac_provsrc command stops an implicit circular dependency
+dnl in GNU Make which causes the .d file to be overwritten (Bug 61268)
+ cat>>Makefile.objects<<EOF
+
+PHP_EXT_SRCDIR([oci8])/$ac_provsrc:;
+
+$ac_bdir[$]ac_hdrobj: $ac_srcdir[$]ac_provsrc
+ CFLAGS="\$(CFLAGS_CLEAN)" dtrace -h -C -s $ac_srcdir[$]ac_provsrc -o \$[]@.bak && \$(SED) -e 's,PHP_,DTRACE_,g' \$[]@.bak > \$[]@
+
+\$(OCI8_DTRACE_OBJS): $ac_bdir[$]ac_hdrobj
+
+EOF
+
+ case $host_alias in
+ *solaris*|*linux*)
+ dtrace_prov_name="`echo $ac_provsrc | $SED -e 's#\(.*\)\/##'`.o"
+ dtrace_lib_dir="`echo $ac_bdir[$]ac_provsrc | $SED -e 's#\(.*\)/[^/]*#\1#'`/.libs"
+ dtrace_d_obj="`echo $ac_bdir[$]ac_provsrc | $SED -e 's#\(.*\)/\([^/]*\)#\1/.libs/\2#'`.o"
+ dtrace_nolib_objs='$(OCI8_DTRACE_OBJS:.lo=.o)'
+ for ac_lo in $OCI8_DTRACE_OBJS; do
+ dtrace_oci8_lib_objs="[$]dtrace_oci8_lib_objs `echo $ac_lo | $SED -e 's,\.lo$,.o,' -e 's#\(.*\)\/#\1\/.libs\/#'`"
+ done;
+dnl Always attempt to create both PIC and non-PIC DTrace objects (Bug 63692)
+ cat>>Makefile.objects<<EOF
+$ac_bdir[$]ac_provsrc.lo: \$(OCI8_DTRACE_OBJS)
+ echo "[#] Generated by Makefile for libtool" > \$[]@
+ @test -d "$dtrace_lib_dir" || mkdir $dtrace_lib_dir
+ if CFLAGS="\$(CFLAGS_CLEAN)" dtrace -G -o $dtrace_d_obj -s $ac_srcdir[$]ac_provsrc $dtrace_oci8_lib_objs 2> /dev/null && test -f "$dtrace_d_obj"; then [\\]
+ echo "pic_object=['].libs/$dtrace_prov_name[']" >> \$[]@ [;\\]
+ else [\\]
+ echo "pic_object='none'" >> \$[]@ [;\\]
+ fi
+ if CFLAGS="\$(CFLAGS_CLEAN)" dtrace -G -o $ac_bdir[$]ac_provsrc.o -s $ac_srcdir[$]ac_provsrc $dtrace_nolib_objs 2> /dev/null && test -f "$ac_bdir[$]ac_provsrc.o"; then [\\]
+ echo "non_pic_object=[']$dtrace_prov_name[']" >> \$[]@ [;\\]
+ else [\\]
+ echo "non_pic_object='none'" >> \$[]@ [;\\]
+ fi
+
+EOF
+ ;;
+ *)
+ AC_MSG_WARN([OCI8 extension: OCI8 DTrace support is not confirmed on this platform])
+cat>>Makefile.objects<<EOF
+$ac_bdir[$]ac_provsrc.o: \$(OCI8_DTRACE_OBJS)
+ CFLAGS="\$(CFLAGS_CLEAN)" dtrace -G -o \$[]@ -s $ac_srcdir[$]ac_provsrc $dtrace_oci8_objs
+
+EOF
+ ;;
+ esac
+])
+
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 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
+[ --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])
if test "$PHP_OCI8" != "no"; then
@@ -140,12 +210,36 @@ if test "$PHP_OCI8" != "no"; then
if test "$oci8_php_version" -lt "4003009"; then
AC_MSG_ERROR([You need at least PHP 4.3.9 to be able to use this version of OCI8. PHP $php_version found])
- elif test "$oci8_php_version" -ge "6000000"; then
- AC_MSG_ERROR([This version of OCI8 is not compatible with PHP 6 or higher])
else
AC_MSG_RESULT([$php_version, ok])
fi
+ dnl Check whether --enable-dtrace was set.
+ dnl To use DTrace with a PECL install, extract the OCI8 archive, phpize it, and set
+ dnl PHP_DTRACE=yes before running configure
+ AC_MSG_CHECKING([OCI8 DTrace support])
+ oci8_do_dtrace="`echo $PHP_OCI8 | cut -d, -f3`"
+ if test "$PHP_DTRACE" = "yes" -o "$oci8_do_dtrace" = "dtrace" ; then
+ AC_MSG_RESULT([yes])
+ if test "$ext_shared" = "no"; then
+ AC_MSG_ERROR([For DTrace support OCI8 must be configured as a shared extension])
+ else
+ AC_CHECK_HEADERS([sys/sdt.h], [
+ OCI8_INIT_DTRACE([oci8_dtrace.d],[oci8_dtrace_gen.h],[oci8.c oci8_statement.c])
+
+ ], [
+ AC_MSG_ERROR(
+ [Cannot find sys/sdt.h which is required for DTrace support])
+ ])
+ PHP_SUBST(OCI8_DTRACE_OBJS)
+ AC_DEFINE(HAVE_OCI8_DTRACE,1,[Defined to 1 if PHP OCI8 DTrace support was enabled during configuration])
+ dnl Developer warning: hard coded extension is OK for the known supported environments
+ shared_objects_oci8="$shared_objects_oci8 PHP_EXT_BUILDDIR(oci8)/oci8_dtrace.d.lo"
+ fi
+ else
+ AC_MSG_RESULT([no])
+ fi
+
dnl Set some port specific directory components for use later
AC_CHECK_SIZEOF(long int, 4)
@@ -255,14 +349,14 @@ if test "$PHP_OCI8" != "no"; then
;;
*)
- AC_DEFINE(HAVE_OCI_LOB_READ2,1,[ ])
+ AC_DEFINE(HAVE_OCI_LOB_READ2,1,[Defined to 1 if OCI8 configuration located Oracle's OCILobRead2 function])
;;
esac
PHP_ADD_LIBRARY(clntsh, 1, OCI8_SHARED_LIBADD)
PHP_ADD_LIBPATH($OCI8_DIR/$OCI8_LIB_DIR, OCI8_SHARED_LIBADD)
PHP_NEW_EXTENSION(oci8, oci8.c oci8_lob.c oci8_statement.c oci8_collection.c oci8_interface.c, $ext_shared)
- AC_DEFINE(HAVE_OCI8,1,[ ])
+ AC_DEFINE(HAVE_OCI8,1,[Defined to 1 if the PHP OCI8 extension for Oracle Database is configured])
PHP_SUBST_OLD(OCI8_SHARED_LIBADD)
PHP_SUBST_OLD(OCI8_DIR)
@@ -330,11 +424,11 @@ if test "$PHP_OCI8" != "no"; then
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,[ ])
+ AC_DEFINE(HAVE_OCI_INSTANT_CLIENT,1,[Defined to 1 if OCI8 configuration located Oracle's Instant Client libraries])
+ AC_DEFINE(HAVE_OCI_LOB_READ2,1,[Defined to 1 if OCI8 configuration located Oracle's OCILobRead2 function])
PHP_NEW_EXTENSION(oci8, oci8.c oci8_lob.c oci8_statement.c oci8_collection.c oci8_interface.c, $ext_shared)
- AC_DEFINE(HAVE_OCI8,1,[ ])
+ AC_DEFINE(HAVE_OCI8,1,[Defined to 1 if the PHP OCI8 extension for Oracle Database is configured])
PHP_SUBST_OLD(OCI8_SHARED_LIBADD)
PHP_SUBST_OLD(OCI8_DIR)
diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c
index 44bfa71398..bccaa529b0 100644
--- a/ext/oci8/oci8.c
+++ b/ext/oci8/oci8.c
@@ -12,7 +12,7 @@
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
- | Authors: Stig Sæther Bakken <ssb@php.net> |
+ | Authors: Stig S�ther Bakken <ssb@php.net> |
| Thies C. Arntzen <thies@thieso.net> |
| Maxim Maletsky <maxim@maxim.cx> |
| |
@@ -37,13 +37,6 @@
#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
@@ -58,11 +51,17 @@
#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))
+#if defined(__PTRDIFF_TYPE__)
+# define OCI8_INT_TO_PTR(I) ((void*)(__PTRDIFF_TYPE__)(I))
+# define OCI8_PTR_TO_INT(P) ((int)(__PTRDIFF_TYPE__)(P))
+#elif !defined(__GNUC__)
+#define OCI8_INT_TO_PTR(I) ((void*)&((char*)0)[I])
+#define OCI8_PTR_TO_INT(P) ((int)(((char*)P)-(char*)0))
+#elif defined(HAVE_STDINT_H)
+#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_INT_TO_PTR(I) ((void*)(I))
#define OCI8_PTR_TO_INT(P) ((int)(P))
#endif
@@ -128,7 +127,7 @@ zend_class_entry *oci_coll_class_entry_ptr;
#define PHP_OCI_INIT_MODE (OCI_DEFAULT | OCI_OBJECT)
#endif
-/* static protos {{{ */
+/* {{{ static protos */
static void php_oci_connection_list_dtor (zend_rsrc_list_entry * TSRMLS_DC);
static void php_oci_pconnection_list_dtor (zend_rsrc_list_entry * TSRMLS_DC);
static void php_oci_pconnection_list_np_dtor (zend_rsrc_list_entry * TSRMLS_DC);
@@ -425,6 +424,10 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_parse, 0, 0, 2)
ZEND_ARG_INFO(0, sql_text)
ZEND_END_ARG_INFO()
+ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_get_implicit_resultset, 0, 0, 1)
+ZEND_ARG_INFO(0, statement_resource)
+ZEND_END_ARG_INFO()
+
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_set_prefetch, 0, 0, 2)
ZEND_ARG_INFO(0, statement_resource)
ZEND_ARG_INFO(0, number_of_rows)
@@ -698,6 +701,7 @@ static unsigned char arginfo_oci_bind_array_by_name[] = { 3, BYREF_NONE, BYREF_N
#define arginfo_oci_error NULL
#define arginfo_oci_num_fields NULL
#define arginfo_oci_parse NULL
+#define arginfo_oci_get_implicit_resultset NULL
#define arginfo_oci_set_prefetch NULL
#define arginfo_oci_set_client_identifier NULL
#define arginfo_oci_set_edition NULL
@@ -786,6 +790,7 @@ PHP_FUNCTION(oci_rollback);
PHP_FUNCTION(oci_new_descriptor);
PHP_FUNCTION(oci_num_fields);
PHP_FUNCTION(oci_parse);
+PHP_FUNCTION(oci_get_implicit_resultset);
PHP_FUNCTION(oci_new_cursor);
PHP_FUNCTION(oci_result);
PHP_FUNCTION(oci_client_version);
@@ -862,6 +867,7 @@ zend_function_entry php_oci_functions[] = {
PHP_FE(oci_internal_debug, arginfo_oci_internal_debug)
PHP_FE(oci_num_fields, arginfo_oci_num_fields)
PHP_FE(oci_parse, arginfo_oci_parse)
+ PHP_FE(oci_get_implicit_resultset, arginfo_oci_get_implicit_resultset)
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)
@@ -1055,8 +1061,12 @@ PHP_INI_BEGIN()
STD_PHP_INI_ENTRY( "oci8.statement_cache_size", "20", PHP_INI_SYSTEM, ONUPDATELONGFUNC, statement_cache_size, zend_oci_globals, oci_globals)
STD_PHP_INI_ENTRY( "oci8.default_prefetch", "100", PHP_INI_SYSTEM, ONUPDATELONGFUNC, default_prefetch, zend_oci_globals, oci_globals)
STD_PHP_INI_BOOLEAN("oci8.old_oci_close_semantics", "0", PHP_INI_SYSTEM, OnUpdateBool, old_oci_close_semantics,zend_oci_globals, oci_globals)
+#if (OCI_MAJOR_VERSION >= 11)
STD_PHP_INI_ENTRY( "oci8.connection_class", "", PHP_INI_ALL, OnUpdateString, connection_class, zend_oci_globals, oci_globals)
+#endif
+#if ((OCI_MAJOR_VERSION > 10) || ((OCI_MAJOR_VERSION == 10) && (OCI_MINOR_VERSION >= 2)))
STD_PHP_INI_BOOLEAN("oci8.events", "0", PHP_INI_SYSTEM, OnUpdateBool, events, zend_oci_globals, oci_globals)
+#endif
PHP_INI_END()
/* }}} */
@@ -1132,7 +1142,8 @@ static void php_oci_init_global_handles(TSRMLS_D)
}
}
}
-} /* }}} */
+}
+/* }}} */
/* {{{ php_oci_cleanup_global_handles()
*
@@ -1149,7 +1160,8 @@ static void php_oci_cleanup_global_handles(TSRMLS_D)
PHP_OCI_CALL(OCIHandleFree, ((dvoid *) OCI_G(env), OCI_HTYPE_ENV));
OCI_G(env) = NULL;
}
-} /* }}} */
+}
+/* }}} */
/* {{{ PHP_GINIT_FUNCTION
*
@@ -1294,7 +1306,6 @@ PHP_MINIT_FUNCTION(oci)
PHP_RINIT_FUNCTION(oci)
{
- OCI_G(debug_mode) = 0; /* start "fresh" */
OCI_G(num_links) = OCI_G(num_persistent);
OCI_G(errcode) = 0;
OCI_G(edition) = NULL;
@@ -1336,22 +1347,26 @@ PHP_RSHUTDOWN_FUNCTION(oci)
PHP_MINFO_FUNCTION(oci)
{
char buf[32];
+#if ((OCI_MAJOR_VERSION > 10) || ((OCI_MAJOR_VERSION == 10) && (OCI_MINOR_VERSION >= 2)))
char *ver;
+#endif
php_info_print_table_start();
php_info_print_table_row(2, "OCI8 Support", "enabled");
- php_info_print_table_row(2, "Version", PHP_OCI8_VERSION);
+#if defined(HAVE_OCI8_DTRACE)
+ php_info_print_table_row(2, "OCI8 DTrace Support", "enabled");
+#else
+ php_info_print_table_row(2, "OCI8 DTrace Support", "disabled");
+#endif
+ php_info_print_table_row(2, "OCI8 Version", PHP_OCI8_VERSION);
php_info_print_table_row(2, "Revision", "$Id$");
- 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);
+#else
+ php_info_print_table_row(2, "Oracle Run-time Client Library Version", "Unknown");
#endif
#if defined(OCI_MAJOR_VERSION) && defined(OCI_MINOR_VERSION)
snprintf(buf, sizeof(buf), "%d.%d", OCI_MAJOR_VERSION, OCI_MINOR_VERSION);
@@ -1361,9 +1376,9 @@ PHP_MINFO_FUNCTION(oci)
snprintf(buf, sizeof(buf), "Unknown");
#endif
#if defined(HAVE_OCI_INSTANT_CLIENT)
- php_info_print_table_row(2, "Oracle Instant Client Version", buf);
+ php_info_print_table_row(2, "Oracle Compile-time Instant Client Version", buf);
#else
- php_info_print_table_row(2, "Oracle Version", buf);
+ php_info_print_table_row(2, "Oracle Compile-time Version", buf);
#endif
#if !defined(PHP_WIN32) && !defined(HAVE_OCI_INSTANT_CLIENT)
@@ -1375,14 +1390,22 @@ PHP_MINFO_FUNCTION(oci)
#endif
#endif
- php_info_print_table_row(2, "Temporary Lob support", "enabled");
- php_info_print_table_row(2, "Collections support", "enabled");
+
php_info_print_table_end();
+
DISPLAY_INI_ENTRIES();
+
+ php_info_print_table_start();
+ php_info_print_table_header(2, "Statistics", "");
+ 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);
+ php_info_print_table_end();
}
/* }}} */
-/* list destructors {{{ */
+/* {{{ list destructors */
/* {{{ php_oci_connection_list_dtor()
*
@@ -1396,7 +1419,8 @@ static void php_oci_connection_list_dtor(zend_rsrc_list_entry *entry TSRMLS_DC)
php_oci_connection_close(connection TSRMLS_CC);
OCI_G(num_links)--;
}
-} /* }}} */
+}
+/* }}} */
/* {{{ php_oci_pconnection_list_dtor()
*
@@ -1411,7 +1435,8 @@ static void php_oci_pconnection_list_dtor(zend_rsrc_list_entry *entry TSRMLS_DC)
OCI_G(num_persistent)--;
OCI_G(num_links)--;
}
-} /* }}} */
+}
+/* }}} */
/* {{{ php_oci_pconnection_list_np_dtor()
*
@@ -1449,11 +1474,12 @@ static void php_oci_pconnection_list_np_dtor(zend_rsrc_list_entry *entry TSRMLS_
OCI_G(num_persistent)--;
}
- if (OCI_G(debug_mode)) {
- php_printf ("OCI8 DEBUG L1: np_dtor cleaning up: (%p) at (%s:%d) \n", connection, __FILE__, __LINE__);
+#ifdef HAVE_OCI8_DTRACE
+ if (DTRACE_OCI8_CONNECT_P_DTOR_CLOSE_ENABLED()) {
+ DTRACE_OCI8_CONNECT_P_DTOR_CLOSE(connection);
}
- }
- else {
+#endif /* HAVE_OCI8_DTRACE */
+ } else {
/*
* Release the connection to underlying pool. We do this unconditionally so that
* out-of-scope pconnects are now consistent with oci_close and out-of-scope new connect
@@ -1465,11 +1491,14 @@ static void php_oci_pconnection_list_np_dtor(zend_rsrc_list_entry *entry TSRMLS_
*/
php_oci_connection_release(connection TSRMLS_CC);
- if (OCI_G(debug_mode)) {
- php_printf ("OCI8 DEBUG L1: np_dtor releasing: (%p) at (%s:%d) \n", connection, __FILE__, __LINE__);
+#ifdef HAVE_OCI8_DTRACE
+ if (DTRACE_OCI8_CONNECT_P_DTOR_RELEASE_ENABLED()) {
+ DTRACE_OCI8_CONNECT_P_DTOR_RELEASE(connection);
}
+#endif /* HAVE_OCI8_DTRACE */
}
-} /* }}} */
+}
+/* }}} */
/* {{{ php_oci_statement_list_dtor()
*
@@ -1479,7 +1508,8 @@ static void php_oci_statement_list_dtor(zend_rsrc_list_entry *entry TSRMLS_DC)
{
php_oci_statement *statement = (php_oci_statement *)entry->ptr;
php_oci_statement_free(statement TSRMLS_CC);
-} /* }}} */
+}
+/* }}} */
/* {{{ php_oci_descriptor_list_dtor()
*
@@ -1489,7 +1519,8 @@ static void php_oci_descriptor_list_dtor(zend_rsrc_list_entry *entry TSRMLS_DC)
{
php_oci_descriptor *descriptor = (php_oci_descriptor *)entry->ptr;
php_oci_lob_free(descriptor TSRMLS_CC);
-} /* }}} */
+}
+/* }}} */
/* {{{ php_oci_collection_list_dtor()
*
@@ -1499,11 +1530,12 @@ static void php_oci_collection_list_dtor(zend_rsrc_list_entry *entry TSRMLS_DC)
{
php_oci_collection *collection = (php_oci_collection *)entry->ptr;
php_oci_collection_close(collection TSRMLS_CC);
-} /* }}} */
+}
+/* }}} */
/* }}} */
-/* Hash Destructors {{{ */
+/* {{{ Hash Destructors */
/* {{{ php_oci_define_hash_dtor()
*
@@ -1605,18 +1637,17 @@ void php_oci_connection_descriptors_free(php_oci_connection *connection TSRMLS_D
}
/* }}} */
-
/* {{{ php_oci_error()
*
* Fetch & print out error message if we get an error
* Returns an Oracle error number
*/
-sb4 php_oci_error(OCIError *err_p, sword status TSRMLS_DC)
+sb4 php_oci_error(OCIError *err_p, sword errstatus TSRMLS_DC)
{
text *errbuf = (text *)NULL;
- sb4 errcode = 0;
+ sb4 errcode = 0; /* Oracle error number */
- switch (status) {
+ switch (errstatus) {
case OCI_SUCCESS:
break;
case OCI_SUCCESS_WITH_INFO:
@@ -1659,9 +1690,16 @@ sb4 php_oci_error(OCIError *err_p, sword status TSRMLS_DC)
php_error_docref(NULL TSRMLS_CC, E_WARNING, "OCI_CONTINUE");
break;
default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown OCI error code: %d", status);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown OCI error code: %d", errstatus);
break;
}
+
+#ifdef HAVE_OCI8_DTRACE
+ if (DTRACE_OCI8_ERROR_ENABLED()) {
+ DTRACE_OCI8_ERROR((int)errstatus, (long)errcode);
+ }
+#endif /* HAVE_OCI8_DTRACE */
+
return errcode;
}
/* }}} */
@@ -1690,7 +1728,8 @@ sb4 php_oci_fetch_errmsg(OCIError *error_handle, text **error_buf TSRMLS_DC)
}
}
return error_code;
-} /* }}} */
+}
+/* }}} */
/* {{{ php_oci_fetch_sqltext_offset()
*
@@ -1718,7 +1757,8 @@ int php_oci_fetch_sqltext_offset(php_oci_statement *statement, text **sqltext, u
return 1;
}
return 0;
-} /* }}} */
+}
+/* }}} */
/* {{{ php_oci_do_connect()
*
@@ -1738,18 +1778,32 @@ void php_oci_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent, int exclus
return;
}
+#ifdef HAVE_OCI8_DTRACE
+ if (DTRACE_OCI8_CONNECT_ENTRY_ENABLED()) {
+ DTRACE_OCI8_CONNECT_ENTRY(username, dbname, charset, session_mode, persistent, exclusive);
+ }
+#endif /* HAVE_OCI8_DTRACE */
+
if (!charset_len) {
charset = NULL;
}
connection = php_oci_do_connect_ex(username, username_len, password, password_len, NULL, 0, dbname, dbname_len, charset, session_mode, persistent, exclusive TSRMLS_CC);
+#ifdef HAVE_OCI8_DTRACE
+ if (DTRACE_OCI8_CONNECT_RETURN_ENABLED()) {
+ DTRACE_OCI8_CONNECT_RETURN(connection);
+ }
+#endif /* HAVE_OCI8_DTRACE */
+
+
if (!connection) {
RETURN_FALSE;
}
- RETURN_RESOURCE(connection->rsrc_id);
+ RETURN_RESOURCE(connection->id);
-} /* }}} */
+}
+/* }}} */
/* {{{ php_oci_do_connect_ex()
*
@@ -1908,16 +1962,11 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char
}
}
- /* Debug statements {{{ */
- if (OCI_G(debug_mode)) {
- if (connection && connection->is_stub) {
- php_printf ("OCI8 DEBUG L1: Got a cached stub: (%p) at (%s:%d) \n", connection, __FILE__, __LINE__);
- } else if (connection) {
- php_printf ("OCI8 DEBUG L1: Got a cached connection: (%p) at (%s:%d) \n", connection, __FILE__, __LINE__);
- } else {
- php_printf ("OCI8 DEBUG L1: Got NO cached connection at (%s:%d) \n", __FILE__, __LINE__);
- }
- } /* }}} */
+#ifdef HAVE_OCI8_DTRACE
+ if (DTRACE_OCI8_CONNECT_LOOKUP_ENABLED()) {
+ DTRACE_OCI8_CONNECT_LOOKUP(connection, connection && connection->is_stub ? 1 : 0);
+ }
+#endif /* HAVE_OCI8_DTRACE */
/* If we got a pconnection stub, then 'load'(OCISessionGet) the real connection from its
* private spool A connection is a stub if it is only a cached structure and the real
@@ -1963,24 +2012,20 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char
/* okay, the connection is open and the server is still alive */
connection->used_this_request = 1;
- tmp = (php_oci_connection *)zend_list_find(connection->rsrc_id, &rsrc_type);
+ tmp = (php_oci_connection *)zend_list_find(connection->id, &rsrc_type);
if (tmp != NULL && rsrc_type == le_pconnection && strlen(tmp->hash_key) == hashed_details.len &&
- memcmp(tmp->hash_key, hashed_details.c, hashed_details.len) == 0 && zend_list_addref(connection->rsrc_id) == SUCCESS) {
+ memcmp(tmp->hash_key, hashed_details.c, hashed_details.len) == 0 && zend_list_addref(connection->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
+ PHP_OCI_REGISTER_RESOURCE(connection, le_pconnection);
/* 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
* decremented in the persistent helper
*/
if (OCI_G(old_oci_close_semantics)) {
- zend_list_addref(connection->rsrc_id);
+ zend_list_addref(connection->id);
}
}
smart_str_free_ex(&hashed_details, 0);
@@ -1991,7 +2036,7 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char
} else {
/* we do not ping non-persistent connections */
smart_str_free_ex(&hashed_details, 0);
- zend_list_addref(connection->rsrc_id);
+ zend_list_addref(connection->id);
return connection;
}
} /* is_open is true? */
@@ -2008,7 +2053,7 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char
/* We have to do a hash_del but need to preserve the resource if there is a positive
* refcount. Set the data pointer in the list entry to NULL
*/
- if (connection == zend_list_find(connection->rsrc_id, &rsrc_type) && rsrc_type == le_pconnection) {
+ if (connection == zend_list_find(connection->id, &rsrc_type) && rsrc_type == le_pconnection) {
le->ptr = NULL;
}
@@ -2085,7 +2130,8 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char
smart_str_free_ex(&hashed_details, 0);
return NULL;
}
- } /* }}} */
+ }
+ /* }}} */
connection->idle_expiry = (OCI_G(persistent_timeout) > 0) ? (timestamp + OCI_G(persistent_timeout)) : 0;
@@ -2124,50 +2170,34 @@ 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
+ PHP_OCI_REGISTER_RESOURCE(connection, le_pconnection);
/* 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 decremented in the persistent helper
*/
if (OCI_G(old_oci_close_semantics)) {
- zend_list_addref(connection->rsrc_id);
+ zend_list_addref(connection->id);
}
zend_hash_update(&EG(persistent_list), connection->hash_key, strlen(connection->hash_key)+1, (void *)&new_le, sizeof(zend_rsrc_list_entry), NULL);
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);
-#endif
- new_le.ptr = OCI8_INT_TO_PTR(connection->rsrc_id);
+ PHP_OCI_REGISTER_RESOURCE(connection, le_connection);
+ new_le.ptr = OCI8_INT_TO_PTR(connection->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
+ PHP_OCI_REGISTER_RESOURCE(connection, le_connection);
OCI_G(num_links)++;
}
- /* Debug statements {{{ */
- if (OCI_G(debug_mode)) {
- if (connection->is_persistent) {
- php_printf ("OCI8 DEBUG L1: New Persistent Connection address: (%p) at (%s:%d) \n", connection, __FILE__, __LINE__);
- } else {
- php_printf ("OCI8 DEBUG L1: New Non-Persistent Connection address: (%p) at (%s:%d) \n", connection, __FILE__, __LINE__);
- }
- php_printf ("OCI8 DEBUG L1: num_persistent=(%ld), num_links=(%ld) at (%s:%d) \n", OCI_G(num_persistent), OCI_G(num_links), __FILE__, __LINE__);
- } /* }}} */
+#ifdef HAVE_OCI8_DTRACE
+ if (DTRACE_OCI8_CONNECT_TYPE_ENABLED()) {
+ DTRACE_OCI8_CONNECT_TYPE(connection->is_persistent ? 1 : 0, exclusive ? 1 : 0, connection, OCI_G(num_persistent), OCI_G(num_links));
+ }
+#endif /* HAVE_OCI8_DTRACE */
return connection;
}
@@ -2179,20 +2209,24 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char
*/
static int php_oci_connection_ping(php_oci_connection *connection TSRMLS_DC)
{
+ sword errstatus;
+
+ OCI_G(errcode) = 0; /* assume ping is successful */
+
/* Use OCIPing instead of OCIServerVersion. If OCIPing returns ORA-1010 (invalid OCI operation)
* such as from Pre-10.1 servers, the error is still from the server and we would have
* successfully performed a roundtrip and validated the connection. Use OCIServerVersion for
* Pre-10.2 clients
*/
#if ((OCI_MAJOR_VERSION > 10) || ((OCI_MAJOR_VERSION == 10) && (OCI_MINOR_VERSION >= 2))) /* OCIPing available 10.2 onwards */
- PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIPing, (connection->svc, OCI_G(err), OCI_DEFAULT));
+ PHP_OCI_CALL_RETURN(errstatus, OCIPing, (connection->svc, OCI_G(err), OCI_DEFAULT));
#else
char version[256];
/* use good old OCIServerVersion() */
- PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIServerVersion, (connection->svc, OCI_G(err), (text *)version, sizeof(version), OCI_HTYPE_SVCCTX));
+ PHP_OCI_CALL_RETURN(errstatus, OCIServerVersion, (connection->svc, OCI_G(err), (text *)version, sizeof(version), OCI_HTYPE_SVCCTX));
#endif
- if (OCI_G(errcode) == OCI_SUCCESS) {
+ if (errstatus == OCI_SUCCESS) {
return 1;
} else {
sb4 error_code = 0;
@@ -2203,10 +2237,9 @@ static int php_oci_connection_ping(php_oci_connection *connection TSRMLS_DC)
if (error_code == 1010) {
return 1;
}
+ OCI_G(errcode) = error_code;
}
- /* ignore errors here, just return failure
- * php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); */
return 0;
}
/* }}} */
@@ -2217,17 +2250,17 @@ static int php_oci_connection_ping(php_oci_connection *connection TSRMLS_DC)
*/
static int php_oci_connection_status(php_oci_connection *connection TSRMLS_DC)
{
- ub4 ss = 0;
+ ub4 ss = OCI_SERVER_NOT_CONNECTED;
+ sword errstatus;
/* get OCI_ATTR_SERVER_STATUS */
- PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrGet, ((dvoid *)connection->server, OCI_HTYPE_SERVER, (dvoid *)&ss, (ub4 *)0, OCI_ATTR_SERVER_STATUS, OCI_G(err)));
+ PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)connection->server, OCI_HTYPE_SERVER, (dvoid *)&ss, (ub4 *)0, OCI_ATTR_SERVER_STATUS, OCI_G(err)));
- if (OCI_G(errcode) == OCI_SUCCESS && ss == OCI_SERVER_NORMAL) {
+ if (errstatus == OCI_SUCCESS && ss == OCI_SERVER_NORMAL) {
return 1;
}
- /* ignore errors here, just return failure
- * php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); */
+ /* ignore errors here, just return failure */
return 0;
}
/* }}} */
@@ -2238,16 +2271,20 @@ static int php_oci_connection_status(php_oci_connection *connection TSRMLS_DC)
*/
int php_oci_connection_rollback(php_oci_connection *connection TSRMLS_DC)
{
- PHP_OCI_CALL_RETURN(connection->errcode, OCITransRollback, (connection->svc, connection->err, (ub4) 0));
- connection->needs_commit = 0;
+ sword errstatus;
+
+ PHP_OCI_CALL_RETURN(errstatus, OCITransRollback, (connection->svc, connection->err, (ub4) 0));
+ connection->rb_on_disconnect = 0;
- if (connection->errcode != OCI_SUCCESS) {
- connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
+ connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
return 0;
-} /* }}} */
+}
+/* }}} */
/* {{{ php_oci_connection_commit()
*
@@ -2255,16 +2292,20 @@ int php_oci_connection_rollback(php_oci_connection *connection TSRMLS_DC)
*/
int php_oci_connection_commit(php_oci_connection *connection TSRMLS_DC)
{
- PHP_OCI_CALL_RETURN(connection->errcode, OCITransCommit, (connection->svc, connection->err, (ub4) 0));
- connection->needs_commit = 0;
+ sword errstatus;
+
+ PHP_OCI_CALL_RETURN(errstatus, OCITransCommit, (connection->svc, connection->err, (ub4) 0));
+ connection->rb_on_disconnect = 0;
- if (connection->errcode != OCI_SUCCESS) {
- connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
+ connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
return 0;
-} /* }}} */
+}
+/* }}} */
/* {{{ php_oci_connection_close()
*
@@ -2275,13 +2316,19 @@ static int php_oci_connection_close(php_oci_connection *connection TSRMLS_DC)
int result = 0;
zend_bool in_call_save = OCI_G(in_call);
+#ifdef HAVE_OCI8_DTRACE
+ if (DTRACE_OCI8_CONNECTION_CLOSE_ENABLED()) {
+ DTRACE_OCI8_CONNECTION_CLOSE(connection);
+ }
+#endif /* HAVE_OCI8_DTRACE */
+
if (!connection->is_stub) {
/* Release resources associated with connection */
php_oci_connection_release(connection TSRMLS_CC);
}
if (!connection->using_spool && connection->svc) {
- PHP_OCI_CALL(OCISessionEnd, (connection->svc, connection->err, connection->session, (ub4) 0));
+ PHP_OCI_CALL(OCISessionEnd, (connection->svc, connection->err, connection->session, (ub4) 0));
}
if (connection->err) {
@@ -2302,7 +2349,7 @@ static int php_oci_connection_close(php_oci_connection *connection TSRMLS_DC)
}
if (connection->svc) {
- PHP_OCI_CALL(OCIHandleFree, ((dvoid *) connection->svc, (ub4) OCI_HTYPE_SVCCTX));
+ PHP_OCI_CALL(OCIHandleFree, ((dvoid *) connection->svc, (ub4) OCI_HTYPE_SVCCTX));
}
if (connection->server) {
@@ -2333,7 +2380,8 @@ static int php_oci_connection_close(php_oci_connection *connection TSRMLS_DC)
connection = NULL;
OCI_G(in_call) = in_call_save;
return result;
-} /* }}} */
+}
+/* }}} */
/* {{{ php_oci_connection_release()
*
@@ -2357,7 +2405,7 @@ int php_oci_connection_release(php_oci_connection *connection TSRMLS_DC)
if (connection->svc) {
/* rollback outstanding transactions */
- if (connection->needs_commit) {
+ if (connection->rb_on_disconnect) {
if (php_oci_connection_rollback(connection TSRMLS_CC)) {
/* rollback failed */
result = 1;
@@ -2408,7 +2456,7 @@ int php_oci_connection_release(php_oci_connection *connection TSRMLS_DC)
connection->server = NULL;
connection->session = NULL;
- connection->is_attached = connection->is_open = connection->needs_commit = connection->used_this_request = 0;
+ connection->is_attached = connection->is_open = connection->rb_on_disconnect = connection->used_this_request = 0;
connection->is_stub = 1;
/* Cut the link between the connection structure and the time_t structure allocated within
@@ -2419,7 +2467,8 @@ int php_oci_connection_release(php_oci_connection *connection TSRMLS_DC)
OCI_G(in_call) = in_call_save;
return result;
-} /* }}} */
+}
+/* }}} */
/* {{{ php_oci_password_change()
*
@@ -2427,17 +2476,20 @@ int php_oci_connection_release(php_oci_connection *connection TSRMLS_DC)
*/
int php_oci_password_change(php_oci_connection *connection, char *user, int user_len, char *pass_old, int pass_old_len, char *pass_new, int pass_new_len TSRMLS_DC)
{
- PHP_OCI_CALL_RETURN(connection->errcode, OCIPasswordChange, (connection->svc, connection->err, (text *)user, user_len, (text *)pass_old, pass_old_len, (text *)pass_new, pass_new_len, OCI_DEFAULT));
+ sword errstatus;
+
+ PHP_OCI_CALL_RETURN(errstatus, OCIPasswordChange, (connection->svc, connection->err, (text *)user, user_len, (text *)pass_old, pass_old_len, (text *)pass_new, pass_new_len, OCI_DEFAULT));
- if (connection->errcode != OCI_SUCCESS) {
- connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
+ connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
connection->passwd_changed = 1;
return 0;
-} /* }}} */
-
+}
+/* }}} */
/* {{{ php_oci_client_get_version()
*
@@ -2446,21 +2498,21 @@ int php_oci_password_change(php_oci_connection *connection, char *user, int user
void php_oci_client_get_version(char **version TSRMLS_DC)
{
char version_buff[256];
+#if ((OCI_MAJOR_VERSION > 10) || ((OCI_MAJOR_VERSION == 10) && (OCI_MINOR_VERSION >= 2))) /* OCIClientVersion only available 10.2 onwards */
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()
*
@@ -2468,19 +2520,21 @@ void php_oci_client_get_version(char **version TSRMLS_DC)
*/
int php_oci_server_get_version(php_oci_connection *connection, char **version TSRMLS_DC)
{
+ sword errstatus;
char version_buff[256];
- PHP_OCI_CALL_RETURN(connection->errcode, OCIServerVersion, (connection->svc, connection->err, (text *)version_buff, sizeof(version_buff), OCI_HTYPE_SVCCTX));
+ PHP_OCI_CALL_RETURN(errstatus, OCIServerVersion, (connection->svc, connection->err, (text *)version_buff, sizeof(version_buff), OCI_HTYPE_SVCCTX));
- if (connection->errcode != OCI_SUCCESS) {
- connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
*version = estrdup(version_buff);
return 0;
-} /* }}} */
+}
+/* }}} */
/* {{{ php_oci_column_to_zval()
*
@@ -2564,14 +2618,19 @@ int php_oci_column_to_zval(php_oci_out_column *column, zval *value, int mode TSR
}
/* }}} */
+
/* {{{ php_oci_fetch_row()
*
* Fetch the next row from the given statement
+ * Has logic for Oracle 12c Implicit Result Sets
*/
void php_oci_fetch_row (INTERNAL_FUNCTION_PARAMETERS, int mode, int expected_args)
{
zval *z_statement, *array;
- php_oci_statement *statement;
+ php_oci_statement *statement; /* statement that will be fetched from */
+#if (OCI_MAJOR_VERSION >= 12)
+ php_oci_statement *invokedstatement; /* statement this function was invoked with */
+#endif /* OCI_MAJOR_VERSION */
php_oci_out_column *column;
ub4 nrows = 1;
int i;
@@ -2617,11 +2676,63 @@ void php_oci_fetch_row (INTERNAL_FUNCTION_PARAMETERS, int mode, int expected_arg
}
}
+#if (OCI_MAJOR_VERSION < 12)
PHP_OCI_ZVAL_TO_STATEMENT(z_statement, statement);
if (php_oci_statement_fetch(statement, nrows TSRMLS_CC)) {
- RETURN_FALSE;
+ RETURN_FALSE; /* end of fetch */
}
+#else /* OCI_MAJOR_VERSION */
+ PHP_OCI_ZVAL_TO_STATEMENT(z_statement, invokedstatement);
+
+ if (invokedstatement->impres_flag == PHP_OCI_IMPRES_NO_CHILDREN) {
+ /* Already know there are no Implicit Result Sets */
+ statement = invokedstatement;
+ } else if (invokedstatement->impres_flag == PHP_OCI_IMPRES_HAS_CHILDREN) {
+ /* Previously saw an Implicit Result Set in an earlier invocation of php_oci_fetch_row */
+ statement = (php_oci_statement *)invokedstatement->impres_child_stmt;
+ } else {
+ sword errstatus;
+
+ /* Check for an Implicit Result Set on this statement handle */
+ PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)invokedstatement->stmt, OCI_HTYPE_STMT,
+ (dvoid *) &invokedstatement->impres_count,
+ (ub4 *)NULL, OCI_ATTR_IMPLICIT_RESULT_COUNT, invokedstatement->err));
+ if (errstatus) {
+ RETURN_FALSE;
+ }
+ if (invokedstatement->impres_count > 0) {
+ /* Make it so the fetch occurs on the first Implicit Result Set */
+ statement = php_oci_get_implicit_resultset(invokedstatement TSRMLS_CC);
+ if (!statement || php_oci_statement_execute(statement, (ub4)OCI_DEFAULT TSRMLS_CC))
+ RETURN_FALSE;
+ invokedstatement->impres_count--;
+ invokedstatement->impres_child_stmt = (struct php_oci_statement *)statement;
+ invokedstatement->impres_flag = PHP_OCI_IMPRES_HAS_CHILDREN;
+ } else {
+ statement = invokedstatement; /* didn't find Implicit Result Sets */
+ invokedstatement->impres_flag = PHP_OCI_IMPRES_NO_CHILDREN; /* Don't bother checking again */
+ }
+ }
+
+ if (php_oci_statement_fetch(statement, nrows TSRMLS_CC)) {
+ /* End of fetch */
+ if (invokedstatement->impres_count > 0) {
+ /* Check next Implicit Result Set */
+ statement = php_oci_get_implicit_resultset(invokedstatement TSRMLS_CC);
+ if (!statement || php_oci_statement_execute(statement, (ub4)OCI_DEFAULT TSRMLS_CC))
+ RETURN_FALSE;
+ invokedstatement->impres_count--;
+ invokedstatement->impres_child_stmt = (struct php_oci_statement *)statement;
+ if (php_oci_statement_fetch(statement, nrows TSRMLS_CC)) {
+ /* End of all fetches */
+ RETURN_FALSE;
+ }
+ } else {
+ RETURN_FALSE;
+ }
+ }
+#endif /* OCI_MAJOR_VERSION */
array_init(return_value);
@@ -2688,9 +2799,11 @@ static int php_oci_persistent_helper(zend_rsrc_list_entry *le TSRMLS_DC)
connection = (php_oci_connection *)le->ptr;
if (!connection->used_this_request && OCI_G(persistent_timeout) != -1) {
- if (OCI_G(debug_mode)) {
- php_printf ("OCI8 DEBUG L1: persistent_helper processing for timeout: (%p stub=%d) at (%s:%d) \n", connection, connection->is_stub, __FILE__, __LINE__);
+#ifdef HAVE_OCI8_DTRACE
+ if (DTRACE_OCI8_CONNECT_EXPIRY_ENABLED()) {
+ DTRACE_OCI8_CONNECT_EXPIRY(connection, connection->is_stub ? 1 : 0, (long)connection->idle_expiry, (long)timestamp);
}
+#endif /* HAVE_OCI8_DTRACE */
if (connection->idle_expiry < timestamp) {
/* connection has timed out */
return ZEND_HASH_APPLY_REMOVE;
@@ -2698,7 +2811,8 @@ static int php_oci_persistent_helper(zend_rsrc_list_entry *le TSRMLS_DC)
}
}
return ZEND_HASH_APPLY_KEEP;
-} /* }}} */
+}
+/* }}} */
/* {{{ php_oci_create_spool()
*
@@ -2710,6 +2824,7 @@ static php_oci_spool *php_oci_create_spool(char *username, int username_len, cha
zend_bool iserror = 0;
ub4 poolmode = OCI_DEFAULT; /* Mode to be passed to OCISessionPoolCreate */
OCIAuthInfo *spoolAuth = NULL;
+ sword errstatus;
/* Allocate sessionpool out of persistent memory */
session_pool = (php_oci_spool *) calloc(1, sizeof(php_oci_spool));
@@ -2734,10 +2849,10 @@ static php_oci_spool *php_oci_create_spool(char *username, int username_len, cha
}
/* Allocate the pool handle */
- PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIHandleAlloc, (session_pool->env, (dvoid **) &session_pool->poolh, OCI_HTYPE_SPOOL, (size_t) 0, (dvoid **) 0));
+ PHP_OCI_CALL_RETURN(errstatus, OCIHandleAlloc, (session_pool->env, (dvoid **) &session_pool->poolh, OCI_HTYPE_SPOOL, (size_t) 0, (dvoid **) 0));
- if (OCI_G(errcode) != OCI_SUCCESS) {
- php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ OCI_G(errcode) = php_oci_error(OCI_G(err), errstatus TSRMLS_CC);
iserror = 1;
goto exit_create_spool;
}
@@ -2746,10 +2861,10 @@ static php_oci_spool *php_oci_create_spool(char *username, int username_len, cha
* generic bug which can free up the OCI_G(err) variable before destroying connections. We
* cannot use this for other roundtrip calls as there is no way the user can access this error
*/
- PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIHandleAlloc, ((dvoid *) session_pool->env, (dvoid **)&(session_pool->err), (ub4) OCI_HTYPE_ERROR,(size_t) 0, (dvoid **) 0));
+ PHP_OCI_CALL_RETURN(errstatus, OCIHandleAlloc, ((dvoid *) session_pool->env, (dvoid **)&(session_pool->err), (ub4) OCI_HTYPE_ERROR,(size_t) 0, (dvoid **) 0));
- if (OCI_G(errcode) != OCI_SUCCESS) {
- php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ OCI_G(errcode) = php_oci_error(OCI_G(err), errstatus TSRMLS_CC);
iserror = 1;
goto exit_create_spool;
}
@@ -2762,52 +2877,56 @@ static php_oci_spool *php_oci_create_spool(char *username, int username_len, cha
#endif
#if ((OCI_MAJOR_VERSION > 11) || ((OCI_MAJOR_VERSION == 11) && (OCI_MINOR_VERSION >= 2)))
- /* Allocate auth handle for session pool {{{ */
- PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIHandleAlloc, (session_pool->env, (dvoid **)&(spoolAuth), OCI_HTYPE_AUTHINFO, 0, NULL));
+ /* {{{ Allocate auth handle for session pool */
+ PHP_OCI_CALL_RETURN(errstatus, OCIHandleAlloc, (session_pool->env, (dvoid **)&(spoolAuth), OCI_HTYPE_AUTHINFO, 0, NULL));
- if (OCI_G(errcode) != OCI_SUCCESS) {
- php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ OCI_G(errcode) = php_oci_error(OCI_G(err), errstatus TSRMLS_CC);
iserror = 1;
goto exit_create_spool;
- } /* }}} */
+ }
+ /* }}} */
- /* Set the edition attribute on the auth handle {{{ */
+ /* {{{ Set the edition attribute on the auth handle */
if (OCI_G(edition)) {
- PHP_OCI_CALL_RETURN(OCI_G(errcode),OCIAttrSet, ((dvoid *) spoolAuth, (ub4) OCI_HTYPE_AUTHINFO, (dvoid *) OCI_G(edition), (ub4)(strlen(OCI_G(edition))), (ub4)OCI_ATTR_EDITION, OCI_G(err)));
+ PHP_OCI_CALL_RETURN(errstatus, OCIAttrSet, ((dvoid *) spoolAuth, (ub4) OCI_HTYPE_AUTHINFO, (dvoid *) OCI_G(edition), (ub4)(strlen(OCI_G(edition))), (ub4)OCI_ATTR_EDITION, OCI_G(err)));
- if (OCI_G(errcode) != OCI_SUCCESS) {
- php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ OCI_G(errcode) = php_oci_error(OCI_G(err), errstatus TSRMLS_CC);
iserror = 1;
goto exit_create_spool;
}
- } /* }}} */
+ }
+ /* }}} */
- /* Set the driver name attribute on the auth handle {{{ */
- PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, ((dvoid *) spoolAuth, (ub4) OCI_HTYPE_AUTHINFO, (dvoid *) PHP_OCI8_DRIVER_NAME, (ub4) sizeof(PHP_OCI8_DRIVER_NAME)-1, (ub4) OCI_ATTR_DRIVER_NAME, OCI_G(err)));
+ /* {{{ Set the driver name attribute on the auth handle */
+ PHP_OCI_CALL_RETURN(errstatus, OCIAttrSet, ((dvoid *) spoolAuth, (ub4) OCI_HTYPE_AUTHINFO, (dvoid *) PHP_OCI8_DRIVER_NAME, (ub4) sizeof(PHP_OCI8_DRIVER_NAME)-1, (ub4) OCI_ATTR_DRIVER_NAME, OCI_G(err)));
- if (OCI_G(errcode) != OCI_SUCCESS) {
- php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ OCI_G(errcode) = php_oci_error(OCI_G(err), errstatus TSRMLS_CC);
iserror = 1;
goto exit_create_spool;
- } /* }}} */
+ }
+ /* }}} */
- /* Set the auth handle on the session pool {{{ */
- PHP_OCI_CALL_RETURN(OCI_G(errcode),OCIAttrSet, ((dvoid *) (session_pool->poolh),(ub4) OCI_HTYPE_SPOOL, (dvoid *) spoolAuth, (ub4)0, (ub4)OCI_ATTR_SPOOL_AUTH, OCI_G(err)));
+ /* {{{ Set the auth handle on the session pool */
+ PHP_OCI_CALL_RETURN(errstatus, OCIAttrSet, ((dvoid *) (session_pool->poolh),(ub4) OCI_HTYPE_SPOOL, (dvoid *) spoolAuth, (ub4)0, (ub4)OCI_ATTR_SPOOL_AUTH, OCI_G(err)));
- if (OCI_G(errcode) != OCI_SUCCESS) {
- php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ OCI_G(errcode) = php_oci_error(OCI_G(err), errstatus TSRMLS_CC);
iserror = 1;
goto exit_create_spool;
- } /* }}} */
+ }
+ /* }}} */
#endif
/* Create the homogeneous session pool - We have different session pools for every different
* username, password, charset and dbname.
*/
- PHP_OCI_CALL_RETURN(OCI_G(errcode), OCISessionPoolCreate,(session_pool->env, OCI_G(err), session_pool->poolh, (OraText **)&session_pool->poolname, &session_pool->poolname_len, (OraText *)dbname, (ub4)dbname_len, 0, UB4MAXVAL, 1,(OraText *)username, (ub4)username_len, (OraText *)password,(ub4)password_len, poolmode));
+ PHP_OCI_CALL_RETURN(errstatus, OCISessionPoolCreate,(session_pool->env, OCI_G(err), session_pool->poolh, (OraText **)&session_pool->poolname, &session_pool->poolname_len, (OraText *)dbname, (ub4)dbname_len, 0, UB4MAXVAL, 1,(OraText *)username, (ub4)username_len, (OraText *)password,(ub4)password_len, poolmode));
- if (OCI_G(errcode) != OCI_SUCCESS) {
- php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ OCI_G(errcode) = php_oci_error(OCI_G(err), errstatus TSRMLS_CC);
iserror = 1;
}
@@ -2821,12 +2940,15 @@ exit_create_spool:
PHP_OCI_CALL(OCIHandleFree, ((dvoid *) spoolAuth, (ub4) OCI_HTYPE_AUTHINFO));
}
- if (OCI_G(debug_mode)) {
- php_printf ("OCI8 DEBUG L1: create_spool: (%p) at (%s:%d) \n", session_pool, __FILE__, __LINE__);
+#ifdef HAVE_OCI8_DTRACE
+ if (DTRACE_OCI8_SESSPOOL_CREATE_ENABLED()) {
+ DTRACE_OCI8_SESSPOOL_CREATE(session_pool);
}
+#endif /* HAVE_OCI8_DTRACE */
return session_pool;
-} /* }}} */
+}
+/* }}} */
/* {{{ php_oci_get_spool()
*
@@ -2841,7 +2963,7 @@ static php_oci_spool *php_oci_get_spool(char *username, int username_len, char *
zend_rsrc_list_entry *spool_out_le = NULL;
zend_bool iserror = 0;
- /* Create the spool hash key {{{ */
+ /* {{{ Create the spool hash key */
smart_str_appendl_ex(&spool_hashed_details, "oci8spool***", sizeof("oci8spool***") - 1, 0);
smart_str_appendl_ex(&spool_hashed_details, username, username_len, 0);
smart_str_appendl_ex(&spool_hashed_details, "**", sizeof("**") - 1, 0);
@@ -2880,11 +3002,7 @@ 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
+ PHP_OCI_REGISTER_RESOURCE(session_pool, le_psessionpool);
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 &&
@@ -2902,7 +3020,8 @@ exit_get_spool:
return session_pool;
-} /* }}} */
+}
+/* }}} */
/* {{{ php_oci_create_env()
*
@@ -2933,7 +3052,8 @@ static OCIEnv *php_oci_create_env(ub2 charsetid TSRMLS_DC)
return NULL;
}
return retenv;
-}/* }}} */
+}
+/* }}} */
/* {{{ php_oci_old_create_session()
*
@@ -2944,57 +3064,58 @@ static int php_oci_old_create_session(php_oci_connection *connection, char *dbna
{
ub4 statement_cache_size = (OCI_G(statement_cache_size) > 0) ? OCI_G(statement_cache_size) : 0;
- if (OCI_G(debug_mode)) {
- php_printf ("OCI8 DEBUG: Bypassing client-side session pool for session create at (%s:%d) \n", __FILE__, __LINE__);
- }
-
/* Create the OCI environment separate for each connection */
if (!(connection->env = php_oci_create_env(connection->charset TSRMLS_CC))) {
return 1;
}
- /* Allocate our server handle {{{ */
+ /* {{{ Allocate our server handle */
PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIHandleAlloc, (connection->env, (dvoid **)&(connection->server), OCI_HTYPE_SERVER, 0, NULL));
if (OCI_G(errcode) != OCI_SUCCESS) {
php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC);
return 1;
- } /* }}} */
+ }
+ /* }}} */
- /* Attach to the server {{{ */
+ /* {{{ Attach to the server */
PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIServerAttach, (connection->server, OCI_G(err), (text *)dbname, dbname_len, (ub4) OCI_DEFAULT));
if (OCI_G(errcode) != OCI_SUCCESS) {
php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC);
return 1;
- } /* }}} */
+ }
+ /* }}} */
connection->is_attached = 1;
- /* Allocate our session handle {{{ */
+ /* {{{ Allocate our session handle */
PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIHandleAlloc, (connection->env, (dvoid **)&(connection->session), OCI_HTYPE_SESSION, 0, NULL));
if (OCI_G(errcode) != OCI_SUCCESS) {
php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC);
return 1;
- } /* }}} */
+ }
+ /* }}} */
- /* Allocate our private error-handle {{{ */
+ /* {{{ Allocate our private error-handle */
PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIHandleAlloc, (connection->env, (dvoid **)&(connection->err), OCI_HTYPE_ERROR, 0, NULL));
if (OCI_G(errcode) != OCI_SUCCESS) {
php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC);
return 1;
- } /* }}} */
+ }
+ /* }}} */
- /* Allocate our service-context {{{ */
+ /* {{{ Allocate our service-context */
PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIHandleAlloc, (connection->env, (dvoid **)&(connection->svc), OCI_HTYPE_SVCCTX, 0, NULL));
if (OCI_G(errcode) != OCI_SUCCESS) {
php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC);
return 1;
- } /* }}} */
+ }
+ /* }}} */
- /* Set the username {{{ */
+ /* {{{ Set the username */
if (username) {
PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) username, (ub4) username_len, (ub4) OCI_ATTR_USERNAME, OCI_G(err)));
@@ -3002,9 +3123,10 @@ static int php_oci_old_create_session(php_oci_connection *connection, char *dbna
php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC);
return 1;
}
- }/* }}} */
+ }
+ /* }}} */
- /* Set the password {{{ */
+ /* {{{ Set the password */
if (password) {
PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) password, (ub4) password_len, (ub4) OCI_ATTR_PASSWORD, OCI_G(err)));
@@ -3012,9 +3134,10 @@ static int php_oci_old_create_session(php_oci_connection *connection, char *dbna
php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC);
return 1;
}
- }/* }}} */
+ }
+ /* }}} */
- /* Set the edition attribute on the session handle {{{ */
+ /* {{{ Set the edition attribute on the session handle */
#if ((OCI_MAJOR_VERSION > 11) || ((OCI_MAJOR_VERSION == 11) && (OCI_MINOR_VERSION >= 2)))
if (OCI_G(edition)) {
PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) OCI_G(edition), (ub4) (strlen(OCI_G(edition))), (ub4) OCI_ATTR_EDITION, OCI_G(err)));
@@ -3024,9 +3147,10 @@ static int php_oci_old_create_session(php_oci_connection *connection, char *dbna
return 1;
}
}
-#endif /* }}} */
+#endif
+/* }}} */
- /* Set the driver name attribute on the session handle {{{ */
+ /* {{{ Set the driver name attribute on the session handle */
#if (OCI_MAJOR_VERSION >= 11)
PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) PHP_OCI8_DRIVER_NAME, (ub4) sizeof(PHP_OCI8_DRIVER_NAME)-1, (ub4) OCI_ATTR_DRIVER_NAME, OCI_G(err)));
@@ -3034,26 +3158,29 @@ static int php_oci_old_create_session(php_oci_connection *connection, char *dbna
php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC);
return 1;
}
-#endif /* }}} */
+#endif
+/* }}} */
- /* Set the server handle in the service handle {{{ */
+ /* {{{ Set the server handle in the service handle */
PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, (connection->svc, OCI_HTYPE_SVCCTX, connection->server, 0, OCI_ATTR_SERVER, OCI_G(err)));
if (OCI_G(errcode) != OCI_SUCCESS) {
php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC);
return 1;
- } /* }}} */
+ }
+ /* }}} */
- /* Set the authentication handle in the service handle {{{ */
+ /* {{{ Set the authentication handle in the service handle */
PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, (connection->svc, OCI_HTYPE_SVCCTX, connection->session, 0, OCI_ATTR_SESSION, OCI_G(err)));
if (OCI_G(errcode) != OCI_SUCCESS) {
php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC);
return 1;
- } /* }}} */
+ }
+ /* }}} */
if (new_password) {
- /* Try to change password if new one was provided {{{ */
+ /* {{{ Try to change password if new one was provided */
PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIPasswordChange, (connection->svc, OCI_G(err), (text *)username, username_len, (text *)password, password_len, (text *)new_password, new_password_len, OCI_AUTH));
if (OCI_G(errcode) != OCI_SUCCESS) {
@@ -3066,9 +3193,10 @@ static int php_oci_old_create_session(php_oci_connection *connection, char *dbna
if (OCI_G(errcode) != OCI_SUCCESS) {
php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC);
return 1;
- } /* }}} */
+ }
+ /* }}} */
} else {
- /* start the session {{{ */
+ /* {{{ start the session */
ub4 cred_type = OCI_CRED_RDBMS;
/* Extract the overloaded session_mode parameter into valid Oracle credential and session mode values */
@@ -3089,7 +3217,8 @@ static int php_oci_old_create_session(php_oci_connection *connection, char *dbna
if (OCI_G(errcode) != OCI_SUCCESS_WITH_INFO) {
return 1;
}
- } /* }}} */
+ }
+ /* }}} */
}
/* Brand new connection: Init and update the next_ping in the connection */
@@ -3107,7 +3236,8 @@ static int php_oci_old_create_session(php_oci_connection *connection, char *dbna
/* Successfully created session */
return 0;
-} /* }}} */
+}
+/* }}} */
/* {{{ php_oci_create_session()
*
@@ -3138,13 +3268,11 @@ static int php_oci_create_session(php_oci_connection *connection, php_oci_spool
connection->using_spool = 1;
}
- if (OCI_G(debug_mode)) {
- if (session_pool) {
- php_printf ("OCI8 DEBUG L1: using shared pool: (%p) at (%s:%d) \n", session_pool, __FILE__, __LINE__);
- } else {
- php_printf ("OCI8 DEBUG L1: using private pool: (%p) at (%s:%d) \n", connection->private_spool, __FILE__, __LINE__);
- }
+#ifdef HAVE_OCI8_DTRACE
+ if (DTRACE_OCI8_SESSPOOL_TYPE_ENABLED()) {
+ DTRACE_OCI8_SESSPOOL_TYPE(session_pool ? 1 : 0, session_pool ? session_pool : connection->private_spool);
}
+#endif /* HAVE_OCI8_DTRACE */
/* The passed in "connection" can be a cached stub from plist or freshly created. In the former
* case, we do not have to allocate any handles
@@ -3170,7 +3298,7 @@ static int php_oci_create_session(php_oci_connection *connection, php_oci_spool
/* Set the Connection class and purity if OCI client version >= 11g */
#if (OCI_MAJOR_VERSION > 10)
- PHP_OCI_CALL_RETURN(OCI_G(errcode),OCIAttrSet, ((dvoid *) connection->authinfo,(ub4) OCI_HTYPE_SESSION, (dvoid *) OCI_G(connection_class), (ub4)(strlen(OCI_G(connection_class))), (ub4)OCI_ATTR_CONNECTION_CLASS, OCI_G(err)));
+ PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->authinfo,(ub4) OCI_HTYPE_SESSION, (dvoid *) OCI_G(connection_class), (ub4)(strlen(OCI_G(connection_class))), (ub4)OCI_ATTR_CONNECTION_CLASS, OCI_G(err)));
if (OCI_G(errcode) != OCI_SUCCESS) {
php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC);
@@ -3189,16 +3317,20 @@ static int php_oci_create_session(php_oci_connection *connection, php_oci_spool
return 1;
}
#endif
- } /* }}} */
+ }
+ /* }}} */
- /* Debug statements {{{ */
- if (OCI_G(debug_mode)) {
+ /* {{{ Debug statements */
+#ifdef HAVE_OCI8_DTRACE
+ if (DTRACE_OCI8_SESSPOOL_STATS_ENABLED()) {
ub4 numfree = 0, numbusy = 0, numopen = 0;
PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrGet, ((dvoid *)actual_spool->poolh, OCI_HTYPE_SPOOL, (dvoid *)&numopen, (ub4 *)0, OCI_ATTR_SPOOL_OPEN_COUNT, OCI_G(err)));
PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrGet, ((dvoid *)actual_spool->poolh, OCI_HTYPE_SPOOL, (dvoid *)&numbusy, (ub4 *)0, OCI_ATTR_SPOOL_BUSY_COUNT, OCI_G(err)));
numfree = numopen - numbusy; /* number of free connections in the pool */
- php_printf ("OCI8 DEBUG L1: (numopen=%d)(numbusy=%d)(numfree=%d) at (%s:%d) \n", numopen, numbusy, numfree, __FILE__, __LINE__);
- } /* }}} */
+ DTRACE_OCI8_SESSPOOL_STATS(numfree, numbusy, numopen);
+ }
+#endif /* HAVE_OCI8_DTRACE */
+ /* }}} */
/* Ping loop: Ping and loop till we get a good connection. When a database instance goes
* down, it can leave several bad connections that need to be flushed out before getting a
@@ -3225,7 +3357,8 @@ static int php_oci_create_session(php_oci_connection *connection, php_oci_spool
/* {{{ Populate the session and server fields of the connection */
PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrGet, ((dvoid *)connection->svc, OCI_HTYPE_SVCCTX, (dvoid *)&(connection->server), (ub4 *)0, OCI_ATTR_SERVER, OCI_G(err)));
- PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrGet, ((dvoid *)connection->svc, OCI_HTYPE_SVCCTX, (dvoid *)&(connection->session), (ub4 *)0, OCI_ATTR_SESSION, OCI_G(err))); /* }}} */
+ PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrGet, ((dvoid *)connection->svc, OCI_HTYPE_SVCCTX, (dvoid *)&(connection->session), (ub4 *)0, OCI_ATTR_SESSION, OCI_G(err)));
+ /* }}} */
PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIContextGetValue, (connection->session, OCI_G(err), (ub1 *)"NEXT_PING", (ub1)sizeof("NEXT_PING"), (void **)&(connection->next_pingp)));
if (OCI_G(errcode) != OCI_SUCCESS) {
@@ -3265,7 +3398,8 @@ static int php_oci_create_session(php_oci_connection *connection, php_oci_spool
connection->is_attached = connection->is_open = 1;
return 0;
-} /* }}} */
+}
+/* }}} */
/* {{{ php_oci_spool_list_dtor()
*
@@ -3280,7 +3414,8 @@ static void php_oci_spool_list_dtor(zend_rsrc_list_entry *entry TSRMLS_DC)
}
return;
-} /* }}} */
+}
+/* }}} */
/* {{{ php_oci_spool_close()
*
@@ -3310,7 +3445,8 @@ static void php_oci_spool_close(php_oci_spool *session_pool TSRMLS_DC)
}
free(session_pool);
-} /* }}} */
+}
+/* }}} */
/* {{{ php_oci_ping_init()
*
@@ -3353,7 +3489,22 @@ static sword php_oci_ping_init(php_oci_connection *connection, OCIError *errh TS
connection->next_pingp = next_pingp;
return OCI_SUCCESS;
-} /* }}} */
+}
+/* }}} */
+
+/* {{{ php_oci_dtrace_check_connection()
+ *
+ * DTrace output for connections that may have become invalid and marked for reopening
+ */
+void php_oci_dtrace_check_connection(php_oci_connection *connection, sb4 errcode, ub4 serverStatus)
+{
+#ifdef HAVE_OCI8_DTRACE
+ if (DTRACE_OCI8_CHECK_CONNECTION_ENABLED()) {
+ DTRACE_OCI8_CHECK_CONNECTION(connection, connection && connection->is_open ? 1 : 0, (long)errcode, (unsigned long)serverStatus);
+ }
+#endif /* HAVE_OCI8_DTRACE */
+}
+/* }}} */
#endif /* HAVE_OCI8 */
diff --git a/ext/oci8/oci8_collection.c b/ext/oci8/oci8_collection.c
index 763e12e924..320e90a5b8 100644
--- a/ext/oci8/oci8_collection.c
+++ b/ext/oci8/oci8_collection.c
@@ -44,21 +44,22 @@
/* {{{ php_oci_collection_create()
Create and return connection handle */
-php_oci_collection * php_oci_collection_create(php_oci_connection *connection, char *tdo, int tdo_len, char *schema, int schema_len TSRMLS_DC)
+php_oci_collection *php_oci_collection_create(php_oci_connection *connection, char *tdo, int tdo_len, char *schema, int schema_len TSRMLS_DC)
{
dvoid *dschp1 = NULL;
dvoid *parmp1;
dvoid *parmp2;
php_oci_collection *collection;
+ sword errstatus;
collection = emalloc(sizeof(php_oci_collection));
collection->connection = connection;
collection->collection = NULL;
- zend_list_addref(collection->connection->rsrc_id);
+ zend_list_addref(collection->connection->id);
/* get type handle by name */
- PHP_OCI_CALL_RETURN(connection->errcode, OCITypeByName,
+ PHP_OCI_CALL_RETURN(errstatus, OCITypeByName,
(
connection->env,
connection->err,
@@ -75,19 +76,19 @@ php_oci_collection * php_oci_collection_create(php_oci_connection *connection, c
)
);
- if (connection->errcode != OCI_SUCCESS) {
+ if (errstatus != OCI_SUCCESS) {
goto CLEANUP;
}
/* allocate describe handle */
- PHP_OCI_CALL_RETURN(connection->errcode, OCIHandleAlloc, (connection->env, (dvoid **) &dschp1, (ub4) OCI_HTYPE_DESCRIBE, (size_t) 0, (dvoid **) 0));
+ PHP_OCI_CALL_RETURN(errstatus, OCIHandleAlloc, (connection->env, (dvoid **) &dschp1, (ub4) OCI_HTYPE_DESCRIBE, (size_t) 0, (dvoid **) 0));
- if (connection->errcode != OCI_SUCCESS) {
+ if (errstatus != OCI_SUCCESS) {
goto CLEANUP;
}
/* describe TDO */
- PHP_OCI_CALL_RETURN(connection->errcode, OCIDescribeAny,
+ PHP_OCI_CALL_RETURN(errstatus, OCIDescribeAny,
(
connection->svc,
connection->err,
@@ -100,19 +101,19 @@ php_oci_collection * php_oci_collection_create(php_oci_connection *connection, c
)
);
- if (connection->errcode != OCI_SUCCESS) {
+ if (errstatus != OCI_SUCCESS) {
goto CLEANUP;
}
/* get first parameter handle */
- PHP_OCI_CALL_RETURN(connection->errcode, OCIAttrGet, ((dvoid *) dschp1, (ub4) OCI_HTYPE_DESCRIBE, (dvoid *)&parmp1, (ub4 *)0, (ub4)OCI_ATTR_PARAM, connection->err));
+ PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *) dschp1, (ub4) OCI_HTYPE_DESCRIBE, (dvoid *)&parmp1, (ub4 *)0, (ub4)OCI_ATTR_PARAM, connection->err));
- if (connection->errcode != OCI_SUCCESS) {
+ if (errstatus != OCI_SUCCESS) {
goto CLEANUP;
}
/* get the collection type code of the attribute */
- PHP_OCI_CALL_RETURN(connection->errcode, OCIAttrGet,
+ PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet,
(
(dvoid*) parmp1,
(ub4) OCI_DTYPE_PARAM,
@@ -123,7 +124,7 @@ php_oci_collection * php_oci_collection_create(php_oci_connection *connection, c
)
);
- if (connection->errcode != OCI_SUCCESS) {
+ if (errstatus != OCI_SUCCESS) {
goto CLEANUP;
}
@@ -131,7 +132,7 @@ php_oci_collection * php_oci_collection_create(php_oci_connection *connection, c
case OCI_TYPECODE_TABLE:
case OCI_TYPECODE_VARRAY:
/* get collection element handle */
- PHP_OCI_CALL_RETURN(connection->errcode, OCIAttrGet,
+ PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet,
(
(dvoid*) parmp1,
(ub4) OCI_DTYPE_PARAM,
@@ -142,12 +143,12 @@ php_oci_collection * php_oci_collection_create(php_oci_connection *connection, c
)
);
- if (connection->errcode != OCI_SUCCESS) {
+ if (errstatus != OCI_SUCCESS) {
goto CLEANUP;
}
/* get REF of the TDO for the type */
- PHP_OCI_CALL_RETURN(connection->errcode, OCIAttrGet,
+ PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet,
(
(dvoid*) parmp2,
(ub4) OCI_DTYPE_PARAM,
@@ -158,12 +159,12 @@ php_oci_collection * php_oci_collection_create(php_oci_connection *connection, c
)
);
- if (connection->errcode != OCI_SUCCESS) {
+ if (errstatus != OCI_SUCCESS) {
goto CLEANUP;
}
/* get the TDO (only header) */
- PHP_OCI_CALL_RETURN(connection->errcode, OCITypeByRef,
+ PHP_OCI_CALL_RETURN(errstatus, OCITypeByRef,
(
connection->env,
connection->err,
@@ -174,12 +175,12 @@ php_oci_collection * php_oci_collection_create(php_oci_connection *connection, c
)
);
- if (connection->errcode != OCI_SUCCESS) {
+ if (errstatus != OCI_SUCCESS) {
goto CLEANUP;
}
/* get typecode */
- PHP_OCI_CALL_RETURN(connection->errcode, OCIAttrGet,
+ PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet,
(
(dvoid*) parmp2,
(ub4) OCI_DTYPE_PARAM,
@@ -190,7 +191,7 @@ php_oci_collection * php_oci_collection_create(php_oci_connection *connection, c
)
);
- if (connection->errcode != OCI_SUCCESS) {
+ if (errstatus != OCI_SUCCESS) {
goto CLEANUP;
}
break;
@@ -201,7 +202,7 @@ php_oci_collection * php_oci_collection_create(php_oci_connection *connection, c
}
/* Create object to hold return table */
- PHP_OCI_CALL_RETURN(connection->errcode, OCIObjectNew,
+ PHP_OCI_CALL_RETURN(errstatus, OCIObjectNew,
(
connection->env,
connection->err,
@@ -215,13 +216,14 @@ php_oci_collection * php_oci_collection_create(php_oci_connection *connection, c
)
);
- if (connection->errcode != OCI_SUCCESS) {
+ if (errstatus != OCI_SUCCESS) {
goto CLEANUP;
}
/* free the describe handle (Bug #44113) */
PHP_OCI_CALL(OCIHandleFree, ((dvoid *) dschp1, OCI_HTYPE_DESCRIBE));
PHP_OCI_REGISTER_RESOURCE(collection, le_collection);
+ connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
return collection;
CLEANUP:
@@ -230,27 +232,31 @@ CLEANUP:
/* free the describe handle (Bug #44113) */
PHP_OCI_CALL(OCIHandleFree, ((dvoid *) dschp1, OCI_HTYPE_DESCRIBE));
}
- connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
php_oci_collection_close(collection TSRMLS_CC);
return NULL;
-} /* }}} */
+}
+/* }}} */
/* {{{ php_oci_collection_size()
Return size of the collection */
int php_oci_collection_size(php_oci_collection *collection, sb4 *size TSRMLS_DC)
{
php_oci_connection *connection = collection->connection;
+ sword errstatus;
- PHP_OCI_CALL_RETURN(connection->errcode, OCICollSize, (connection->env, connection->err, collection->collection, (sb4 *)size));
+ PHP_OCI_CALL_RETURN(errstatus, OCICollSize, (connection->env, connection->err, collection->collection, (sb4 *)size));
- if (connection->errcode != OCI_SUCCESS) {
- connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
+ connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
return 0;
-} /* }}} */
+}
+/* }}} */
/* {{{ php_oci_collection_max()
Return max number of elements in the collection */
@@ -262,23 +268,27 @@ int php_oci_collection_max(php_oci_collection *collection, long *max TSRMLS_DC)
/* error handling is not necessary here? */
return 0;
-} /* }}} */
+}
+/* }}} */
/* {{{ php_oci_collection_trim()
Trim collection to the given number of elements */
int php_oci_collection_trim(php_oci_collection *collection, long trim_size TSRMLS_DC)
{
php_oci_connection *connection = collection->connection;
-
- PHP_OCI_CALL_RETURN(connection->errcode, OCICollTrim, (connection->env, connection->err, trim_size, collection->collection));
+ sword errstatus;
+
+ PHP_OCI_CALL_RETURN(errstatus, OCICollTrim, (connection->env, connection->err, trim_size, collection->collection));
- if (connection->errcode != OCI_SUCCESS) {
- connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ errstatus = php_oci_error(connection->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
+ connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
return 0;
-} /* }}} */
+}
+/* }}} */
/* {{{ php_oci_collection_append_null()
Append NULL element to the end of the collection */
@@ -286,17 +296,20 @@ int php_oci_collection_append_null(php_oci_collection *collection TSRMLS_DC)
{
OCIInd null_index = OCI_IND_NULL;
php_oci_connection *connection = collection->connection;
+ sword errstatus;
/* append NULL element */
- PHP_OCI_CALL_RETURN(connection->errcode, OCICollAppend, (connection->env, connection->err, (dvoid *)0, &null_index, collection->collection));
+ PHP_OCI_CALL_RETURN(errstatus, OCICollAppend, (connection->env, connection->err, (dvoid *)0, &null_index, collection->collection));
- if (connection->errcode != OCI_SUCCESS) {
- connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ errstatus = php_oci_error(connection->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
+ connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
return 0;
-} /* }}} */
+}
+/* }}} */
/* {{{ php_oci_collection_append_date()
Append DATE element to the end of the collection (use "DD-MON-YY" format) */
@@ -305,18 +318,19 @@ int php_oci_collection_append_date(php_oci_collection *collection, char *date, i
OCIInd new_index = OCI_IND_NOTNULL;
OCIDate oci_date;
php_oci_connection *connection = collection->connection;
+ sword errstatus;
/* format and language are NULLs, so format is "DD-MON-YY" and language is the default language of the session */
- PHP_OCI_CALL_RETURN(connection->errcode, OCIDateFromText, (connection->err, (CONST text *)date, date_len, NULL, 0, NULL, 0, &oci_date));
+ PHP_OCI_CALL_RETURN(errstatus, OCIDateFromText, (connection->err, (CONST text *)date, date_len, NULL, 0, NULL, 0, &oci_date));
- if (connection->errcode != OCI_SUCCESS) {
+ if (errstatus != OCI_SUCCESS) {
/* failed to convert string to date */
- connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
- PHP_OCI_CALL_RETURN(connection->errcode, OCICollAppend,
+ PHP_OCI_CALL_RETURN(errstatus, OCICollAppend,
(
connection->env,
connection->err,
@@ -326,14 +340,16 @@ int php_oci_collection_append_date(php_oci_collection *collection, char *date, i
)
);
- if (connection->errcode != OCI_SUCCESS) {
- connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
+ connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
return 0;
-} /* }}} */
+}
+/* }}} */
/* {{{ php_oci_collection_append_number()
Append NUMBER to the end of the collection */
@@ -343,6 +359,7 @@ int php_oci_collection_append_number(php_oci_collection *collection, char *numbe
double element_double;
OCINumber oci_number;
php_oci_connection *connection = collection->connection;
+ sword errstatus;
#if (PHP_MAJOR_VERSION == 4 && PHP_MINOR_VERSION == 3 && PHP_RELEASE_VERSION < 10)
/* minimum PHP version ext/oci8/config.m4 accepts is 4.3.9 */
@@ -352,15 +369,15 @@ int php_oci_collection_append_number(php_oci_collection *collection, char *numbe
element_double = zend_strtod(number, NULL);
#endif
- PHP_OCI_CALL_RETURN(connection->errcode, OCINumberFromReal, (connection->err, &element_double, sizeof(double), &oci_number));
+ PHP_OCI_CALL_RETURN(errstatus, OCINumberFromReal, (connection->err, &element_double, sizeof(double), &oci_number));
- if (connection->errcode != OCI_SUCCESS) {
- connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
- PHP_OCI_CALL_RETURN(connection->errcode, OCICollAppend,
+ PHP_OCI_CALL_RETURN(errstatus, OCICollAppend,
(
connection->env,
connection->err,
@@ -370,14 +387,16 @@ int php_oci_collection_append_number(php_oci_collection *collection, char *numbe
)
);
- if (connection->errcode != OCI_SUCCESS) {
- connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
+ connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
return 0;
-} /* }}} */
+}
+/* }}} */
/* {{{ php_oci_collection_append_string()
Append STRING to the end of the collection */
@@ -386,16 +405,17 @@ int php_oci_collection_append_string(php_oci_collection *collection, char *eleme
OCIInd new_index = OCI_IND_NOTNULL;
OCIString *ocistr = (OCIString *)0;
php_oci_connection *connection = collection->connection;
+ sword errstatus;
- PHP_OCI_CALL_RETURN(connection->errcode, OCIStringAssignText, (connection->env, connection->err, (CONST oratext *)element, element_len, &ocistr));
+ PHP_OCI_CALL_RETURN(errstatus, OCIStringAssignText, (connection->env, connection->err, (CONST oratext *)element, element_len, &ocistr));
- if (connection->errcode != OCI_SUCCESS) {
- connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
- PHP_OCI_CALL_RETURN(connection->errcode, OCICollAppend,
+ PHP_OCI_CALL_RETURN(errstatus, OCICollAppend,
(
connection->env,
connection->err,
@@ -405,14 +425,16 @@ int php_oci_collection_append_string(php_oci_collection *collection, char *eleme
)
);
- if (connection->errcode != OCI_SUCCESS) {
- connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
+ connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
return 0;
-} /* }}} */
+}
+/* }}} */
/* {{{ php_oci_collection_append()
Append wrapper. Appends any supported element to the end of the collection */
@@ -452,7 +474,8 @@ int php_oci_collection_append(php_oci_collection *collection, char *element, int
}
/* never reached */
return 1;
-} /* }}} */
+}
+/* }}} */
/* {{{ php_oci_collection_element_get()
Get the element with the given index */
@@ -464,11 +487,14 @@ int php_oci_collection_element_get(php_oci_collection *collection, long index, z
boolean exists;
oratext buff[1024];
ub4 buff_len = 1024;
+ sword errstatus;
MAKE_STD_ZVAL(*result_element);
ZVAL_NULL(*result_element);
- PHP_OCI_CALL_RETURN(connection->errcode, OCICollGetElem,
+ connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
+
+ PHP_OCI_CALL_RETURN(errstatus, OCICollGetElem,
(
connection->env,
connection->err,
@@ -480,8 +506,8 @@ int php_oci_collection_element_get(php_oci_collection *collection, long index, z
)
);
- if (connection->errcode != OCI_SUCCESS) {
- connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
FREE_ZVAL(*result_element);
return 1;
@@ -500,10 +526,10 @@ int php_oci_collection_element_get(php_oci_collection *collection, long index, z
switch (collection->element_typecode) {
case OCI_TYPECODE_DATE:
- PHP_OCI_CALL_RETURN(connection->errcode, OCIDateToText, (connection->err, element, 0, 0, 0, 0, &buff_len, buff));
+ PHP_OCI_CALL_RETURN(errstatus, OCIDateToText, (connection->err, element, 0, 0, 0, 0, &buff_len, buff));
- if (connection->errcode != OCI_SUCCESS) {
- connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
FREE_ZVAL(*result_element);
return 1;
@@ -543,10 +569,10 @@ int php_oci_collection_element_get(php_oci_collection *collection, long index, z
{
double double_number;
- PHP_OCI_CALL_RETURN(connection->errcode, OCINumberToReal, (connection->err, (CONST OCINumber *) element, (uword) sizeof(double), (dvoid *) &double_number));
+ PHP_OCI_CALL_RETURN(errstatus, OCINumberToReal, (connection->err, (CONST OCINumber *) element, (uword) sizeof(double), (dvoid *) &double_number));
- if (connection->errcode != OCI_SUCCESS) {
- connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
FREE_ZVAL(*result_element);
return 1;
@@ -565,7 +591,8 @@ int php_oci_collection_element_get(php_oci_collection *collection, long index, z
}
/* never reached */
return 1;
-} /* }}} */
+}
+/* }}} */
/* {{{ php_oci_collection_element_set_null()
Set the element with the given index to NULL */
@@ -573,17 +600,20 @@ int php_oci_collection_element_set_null(php_oci_collection *collection, long ind
{
OCIInd null_index = OCI_IND_NULL;
php_oci_connection *connection = collection->connection;
+ sword errstatus;
/* set NULL element */
- PHP_OCI_CALL_RETURN(connection->errcode, OCICollAssignElem, (connection->env, connection->err, (ub4) index, (dvoid *)"", &null_index, collection->collection));
+ PHP_OCI_CALL_RETURN(errstatus, OCICollAssignElem, (connection->env, connection->err, (ub4) index, (dvoid *)"", &null_index, collection->collection));
- if (connection->errcode != OCI_SUCCESS) {
- connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
+ connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
return 0;
-} /* }}} */
+}
+/* }}} */
/* {{{ php_oci_collection_element_set_date()
Change element's value to the given DATE */
@@ -592,18 +622,19 @@ int php_oci_collection_element_set_date(php_oci_collection *collection, long ind
OCIInd new_index = OCI_IND_NOTNULL;
OCIDate oci_date;
php_oci_connection *connection = collection->connection;
+ sword errstatus;
/* format and language are NULLs, so format is "DD-MON-YY" and language is the default language of the session */
- PHP_OCI_CALL_RETURN(connection->errcode, OCIDateFromText, (connection->err, (CONST text *)date, date_len, NULL, 0, NULL, 0, &oci_date));
+ PHP_OCI_CALL_RETURN(errstatus, OCIDateFromText, (connection->err, (CONST text *)date, date_len, NULL, 0, NULL, 0, &oci_date));
- if (connection->errcode != OCI_SUCCESS) {
+ if (errstatus != OCI_SUCCESS) {
/* failed to convert string to date */
- connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
- PHP_OCI_CALL_RETURN(connection->errcode, OCICollAssignElem,
+ PHP_OCI_CALL_RETURN(errstatus, OCICollAssignElem,
(
connection->env,
connection->err,
@@ -614,14 +645,16 @@ int php_oci_collection_element_set_date(php_oci_collection *collection, long ind
)
);
- if (connection->errcode != OCI_SUCCESS) {
- connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
+ connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
return 0;
-} /* }}} */
+}
+/* }}} */
/* {{{ php_oci_collection_element_set_number()
Change element's value to the given NUMBER */
@@ -631,6 +664,7 @@ int php_oci_collection_element_set_number(php_oci_collection *collection, long i
double element_double;
OCINumber oci_number;
php_oci_connection *connection = collection->connection;
+ sword errstatus;
#if (PHP_MAJOR_VERSION == 4 && PHP_MINOR_VERSION == 3 && PHP_RELEASE_VERSION < 10)
/* minimum PHP version ext/oci8/config.m4 accepts is 4.3.9 */
@@ -640,15 +674,15 @@ int php_oci_collection_element_set_number(php_oci_collection *collection, long i
element_double = zend_strtod(number, NULL);
#endif
- PHP_OCI_CALL_RETURN(connection->errcode, OCINumberFromReal, (connection->err, &element_double, sizeof(double), &oci_number));
+ PHP_OCI_CALL_RETURN(errstatus, OCINumberFromReal, (connection->err, &element_double, sizeof(double), &oci_number));
- if (connection->errcode != OCI_SUCCESS) {
- connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
- PHP_OCI_CALL_RETURN(connection->errcode, OCICollAssignElem,
+ PHP_OCI_CALL_RETURN(errstatus, OCICollAssignElem,
(
connection->env,
connection->err,
@@ -659,14 +693,16 @@ int php_oci_collection_element_set_number(php_oci_collection *collection, long i
)
);
- if (connection->errcode != OCI_SUCCESS) {
- connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
+ connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
return 0;
-} /* }}} */
+}
+/* }}} */
/* {{{ php_oci_collection_element_set_string()
Change element's value to the given string */
@@ -675,16 +711,17 @@ int php_oci_collection_element_set_string(php_oci_collection *collection, long i
OCIInd new_index = OCI_IND_NOTNULL;
OCIString *ocistr = (OCIString *)0;
php_oci_connection *connection = collection->connection;
+ sword errstatus;
- PHP_OCI_CALL_RETURN(connection->errcode, OCIStringAssignText, (connection->env, connection->err, (CONST oratext *)element, element_len, &ocistr));
+ PHP_OCI_CALL_RETURN(errstatus, OCIStringAssignText, (connection->env, connection->err, (CONST oratext *)element, element_len, &ocistr));
- if (connection->errcode != OCI_SUCCESS) {
- connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
- PHP_OCI_CALL_RETURN(connection->errcode, OCICollAssignElem,
+ PHP_OCI_CALL_RETURN(errstatus, OCICollAssignElem,
(
connection->env,
connection->err,
@@ -695,14 +732,16 @@ int php_oci_collection_element_set_string(php_oci_collection *collection, long i
)
);
- if (connection->errcode != OCI_SUCCESS) {
- connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
+ connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
return 0;
-} /* }}} */
+}
+/* }}} */
/* {{{ php_oci_collection_element_set()
Collection element setter */
@@ -742,44 +781,51 @@ int php_oci_collection_element_set(php_oci_collection *collection, long index, c
}
/* never reached */
return 1;
-} /* }}} */
+}
+/* }}} */
/* {{{ php_oci_collection_assign()
Assigns a value to the collection from another collection */
int php_oci_collection_assign(php_oci_collection *collection_dest, php_oci_collection *collection_from TSRMLS_DC)
{
php_oci_connection *connection = collection_dest->connection;
+ sword errstatus;
- PHP_OCI_CALL_RETURN(connection->errcode, OCICollAssign, (connection->env, connection->err, collection_from->collection, collection_dest->collection));
+ PHP_OCI_CALL_RETURN(errstatus, OCICollAssign, (connection->env, connection->err, collection_from->collection, collection_dest->collection));
- if (connection->errcode != OCI_SUCCESS) {
- connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
+ connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
return 0;
-} /* }}} */
+}
+/* }}} */
/* {{{ php_oci_collection_close()
Destroy collection and all associated resources */
void php_oci_collection_close(php_oci_collection *collection TSRMLS_DC)
{
php_oci_connection *connection = collection->connection;
+ sword errstatus;
if (collection->collection) {
- PHP_OCI_CALL_RETURN(connection->errcode, OCIObjectFree, (connection->env, connection->err, (dvoid *)collection->collection, (ub2)OCI_OBJECTFREE_FORCE));
+ PHP_OCI_CALL_RETURN(errstatus, OCIObjectFree, (connection->env, connection->err, (dvoid *)collection->collection, (ub2)OCI_OBJECTFREE_FORCE));
- if (connection->errcode != OCI_SUCCESS) {
- connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
+ } else {
+ connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
}
}
- zend_list_delete(collection->connection->rsrc_id);
-
+ zend_list_delete(collection->connection->id);
efree(collection);
return;
-} /* }}} */
+}
+/* }}} */
#endif /* HAVE_OCI8 */
diff --git a/ext/oci8/oci8_dtrace.d b/ext/oci8/oci8_dtrace.d
new file mode 100644
index 0000000000..8ac94105c1
--- /dev/null
+++ b/ext/oci8/oci8_dtrace.d
@@ -0,0 +1,36 @@
+/*
+ +----------------------------------------------------------------------+
+ | Zend Engine |
+ +----------------------------------------------------------------------+
+ | Copyright (c) 2013 Zend Technologies Ltd. (http://www.zend.com) |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the Zend license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.zend.com/license/3_01.txt. |
+ | If you did not receive a copy of the Zend license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@zend.com so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Author: Christopher Jones <christopher.jones@oracle.com> |
+ +----------------------------------------------------------------------+
+*/
+
+provider php {
+ probe oci8__check__connection(void *connection, int is_open, long errcode, unsigned long server_status);
+ probe oci8__connect__entry(char *username, char *dbname, char *charset, long session_mode, int persistent, int exclusive);
+ probe oci8__connect__return(void *connection);
+ probe oci8__connection__close(void *connection);
+ probe oci8__error(int status, long errcode);
+ probe oci8__execute__mode(void *connection, unsigned int mode);
+ probe oci8__sqltext(void *connection, char *sql);
+
+ probe oci8__connect__p__dtor__close(void *connection);
+ probe oci8__connect__p__dtor__release(void *connection);
+ probe oci8__connect__lookup(void *connection, int is_stub);
+ probe oci8__connect__expiry(void *connection, int is_stub, long idle_expiry, long timestamp);
+ probe oci8__connect__type(int persistent, int exclusive, void *connection, long num_persistent, long num_connections);
+ probe oci8__sesspool__create(void *session_pool);
+ probe oci8__sesspool__stats(unsigned long free, unsigned long busy, unsigned long open);
+ probe oci8__sesspool__type(int type, void *session_pool);
+};
diff --git a/ext/oci8/oci8_interface.c b/ext/oci8/oci8_interface.c
index e51d3c92f5..8d70aff9c2 100644
--- a/ext/oci8/oci8_interface.c
+++ b/ext/oci8/oci8_interface.c
@@ -1308,12 +1308,7 @@ PHP_FUNCTION(oci_field_is_null)
Toggle internal debugging output for the OCI extension */
PHP_FUNCTION(oci_internal_debug)
{
- zend_bool on_off;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &on_off) == FAILURE) {
- return;
- }
- OCI_G(debug_mode) = on_off;
+ /* NOP in OCI8 2.0. Obsoleted by DTrace probes */
}
/* }}} */
@@ -1583,7 +1578,7 @@ PHP_FUNCTION(oci_close)
}
PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection);
- zend_list_delete(connection->rsrc_id);
+ zend_list_delete(connection->id);
ZVAL_NULL(z_connection);
@@ -1591,7 +1586,7 @@ PHP_FUNCTION(oci_close)
}
/* }}} */
-/* {{{ proto resource oci_new_connect(string user, string pass [, string db])
+/* {{{ proto resource oci_new_connect(string user, string pass [, string db, string charset [, int session_mode ]])
Connect to an Oracle database and log on. Returns a new session. */
PHP_FUNCTION(oci_new_connect)
{
@@ -1607,7 +1602,7 @@ PHP_FUNCTION(oci_connect)
}
/* }}} */
-/* {{{ proto resource oci_pconnect(string user, string pass [, string db [, string charset ]])
+/* {{{ proto resource oci_pconnect(string user, string pass [, string db [, string charset [, int session_mode ]])
Connect to an Oracle database using a persistent connection and log on. Returns a new session. */
PHP_FUNCTION(oci_pconnect)
{
@@ -1624,7 +1619,6 @@ PHP_FUNCTION(oci_error)
php_oci_connection *connection;
text *errbuf;
sb4 errcode = 0;
- sword error = OCI_SUCCESS;
dvoid *errh = NULL;
ub2 error_offset = 0;
text *sqltext = NULL;
@@ -1635,10 +1629,9 @@ PHP_FUNCTION(oci_error)
if (ZEND_NUM_ARGS() > 0) {
statement = (php_oci_statement *) zend_fetch_resource(&arg TSRMLS_CC, -1, NULL, NULL, 1, le_statement);
-
if (statement) {
errh = statement->err;
- error = statement->errcode;
+ errcode = statement->errcode;
if (php_oci_fetch_sqltext_offset(statement, &sqltext, &error_offset TSRMLS_CC)) {
RETURN_FALSE;
@@ -1649,23 +1642,23 @@ PHP_FUNCTION(oci_error)
connection = (php_oci_connection *) zend_fetch_resource(&arg TSRMLS_CC, -1, NULL, NULL, 1, le_connection);
if (connection) {
errh = connection->err;
- error = connection->errcode;
+ errcode = connection->errcode;
goto go_out;
}
connection = (php_oci_connection *) zend_fetch_resource(&arg TSRMLS_CC, -1, NULL, NULL, 1, le_pconnection);
if (connection) {
errh = connection->err;
- error = connection->errcode;
+ errcode = connection->errcode;
goto go_out;
}
} else {
errh = OCI_G(err);
- error = OCI_G(errcode);
+ errcode = OCI_G(errcode);
}
go_out:
- if (error == OCI_SUCCESS) { /* no error set in the handle */
+ if (errcode == 0) { /* no error set in the handle */
RETURN_FALSE;
}
@@ -1744,7 +1737,12 @@ PHP_FUNCTION(oci_set_prefetch)
PHP_OCI_ZVAL_TO_STATEMENT(z_statement, statement);
- if (php_oci_statement_set_prefetch(statement, size TSRMLS_CC)) {
+ if (size < 0) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Number of rows to be prefetched has to be greater than or equal to 0");
+ return;
+ }
+
+ if (php_oci_statement_set_prefetch(statement, (ub4)size TSRMLS_CC)) {
RETURN_FALSE;
}
RETURN_TRUE;
@@ -1759,6 +1757,7 @@ PHP_FUNCTION(oci_set_client_identifier)
php_oci_connection *connection;
char *client_id;
int client_id_len;
+ sword errstatus;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_connection, &client_id, &client_id_len) == FAILURE) {
return;
@@ -1766,10 +1765,10 @@ PHP_FUNCTION(oci_set_client_identifier)
PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection);
- PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) client_id, (ub4) client_id_len, (ub4) OCI_ATTR_CLIENT_IDENTIFIER, OCI_G(err)));
+ PHP_OCI_CALL_RETURN(errstatus, OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) client_id, (ub4) client_id_len, (ub4) OCI_ATTR_CLIENT_IDENTIFIER, connection->err));
- if (OCI_G(errcode) != OCI_SUCCESS) {
- php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
RETURN_FALSE;
}
@@ -1809,7 +1808,7 @@ PHP_FUNCTION(oci_set_edition)
/* }}} */
/* {{{ proto bool oci_set_module_name(resource connection, string value)
- Sets the module attribute on the connection */
+ Sets the module attribute on the connection for end-to-end tracing */
PHP_FUNCTION(oci_set_module_name)
{
#if (OCI_MAJOR_VERSION >= 10)
@@ -1817,6 +1816,7 @@ PHP_FUNCTION(oci_set_module_name)
php_oci_connection *connection;
char *module;
int module_len;
+ sword errstatus;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_connection, &module, &module_len) == FAILURE) {
return;
@@ -1824,10 +1824,10 @@ PHP_FUNCTION(oci_set_module_name)
PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection);
- PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) module, (ub4) module_len, (ub4) OCI_ATTR_MODULE, OCI_G(err)));
+ PHP_OCI_CALL_RETURN(errstatus, OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) module, (ub4) module_len, (ub4) OCI_ATTR_MODULE, connection->err));
- if (OCI_G(errcode) != OCI_SUCCESS) {
- php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
RETURN_FALSE;
}
@@ -1840,7 +1840,7 @@ PHP_FUNCTION(oci_set_module_name)
/* }}} */
/* {{{ proto bool oci_set_action(resource connection, string value)
- Sets the action attribute on the connection */
+ Sets the action attribute on the connection for end-to-end tracing */
PHP_FUNCTION(oci_set_action)
{
#if (OCI_MAJOR_VERSION >= 10)
@@ -1848,6 +1848,7 @@ PHP_FUNCTION(oci_set_action)
php_oci_connection *connection;
char *action;
int action_len;
+ sword errstatus;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_connection, &action, &action_len) == FAILURE) {
return;
@@ -1855,10 +1856,10 @@ PHP_FUNCTION(oci_set_action)
PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection);
- PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) action, (ub4) action_len, (ub4) OCI_ATTR_ACTION, OCI_G(err)));
+ PHP_OCI_CALL_RETURN(errstatus, OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) action, (ub4) action_len, (ub4) OCI_ATTR_ACTION, connection->err));
- if (OCI_G(errcode) != OCI_SUCCESS) {
- php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
RETURN_FALSE;
}
@@ -1871,7 +1872,7 @@ PHP_FUNCTION(oci_set_action)
/* }}} */
/* {{{ proto bool oci_set_client_info(resource connection, string value)
- Sets the client info attribute on the connection */
+ Sets the client info attribute on the connection for end-to-end tracing */
PHP_FUNCTION(oci_set_client_info)
{
#if (OCI_MAJOR_VERSION >= 10)
@@ -1879,6 +1880,7 @@ PHP_FUNCTION(oci_set_client_info)
php_oci_connection *connection;
char *client_info;
int client_info_len;
+ sword errstatus;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_connection, &client_info, &client_info_len) == FAILURE) {
return;
@@ -1886,10 +1888,10 @@ PHP_FUNCTION(oci_set_client_info)
PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection);
- PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) client_info, (ub4) client_info_len, (ub4) OCI_ATTR_CLIENT_INFO, OCI_G(err)));
+ PHP_OCI_CALL_RETURN(errstatus, OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) client_info, (ub4) client_info_len, (ub4) OCI_ATTR_CLIENT_INFO, connection->err));
- if (OCI_G(errcode) != OCI_SUCCESS) {
- php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
RETURN_FALSE;
}
@@ -1957,7 +1959,7 @@ PHP_FUNCTION(oci_password_change)
if (!connection) {
RETURN_FALSE;
}
- RETURN_RESOURCE(connection->rsrc_id);
+ RETURN_RESOURCE(connection->id);
}
WRONG_PARAM_COUNT;
}
@@ -2395,6 +2397,32 @@ PHP_FUNCTION(oci_new_collection)
}
/* }}} */
+/* {{{ proto bool oci_get_implicit(resource stmt)
+ Get the next statement resource from an Oracle 12c PL/SQL Implicit Result Set */
+PHP_FUNCTION(oci_get_implicit_resultset)
+{
+ zval *z_statement;
+ php_oci_statement *statement;
+ php_oci_statement *imp_statement;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &z_statement) == FAILURE) {
+ return;
+ }
+
+ PHP_OCI_ZVAL_TO_STATEMENT(z_statement, statement);
+
+ imp_statement = php_oci_get_implicit_resultset(statement TSRMLS_CC);
+
+ if (imp_statement) {
+ if (php_oci_statement_execute(imp_statement, (ub4)OCI_DEFAULT TSRMLS_CC))
+ RETURN_FALSE;
+ RETURN_RESOURCE(imp_statement->id);
+ }
+ RETURN_FALSE;
+}
+
+/* }}} */
+
#endif /* HAVE_OCI8 */
/*
diff --git a/ext/oci8/oci8_lob.c b/ext/oci8/oci8_lob.c
index d05e053919..8d14dc3f50 100644
--- a/ext/oci8/oci8_lob.c
+++ b/ext/oci8/oci8_lob.c
@@ -54,6 +54,7 @@
php_oci_descriptor *php_oci_lob_create (php_oci_connection *connection, long type TSRMLS_DC)
{
php_oci_descriptor *descriptor;
+ sword errstatus;
switch (type) {
case OCI_DTYPE_FILE:
@@ -70,15 +71,17 @@ php_oci_descriptor *php_oci_lob_create (php_oci_connection *connection, long typ
descriptor = ecalloc(1, sizeof(php_oci_descriptor));
descriptor->type = type;
descriptor->connection = connection;
- zend_list_addref(descriptor->connection->rsrc_id);
+ zend_list_addref(descriptor->connection->id);
- PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIDescriptorAlloc, (connection->env, (dvoid*)&(descriptor->descriptor), descriptor->type, (size_t) 0, (dvoid **) 0));
+ PHP_OCI_CALL_RETURN(errstatus, OCIDescriptorAlloc, (connection->env, (dvoid*)&(descriptor->descriptor), descriptor->type, (size_t) 0, (dvoid **) 0));
- if (OCI_G(errcode) != OCI_SUCCESS) {
- OCI_G(errcode) = php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ OCI_G(errcode) = php_oci_error(OCI_G(err), errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, OCI_G(errcode));
efree(descriptor);
return NULL;
+ } else {
+ OCI_G(errcode) = 0; /* retain backwards compat with OCI8 1.4 */
}
PHP_OCI_REGISTER_RESOURCE(descriptor, le_descriptor);
@@ -109,13 +112,15 @@ php_oci_descriptor *php_oci_lob_create (php_oci_connection *connection, long typ
}
return descriptor;
-} /* }}} */
+}
+/* }}} */
/* {{{ php_oci_lob_get_length()
Get length of the LOB. The length is cached so we don't need to ask Oracle every time */
int php_oci_lob_get_length (php_oci_descriptor *descriptor, ub4 *length TSRMLS_DC)
{
php_oci_connection *connection = descriptor->connection;
+ sword errstatus;
*length = 0;
@@ -124,18 +129,18 @@ int php_oci_lob_get_length (php_oci_descriptor *descriptor, ub4 *length TSRMLS_D
return 0;
} else {
if (descriptor->type == OCI_DTYPE_FILE) {
- PHP_OCI_CALL_RETURN(connection->errcode, OCILobFileOpen, (connection->svc, connection->err, descriptor->descriptor, OCI_FILE_READONLY));
- if (connection->errcode != OCI_SUCCESS) {
- connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ PHP_OCI_CALL_RETURN(errstatus, OCILobFileOpen, (connection->svc, connection->err, descriptor->descriptor, OCI_FILE_READONLY));
+ if (errstatus != OCI_SUCCESS) {
+ connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
}
- PHP_OCI_CALL_RETURN(connection->errcode, OCILobGetLength, (connection->svc, connection->err, descriptor->descriptor, (ub4 *)length));
+ PHP_OCI_CALL_RETURN(errstatus, OCILobGetLength, (connection->svc, connection->err, descriptor->descriptor, (ub4 *)length));
- if (connection->errcode != OCI_SUCCESS) {
- connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
@@ -143,17 +148,20 @@ int php_oci_lob_get_length (php_oci_descriptor *descriptor, ub4 *length TSRMLS_D
descriptor->lob_size = *length;
if (descriptor->type == OCI_DTYPE_FILE) {
- PHP_OCI_CALL_RETURN(connection->errcode, OCILobFileClose, (connection->svc, connection->err, descriptor->descriptor));
+ PHP_OCI_CALL_RETURN(errstatus, OCILobFileClose, (connection->svc, connection->err, descriptor->descriptor));
- if (connection->errcode != OCI_SUCCESS) {
- connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
}
+
+ connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
}
return 0;
-} /* }}} */
+}
+/* }}} */
/* {{{ php_oci_lob_callback()
Append LOB portion to a memory buffer */
@@ -203,25 +211,28 @@ sb4 php_oci_lob_callback (dvoid *ctxp, CONST dvoid *bufxp, ub4 len, ub1 piece)
}
/* }}} */
-/* {{{ php_oci_lob_calculate_buffer() */
+/* {{{ php_oci_lob_calculate_buffer()
+ Work out the size for LOB buffering */
static inline int php_oci_lob_calculate_buffer(php_oci_descriptor *descriptor, long read_length TSRMLS_DC)
{
php_oci_connection *connection = descriptor->connection;
ub4 chunk_size;
+ sword errstatus;
if (descriptor->type == OCI_DTYPE_FILE) {
return read_length;
}
if (!descriptor->chunk_size) {
- PHP_OCI_CALL_RETURN(connection->errcode, OCILobGetChunkSize, (connection->svc, connection->err, descriptor->descriptor, &chunk_size));
+ PHP_OCI_CALL_RETURN(errstatus, OCILobGetChunkSize, (connection->svc, connection->err, descriptor->descriptor, &chunk_size));
- if (connection->errcode != OCI_SUCCESS) {
- connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return read_length; /* we have to return original length here */
}
descriptor->chunk_size = chunk_size;
+ connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
}
if ((read_length % descriptor->chunk_size) != 0) {
@@ -250,6 +261,7 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini
#endif
int is_clob = 0;
sb4 bytes_per_char = 1;
+ sword errstatus;
*data_len = 0;
*data = NULL;
@@ -286,20 +298,20 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini
offset = initial_offset;
if (descriptor->type == OCI_DTYPE_FILE) {
- PHP_OCI_CALL_RETURN(connection->errcode, OCILobFileOpen, (connection->svc, connection->err, descriptor->descriptor, OCI_FILE_READONLY));
+ PHP_OCI_CALL_RETURN(errstatus, OCILobFileOpen, (connection->svc, connection->err, descriptor->descriptor, OCI_FILE_READONLY));
- if (connection->errcode != OCI_SUCCESS) {
- connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
} else {
ub2 charset_id = 0;
- PHP_OCI_CALL_RETURN(connection->errcode, OCILobCharSetId, (connection->env, connection->err, descriptor->descriptor, &charset_id));
+ PHP_OCI_CALL_RETURN(errstatus, OCILobCharSetId, (connection->env, connection->err, descriptor->descriptor, &charset_id));
- if (connection->errcode != OCI_SUCCESS) {
- connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
@@ -310,10 +322,10 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini
}
if (is_clob) {
- PHP_OCI_CALL_RETURN(connection->errcode, OCINlsNumericInfoGet, (connection->env, connection->err, &bytes_per_char, OCI_NLS_CHARSET_MAXBYTESZ));
+ PHP_OCI_CALL_RETURN(errstatus, OCINlsNumericInfoGet, (connection->env, connection->err, &bytes_per_char, OCI_NLS_CHARSET_MAXBYTESZ));
- if (connection->errcode != OCI_SUCCESS) {
- connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
@@ -337,7 +349,7 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini
buffer_size = php_oci_lob_calculate_buffer(descriptor, buffer_size TSRMLS_CC); /* use chunk size */
bufp = (ub1 *) ecalloc(1, buffer_size);
- PHP_OCI_CALL_RETURN(connection->errcode, OCILobRead2,
+ PHP_OCI_CALL_RETURN(errstatus, OCILobRead2,
(
connection->svc,
connection->err,
@@ -370,7 +382,7 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini
buffer_size = php_oci_lob_calculate_buffer(descriptor, buffer_size TSRMLS_CC); /* use chunk size */
bufp = (ub1 *) ecalloc(1, buffer_size);
- PHP_OCI_CALL_RETURN(connection->errcode, OCILobRead,
+ PHP_OCI_CALL_RETURN(errstatus, OCILobRead,
(
connection->svc,
connection->err,
@@ -391,8 +403,8 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini
#endif
- if (connection->errcode != OCI_SUCCESS) {
- connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
if (*data) {
efree(*data);
@@ -405,10 +417,10 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini
descriptor->lob_current_position = (int)offset;
if (descriptor->type == OCI_DTYPE_FILE) {
- PHP_OCI_CALL_RETURN(connection->errcode, OCILobFileClose, (connection->svc, connection->err, descriptor->descriptor));
+ PHP_OCI_CALL_RETURN(errstatus, OCILobFileClose, (connection->svc, connection->err, descriptor->descriptor));
- if (connection->errcode != OCI_SUCCESS) {
- connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
if (*data) {
efree(*data);
@@ -419,8 +431,10 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini
}
}
+ connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
return 0;
-} /* }}} */
+}
+/* }}} */
/* {{{ php_oci_lob_write()
Write data to the LOB */
@@ -429,6 +443,7 @@ int php_oci_lob_write (php_oci_descriptor *descriptor, ub4 offset, char *data, i
OCILobLocator *lob = (OCILobLocator *) descriptor->descriptor;
php_oci_connection *connection = (php_oci_connection *) descriptor->connection;
ub4 lob_length;
+ sword errstatus;
*bytes_written = 0;
if (php_oci_lob_get_length(descriptor, &lob_length TSRMLS_CC)) {
@@ -447,7 +462,7 @@ int php_oci_lob_write (php_oci_descriptor *descriptor, ub4 offset, char *data, i
offset = descriptor->lob_current_position;
}
- PHP_OCI_CALL_RETURN(connection->errcode, OCILobWrite,
+ PHP_OCI_CALL_RETURN(errstatus, OCILobWrite,
(
connection->svc,
connection->err,
@@ -464,8 +479,8 @@ int php_oci_lob_write (php_oci_descriptor *descriptor, ub4 offset, char *data, i
)
);
- if (connection->errcode) {
- connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ if (errstatus) {
+ connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
*bytes_written = 0;
return 1;
@@ -482,14 +497,17 @@ int php_oci_lob_write (php_oci_descriptor *descriptor, ub4 offset, char *data, i
descriptor->buffering = PHP_OCI_LOB_BUFFER_USED;
}
+ connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
return 0;
-} /* }}} */
+}
+/* }}} */
/* {{{ php_oci_lob_set_buffering()
Turn buffering off/onn for this particular LOB */
int php_oci_lob_set_buffering (php_oci_descriptor *descriptor, int on_off TSRMLS_DC)
{
php_oci_connection *connection = descriptor->connection;
+ sword errstatus;
if (!on_off && descriptor->buffering == PHP_OCI_LOB_BUFFER_DISABLED) {
/* disabling when it's already off */
@@ -502,19 +520,21 @@ int php_oci_lob_set_buffering (php_oci_descriptor *descriptor, int on_off TSRMLS
}
if (on_off) {
- PHP_OCI_CALL_RETURN(connection->errcode, OCILobEnableBuffering, (connection->svc, connection->err, descriptor->descriptor));
+ PHP_OCI_CALL_RETURN(errstatus, OCILobEnableBuffering, (connection->svc, connection->err, descriptor->descriptor));
} else {
- PHP_OCI_CALL_RETURN(connection->errcode, OCILobDisableBuffering, (connection->svc, connection->err, descriptor->descriptor));
+ PHP_OCI_CALL_RETURN(errstatus, OCILobDisableBuffering, (connection->svc, connection->err, descriptor->descriptor));
}
- if (connection->errcode != OCI_SUCCESS) {
- connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
descriptor->buffering = on_off ? PHP_OCI_LOB_BUFFER_ENABLED : PHP_OCI_LOB_BUFFER_DISABLED;
+ connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
return 0;
-} /* }}} */
+}
+/* }}} */
/* {{{ php_oci_lob_get_buffering()
Return current buffering state for the LOB */
@@ -525,7 +545,8 @@ int php_oci_lob_get_buffering (php_oci_descriptor *descriptor)
} else {
return 0;
}
-} /* }}} */
+}
+/* }}} */
/* {{{ php_oci_lob_copy()
Copy one LOB (or its part) to another one */
@@ -533,6 +554,7 @@ int php_oci_lob_copy (php_oci_descriptor *descriptor_dest, php_oci_descriptor *d
{
php_oci_connection *connection = descriptor_dest->connection;
ub4 length_dest, length_from, copy_len;
+ sword errstatus;
if (php_oci_lob_get_length(descriptor_dest, &length_dest TSRMLS_CC)) {
return 1;
@@ -553,7 +575,7 @@ int php_oci_lob_copy (php_oci_descriptor *descriptor_dest, php_oci_descriptor *d
return 1;
}
- PHP_OCI_CALL_RETURN(connection->errcode, OCILobCopy,
+ PHP_OCI_CALL_RETURN(errstatus, OCILobCopy,
(
connection->svc,
connection->err,
@@ -565,29 +587,33 @@ int php_oci_lob_copy (php_oci_descriptor *descriptor_dest, php_oci_descriptor *d
)
);
- if (connection->errcode != OCI_SUCCESS) {
- connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
+ connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
return 0;
-} /* }}} */
+}
+/* }}} */
/* {{{ php_oci_lob_close()
Close LOB */
int php_oci_lob_close (php_oci_descriptor *descriptor TSRMLS_DC)
{
php_oci_connection *connection = descriptor->connection;
-
+ sword errstatus;
+
if (descriptor->is_open) {
- PHP_OCI_CALL_RETURN(connection->errcode, OCILobClose, (connection->svc, connection->err, descriptor->descriptor));
- }
+ PHP_OCI_CALL_RETURN(errstatus, OCILobClose, (connection->svc, connection->err, descriptor->descriptor));
- if (connection->errcode != OCI_SUCCESS) {
- connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
- PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
- return 1;
+ if (errstatus != OCI_SUCCESS) {
+ connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
+ PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
+ return 1;
+ }
+ connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
}
if (php_oci_temp_lob_close(descriptor TSRMLS_CC)) {
@@ -595,7 +621,8 @@ int php_oci_lob_close (php_oci_descriptor *descriptor TSRMLS_DC)
}
return 0;
-} /* }}} */
+}
+/* }}} */
/* {{{ php_oci_temp_lob_close()
Close Temporary LOB */
@@ -603,27 +630,29 @@ int php_oci_temp_lob_close (php_oci_descriptor *descriptor TSRMLS_DC)
{
php_oci_connection *connection = descriptor->connection;
int is_temporary;
+ sword errstatus;
- PHP_OCI_CALL_RETURN(connection->errcode, OCILobIsTemporary, (connection->env,connection->err, descriptor->descriptor, &is_temporary));
+ PHP_OCI_CALL_RETURN(errstatus, OCILobIsTemporary, (connection->env,connection->err, descriptor->descriptor, &is_temporary));
- if (connection->errcode != OCI_SUCCESS) {
- connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
if (is_temporary) {
- PHP_OCI_CALL_RETURN(connection->errcode, OCILobFreeTemporary, (connection->svc, connection->err, descriptor->descriptor));
+ PHP_OCI_CALL_RETURN(errstatus, OCILobFreeTemporary, (connection->svc, connection->err, descriptor->descriptor));
- if (connection->errcode != OCI_SUCCESS) {
- connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
}
+ connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
return 0;
-} /* }}} */
-
+}
+/* }}} */
/* {{{ php_oci_lob_flush()
Flush buffers for the LOB (only if they have been used) */
@@ -631,7 +660,8 @@ int php_oci_lob_flush(php_oci_descriptor *descriptor, long flush_flag TSRMLS_DC)
{
OCILobLocator *lob = descriptor->descriptor;
php_oci_connection *connection = descriptor->connection;
-
+ sword errstatus;
+
if (!lob) {
return 1;
}
@@ -654,18 +684,20 @@ int php_oci_lob_flush(php_oci_descriptor *descriptor, long flush_flag TSRMLS_DC)
return 0;
}
- PHP_OCI_CALL_RETURN(connection->errcode, OCILobFlushBuffer, (connection->svc, connection->err, lob, flush_flag));
+ PHP_OCI_CALL_RETURN(errstatus, OCILobFlushBuffer, (connection->svc, connection->err, lob, flush_flag));
- if (connection->errcode != OCI_SUCCESS) {
- connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
/* marking buffer as enabled and not used */
descriptor->buffering = PHP_OCI_LOB_BUFFER_ENABLED;
+ connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
return 0;
-} /* }}} */
+}
+/* }}} */
/* {{{ php_oci_lob_free()
Close LOB descriptor and free associated resources */
@@ -709,9 +741,10 @@ void php_oci_lob_free (php_oci_descriptor *descriptor TSRMLS_DC)
PHP_OCI_CALL(OCIDescriptorFree, (descriptor->descriptor, descriptor->type));
- zend_list_delete(descriptor->connection->rsrc_id);
+ zend_list_delete(descriptor->connection->id);
efree(descriptor);
-} /* }}} */
+}
+/* }}} */
/* {{{ php_oci_lob_import()
Import LOB contents from the given file */
@@ -723,6 +756,7 @@ int php_oci_lob_import (php_oci_descriptor *descriptor, char *filename TSRMLS_DC
php_oci_connection *connection = descriptor->connection;
char buf[8192];
ub4 offset = 1;
+ sword errstatus;
#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 3) || (PHP_MAJOR_VERSION > 5)
/* Safe mode has been removed in PHP 5.4 */
@@ -739,7 +773,7 @@ int php_oci_lob_import (php_oci_descriptor *descriptor, char *filename TSRMLS_DC
}
while ((loblen = read(fp, &buf, sizeof(buf))) > 0) {
- PHP_OCI_CALL_RETURN(connection->errcode,
+ PHP_OCI_CALL_RETURN(errstatus,
OCILobWrite,
(
connection->svc,
@@ -757,18 +791,21 @@ int php_oci_lob_import (php_oci_descriptor *descriptor, char *filename TSRMLS_DC
)
);
- if (connection->errcode != OCI_SUCCESS) {
- connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
close(fp);
return 1;
+ } else {
+ connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
}
offset += loblen;
}
close(fp);
return 0;
-} /* }}} */
+}
+ /* }}} */
/* {{{ php_oci_lob_append()
Append data to the end of the LOB */
@@ -778,6 +815,7 @@ int php_oci_lob_append (php_oci_descriptor *descriptor_dest, php_oci_descriptor
OCILobLocator *lob_dest = descriptor_dest->descriptor;
OCILobLocator *lob_from = descriptor_from->descriptor;
ub4 dest_len, from_len;
+ sword errstatus;
if (php_oci_lob_get_length(descriptor_dest, &dest_len TSRMLS_CC)) {
return 1;
@@ -791,15 +829,17 @@ int php_oci_lob_append (php_oci_descriptor *descriptor_dest, php_oci_descriptor
return 0;
}
- PHP_OCI_CALL_RETURN(connection->errcode, OCILobAppend, (connection->svc, connection->err, lob_dest, lob_from));
+ PHP_OCI_CALL_RETURN(errstatus, OCILobAppend, (connection->svc, connection->err, lob_dest, lob_from));
- if (connection->errcode != OCI_SUCCESS) {
- connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
+ connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
return 0;
-} /* }}} */
+}
+/* }}} */
/* {{{ php_oci_lob_truncate()
Truncate LOB to the given length */
@@ -808,6 +848,7 @@ int php_oci_lob_truncate (php_oci_descriptor *descriptor, long new_lob_length TS
php_oci_connection *connection = descriptor->connection;
OCILobLocator *lob = descriptor->descriptor;
ub4 lob_length;
+ sword errstatus;
if (php_oci_lob_get_length(descriptor, &lob_length TSRMLS_CC)) {
return 1;
@@ -827,17 +868,20 @@ int php_oci_lob_truncate (php_oci_descriptor *descriptor, long new_lob_length TS
return 1;
}
- PHP_OCI_CALL_RETURN(connection->errcode, OCILobTrim, (connection->svc, connection->err, lob, new_lob_length));
+ PHP_OCI_CALL_RETURN(errstatus, OCILobTrim, (connection->svc, connection->err, lob, new_lob_length));
- if (connection->errcode != OCI_SUCCESS) {
- connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
descriptor->lob_size = new_lob_length;
+ connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
+
return 0;
-} /* }}} */
+}
+/* }}} */
/* {{{ php_oci_lob_erase()
Erase (or fill with whitespaces, depending on LOB type) the LOB (or its part) */
@@ -846,6 +890,7 @@ int php_oci_lob_erase (php_oci_descriptor *descriptor, long offset, ub4 length,
php_oci_connection *connection = descriptor->connection;
OCILobLocator *lob = descriptor->descriptor;
ub4 lob_length;
+ sword errstatus;
*bytes_erased = 0;
@@ -861,17 +906,19 @@ int php_oci_lob_erase (php_oci_descriptor *descriptor, long offset, ub4 length,
length = lob_length;
}
- PHP_OCI_CALL_RETURN(connection->errcode, OCILobErase, (connection->svc, connection->err, lob, (ub4 *)&length, offset+1));
+ PHP_OCI_CALL_RETURN(errstatus, OCILobErase, (connection->svc, connection->err, lob, (ub4 *)&length, offset+1));
- if (connection->errcode != OCI_SUCCESS) {
- connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
*bytes_erased = length;
+ connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
return 0;
-} /* }}} */
+}
+/* }}} */
/* {{{ php_oci_lob_is_equal()
Compare two LOB descriptors and figure out if they are pointing to the same LOB */
@@ -880,16 +927,19 @@ int php_oci_lob_is_equal (php_oci_descriptor *descriptor_first, php_oci_descript
php_oci_connection *connection = descriptor_first->connection;
OCILobLocator *first_lob = descriptor_first->descriptor;
OCILobLocator *second_lob = descriptor_second->descriptor;
+ sword errstatus;
- PHP_OCI_CALL_RETURN(connection->errcode, OCILobIsEqual, (connection->env, first_lob, second_lob, result));
+ PHP_OCI_CALL_RETURN(errstatus, OCILobIsEqual, (connection->env, first_lob, second_lob, result));
- if (connection->errcode) {
- connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ if (errstatus) {
+ connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
+ connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
return 0;
-} /* }}} */
+}
+/* }}} */
/* {{{ php_oci_lob_write_tmp()
Create temporary LOB and write data to it */
@@ -898,6 +948,7 @@ int php_oci_lob_write_tmp (php_oci_descriptor *descriptor, long type, char *data
php_oci_connection *connection = descriptor->connection;
OCILobLocator *lob = descriptor->descriptor;
ub4 bytes_written = 0;
+ sword errstatus;
switch (type) {
case OCI_TEMP_BLOB:
@@ -914,7 +965,7 @@ int php_oci_lob_write_tmp (php_oci_descriptor *descriptor, long type, char *data
return 1;
}
- PHP_OCI_CALL_RETURN(connection->errcode, OCILobCreateTemporary,
+ PHP_OCI_CALL_RETURN(errstatus, OCILobCreateTemporary,
(
connection->svc,
connection->err,
@@ -927,24 +978,26 @@ int php_oci_lob_write_tmp (php_oci_descriptor *descriptor, long type, char *data
)
);
- if (connection->errcode) {
- connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ if (errstatus) {
+ connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
- PHP_OCI_CALL_RETURN(connection->errcode, OCILobOpen, (connection->svc, connection->err, lob, OCI_LOB_READWRITE));
+ PHP_OCI_CALL_RETURN(errstatus, OCILobOpen, (connection->svc, connection->err, lob, OCI_LOB_READWRITE));
- if (connection->errcode) {
- connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ if (errstatus) {
+ connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
descriptor->is_open = 1;
+ connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
return php_oci_lob_write(descriptor, 0, data, data_len, &bytes_written TSRMLS_CC);
-} /* }}} */
+}
+/* }}} */
#endif /* HAVE_OCI8 */
diff --git a/ext/oci8/oci8_statement.c b/ext/oci8/oci8_statement.c
index 89facb0703..274c4e9e33 100644
--- a/ext/oci8/oci8_statement.c
+++ b/ext/oci8/oci8_statement.c
@@ -43,21 +43,30 @@
/* {{{ php_oci_statement_create()
Create statemend handle and allocate necessary resources */
-php_oci_statement *php_oci_statement_create (php_oci_connection *connection, char *query, int query_len TSRMLS_DC)
+php_oci_statement *php_oci_statement_create(php_oci_connection *connection, char *query, int query_len TSRMLS_DC)
{
php_oci_statement *statement;
-
+ sword errstatus;
+
+ connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
+
statement = ecalloc(1,sizeof(php_oci_statement));
if (!query_len) {
/* do not allocate stmt handle for refcursors, we'll get it from OCIStmtPrepare2() */
PHP_OCI_CALL(OCIHandleAlloc, (connection->env, (dvoid **)&(statement->stmt), OCI_HTYPE_STMT, 0, NULL));
+ } else {
+#ifdef HAVE_OCI8_DTRACE
+ if (DTRACE_OCI8_SQLTEXT_ENABLED()) {
+ DTRACE_OCI8_SQLTEXT(connection, query);
+ }
+#endif /* HAVE_OCI8_DTRACE */
}
PHP_OCI_CALL(OCIHandleAlloc, (connection->env, (dvoid **)&(statement->err), OCI_HTYPE_ERROR, 0, NULL));
if (query_len > 0) {
- PHP_OCI_CALL_RETURN(connection->errcode, OCIStmtPrepare2,
+ PHP_OCI_CALL_RETURN(errstatus, OCIStmtPrepare2,
(
connection->svc,
&(statement->stmt),
@@ -70,14 +79,13 @@ php_oci_statement *php_oci_statement_create (php_oci_connection *connection, cha
OCI_DEFAULT
)
);
- if (connection->errcode != OCI_SUCCESS) {
- connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
- PHP_OCI_CALL(OCIStmtRelease, (statement->stmt, statement->err, NULL, 0, statement->errcode ? OCI_STRLS_CACHE_DELETE : OCI_DEFAULT));
+ PHP_OCI_CALL(OCIStmtRelease, (statement->stmt, statement->err, NULL, 0, OCI_STRLS_CACHE_DELETE));
PHP_OCI_CALL(OCIHandleFree,(statement->err, OCI_HTYPE_ERROR));
-
- efree(statement);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
+ efree(statement);
return NULL;
}
}
@@ -95,10 +103,15 @@ php_oci_statement *php_oci_statement_create (php_oci_connection *connection, cha
statement->has_data = 0;
statement->has_descr = 0;
statement->parent_stmtid = 0;
- zend_list_addref(statement->connection->rsrc_id);
+ statement->impres_child_stmt = NULL;
+ statement->impres_count = 0;
+ statement->impres_flag = PHP_OCI_IMPRES_UNKNOWN; /* may or may not have Implicit Result Set children */
+ zend_list_addref(statement->connection->id);
if (OCI_G(default_prefetch) >= 0) {
- php_oci_statement_set_prefetch(statement, OCI_G(default_prefetch) TSRMLS_CC);
+ php_oci_statement_set_prefetch(statement, (ub4)OCI_G(default_prefetch) TSRMLS_CC);
+ } else {
+ php_oci_statement_set_prefetch(statement, (ub4)100 TSRMLS_CC); /* semi-arbitrary, "sensible default" */
}
PHP_OCI_REGISTER_RESOURCE(statement, le_statement);
@@ -109,25 +122,85 @@ php_oci_statement *php_oci_statement_create (php_oci_connection *connection, cha
}
/* }}} */
+/* {{{ php_oci_get_implicit_resultset()
+ Fetch implicit result set statement resource */
+php_oci_statement *php_oci_get_implicit_resultset(php_oci_statement *statement TSRMLS_DC)
+{
+#if (OCI_MAJOR_VERSION < 12)
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Implicit results are available in Oracle Database 12c onwards");
+ return NULL;
+#else
+ void *result;
+ ub4 rtype;
+ php_oci_statement *statement2; /* implicit result set statement handle */
+ sword errstatus;
+
+ PHP_OCI_CALL_RETURN(errstatus, OCIStmtGetNextResult, (statement->stmt, statement->err, &result, &rtype, OCI_DEFAULT));
+ if (errstatus == OCI_NO_DATA) {
+ return NULL;
+ }
+
+ if (rtype != OCI_RESULT_TYPE_SELECT) {
+ /* Only OCI_RESULT_TYPE_SELECT is supported by Oracle DB 12cR1 */
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unexpected implicit result type returned from Oracle Database");
+ return NULL;
+ } else {
+ statement2 = ecalloc(1,sizeof(php_oci_statement));
+
+ PHP_OCI_CALL(OCIHandleAlloc, (statement->connection->env, (dvoid **)&(statement2->err), OCI_HTYPE_ERROR, 0, NULL));
+ statement2->stmt = (OCIStmt *)result;
+ statement2->parent_stmtid = statement->id;
+ statement2->impres_child_stmt = NULL;
+ statement2->impres_count = 0;
+ statement2->impres_flag = PHP_OCI_IMPRES_IS_CHILD;
+ statement2->connection = statement->connection;
+ statement2->errcode = 0;
+ statement2->last_query = NULL;
+ statement2->last_query_len = 0;
+ statement2->columns = NULL;
+ statement2->binds = NULL;
+ statement2->defines = NULL;
+ statement2->ncolumns = 0;
+ statement2->executed = 0;
+ statement2->has_data = 0;
+ statement2->has_descr = 0;
+ statement2->stmttype = 0;
+
+ zend_list_addref(statement->id);
+ zend_list_addref(statement2->connection->id);
+
+ php_oci_statement_set_prefetch(statement2, statement->prefetch_count TSRMLS_CC);
+
+ PHP_OCI_REGISTER_RESOURCE(statement2, le_statement);
+
+ OCI_G(num_statements)++;
+
+ return statement2;
+ }
+#endif /* OCI_MAJOR_VERSION < 12 */
+}
+/* }}} */
+
/* {{{ php_oci_statement_set_prefetch()
- Set prefetch buffer size for the statement (we're assuming that one row is ~1K sized) */
-int php_oci_statement_set_prefetch(php_oci_statement *statement, long size TSRMLS_DC)
+ Set prefetch buffer size for the statement */
+int php_oci_statement_set_prefetch(php_oci_statement *statement, ub4 prefetch TSRMLS_DC)
{
- ub4 prefetch = size;
+ sword errstatus;
- if (size < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Number of rows to be prefetched has to be greater than or equal to 0");
- return 1;
+ if (prefetch > 20000) {
+ prefetch = 20000; /* keep it somewhat sane */
}
+
+ PHP_OCI_CALL_RETURN(errstatus, OCIAttrSet, (statement->stmt, OCI_HTYPE_STMT, &prefetch, 0, OCI_ATTR_PREFETCH_ROWS, statement->err));
- PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrSet, (statement->stmt, OCI_HTYPE_STMT, &prefetch, 0, OCI_ATTR_PREFETCH_ROWS, statement->err));
-
- if (statement->errcode != OCI_SUCCESS) {
- statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
+ statement->prefetch_count = 0;
return 1;
}
-
+ statement->prefetch_count = prefetch;
+ statement->errcode = 0; /* retain backwards compat with OCI8 1.4 */
return 0;
}
/* }}} */
@@ -163,8 +236,8 @@ int php_oci_cleanup_pre_fetch(void *data TSRMLS_DC)
}
return ZEND_HASH_APPLY_KEEP;
-} /* }}} */
-
+}
+/* }}} */
/* {{{ php_oci_statement_fetch()
Fetch a row from the statement */
@@ -175,16 +248,18 @@ int php_oci_statement_fetch(php_oci_statement *statement, ub4 nrows TSRMLS_DC)
ub4 typep, iterp, idxp;
ub1 in_outp, piecep;
zend_bool piecewisecols = 0;
-
php_oci_out_column *column;
+ sword errstatus;
+
+ statement->errcode = 0; /* retain backwards compat with OCI8 1.4 */
if (statement->has_descr && statement->columns) {
zend_hash_apply(statement->columns, (apply_func_t) php_oci_cleanup_pre_fetch TSRMLS_CC);
}
- PHP_OCI_CALL_RETURN(statement->errcode, OCIStmtFetch, (statement->stmt, statement->err, nrows, OCI_FETCH_NEXT, OCI_DEFAULT));
+ PHP_OCI_CALL_RETURN(errstatus, OCIStmtFetch, (statement->stmt, statement->err, nrows, OCI_FETCH_NEXT, OCI_DEFAULT));
- if ( statement->errcode == OCI_NO_DATA || nrows == 0 ) {
+ if (errstatus == OCI_NO_DATA || nrows == 0) {
if (statement->last_query == NULL) {
/* reset define-list for refcursors */
if (statement->columns) {
@@ -196,7 +271,6 @@ int php_oci_statement_fetch(php_oci_statement *statement, ub4 nrows TSRMLS_DC)
statement->executed = 0;
}
- statement->errcode = 0; /* OCI_NO_DATA is NO error for us!!! */
statement->has_data = 0;
if (nrows == 0) {
@@ -209,15 +283,15 @@ int php_oci_statement_fetch(php_oci_statement *statement, ub4 nrows TSRMLS_DC)
/* reset length for all piecewise columns */
for (i = 0; i < statement->ncolumns; i++) {
column = php_oci_statement_get_column(statement, i + 1, NULL, 0 TSRMLS_CC);
- if (column->piecewise) {
+ if (column && column->piecewise) {
column->retlen4 = 0;
piecewisecols = 1;
}
}
- while (statement->errcode == OCI_NEED_DATA) {
+ while (errstatus == OCI_NEED_DATA) {
if (piecewisecols) {
- PHP_OCI_CALL_RETURN(statement->errcode,
+ PHP_OCI_CALL_RETURN(errstatus,
OCIStmtGetPieceInfo,
(
statement->stmt,
@@ -234,7 +308,7 @@ int php_oci_statement_fetch(php_oci_statement *statement, ub4 nrows TSRMLS_DC)
/* scan through our columns for a piecewise column with a matching handle */
for (i = 0; i < statement->ncolumns; i++) {
column = php_oci_statement_get_column(statement, i + 1, NULL, 0 TSRMLS_CC);
- if (column->piecewise && handlepp == column->oci_define) {
+ if (column && column->piecewise && handlepp == column->oci_define) {
if (!column->data) {
column->data = (text *) ecalloc(1, PHP_OCI_PIECE_SIZE + 1);
} else {
@@ -259,7 +333,7 @@ int php_oci_statement_fetch(php_oci_statement *statement, ub4 nrows TSRMLS_DC)
}
}
- PHP_OCI_CALL_RETURN(statement->errcode, OCIStmtFetch, (statement->stmt, statement->err, nrows, OCI_FETCH_NEXT, OCI_DEFAULT));
+ PHP_OCI_CALL_RETURN(errstatus, OCIStmtFetch, (statement->stmt, statement->err, nrows, OCI_FETCH_NEXT, OCI_DEFAULT));
if (piecewisecols) {
for (i = 0; i < statement->ncolumns; i++) {
@@ -271,7 +345,7 @@ int php_oci_statement_fetch(php_oci_statement *statement, ub4 nrows TSRMLS_DC)
}
}
- if (statement->errcode == OCI_SUCCESS_WITH_INFO || statement->errcode == OCI_SUCCESS) {
+ if (errstatus == OCI_SUCCESS_WITH_INFO || errstatus == OCI_SUCCESS) {
statement->has_data = 1;
/* do the stuff needed for OCIDefineByName */
@@ -292,7 +366,7 @@ int php_oci_statement_fetch(php_oci_statement *statement, ub4 nrows TSRMLS_DC)
return 0;
}
- statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC);
+ statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
statement->has_data = 0;
@@ -332,7 +406,7 @@ php_oci_out_column *php_oci_statement_get_column(php_oci_statement *statement, l
}
/* }}} */
-/* php_oci_define_callback() {{{ */
+/* {{{ php_oci_define_callback() */
sb4 php_oci_define_callback(dvoid *ctx, OCIDefine *define, ub4 iter, dvoid **bufpp, ub4 **alenpp, ub1 *piecep, dvoid **indpp, ub2 **rcpp)
{
php_oci_out_column *outcol = (php_oci_out_column *)ctx;
@@ -415,12 +489,18 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
ub4 colcount;
ub2 dynamic;
dvoid *buf;
+ sword errstatus;
switch (mode) {
case OCI_COMMIT_ON_SUCCESS:
case OCI_DESCRIBE_ONLY:
case OCI_DEFAULT:
/* only these are allowed */
+#ifdef HAVE_OCI8_DTRACE
+ if (DTRACE_OCI8_EXECUTE_MODE_ENABLED()) {
+ DTRACE_OCI8_EXECUTE_MODE(statement->connection, mode);
+ }
+#endif /* HAVE_OCI8_DTRACE */
break;
default:
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid execute mode given: %d", mode);
@@ -430,12 +510,14 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
if (!statement->stmttype) {
/* get statement type */
- PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (ub2 *)&statement->stmttype, (ub4 *)0, OCI_ATTR_STMT_TYPE, statement->err));
+ PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (ub2 *)&statement->stmttype, (ub4 *)0, OCI_ATTR_STMT_TYPE, statement->err));
- if (statement->errcode != OCI_SUCCESS) {
- statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
return 1;
+ } else {
+ statement->errcode = 0; /* retain backwards compat with OCI8 1.4 */
}
}
@@ -445,9 +527,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
iters = 1;
}
- if (statement->last_query) {
- /* if we execute refcursors we don't have a query and
- we don't want to execute!!! */
+ if (statement->last_query) { /* Don't execute REFCURSORS or Implicit Result Set handles */
if (statement->binds) {
int result = 0;
@@ -458,10 +538,10 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
}
/* execute statement */
- PHP_OCI_CALL_RETURN(statement->errcode, OCIStmtExecute, (statement->connection->svc, statement->stmt, statement->err, iters, 0, NULL, NULL, mode));
+ PHP_OCI_CALL_RETURN(errstatus, OCIStmtExecute, (statement->connection->svc, statement->stmt, statement->err, iters, 0, NULL, NULL, mode));
- if (statement->errcode != OCI_SUCCESS) {
- statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
return 1;
}
@@ -471,10 +551,20 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
}
if (mode & OCI_COMMIT_ON_SUCCESS) {
- statement->connection->needs_commit = 0;
- } else {
- statement->connection->needs_commit = 1;
+ /* No need to rollback on disconnect */
+ statement->connection->rb_on_disconnect = 0;
+ } else if (statement->stmttype != OCI_STMT_SELECT) {
+ /* Assume some uncommitted DML occurred */
+ statement->connection->rb_on_disconnect = 1;
}
+ /* else for SELECT with OCI_NO_AUTO_COMMIT, leave
+ * "rb_on_disconnect" at its previous value. SELECT can't
+ * initiate uncommitted DML. (An AUTONOMOUS_TRANSACTION in
+ * invoked PL/SQL must explicitly rollback/commit else the
+ * SELECT fails).
+ */
+
+ statement->errcode = 0; /* retain backwards compat with OCI8 1.4 */
}
if (statement->stmttype == OCI_STMT_SELECT && statement->executed == 0) {
@@ -487,10 +577,10 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
counter = 1;
/* get number of columns */
- PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (dvoid *)&colcount, (ub4 *)0, OCI_ATTR_PARAM_COUNT, statement->err));
+ PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (dvoid *)&colcount, (ub4 *)0, OCI_ATTR_PARAM_COUNT, statement->err));
- if (statement->errcode != OCI_SUCCESS) {
- statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
return 1;
}
@@ -507,50 +597,50 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
}
/* get column */
- PHP_OCI_CALL_RETURN(statement->errcode, OCIParamGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, statement->err, (dvoid**)&param, counter));
+ PHP_OCI_CALL_RETURN(errstatus, OCIParamGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, statement->err, (dvoid**)&param, counter));
- if (statement->errcode != OCI_SUCCESS) {
- statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
return 1;
}
/* get column datatype */
- PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->data_type, (ub4 *)0, OCI_ATTR_DATA_TYPE, statement->err));
+ PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->data_type, (ub4 *)0, OCI_ATTR_DATA_TYPE, statement->err));
- if (statement->errcode != OCI_SUCCESS) {
+ if (errstatus != OCI_SUCCESS) {
PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM));
- statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC);
+ statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
return 1;
}
/* get character set form */
- PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->charset_form, (ub4 *)0, OCI_ATTR_CHARSET_FORM, statement->err));
+ PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->charset_form, (ub4 *)0, OCI_ATTR_CHARSET_FORM, statement->err));
- if (statement->errcode != OCI_SUCCESS) {
+ if (errstatus != OCI_SUCCESS) {
PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM));
- statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC);
+ statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
return 1;
}
/* get character set id */
- PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->charset_id, (ub4 *)0, OCI_ATTR_CHARSET_ID, statement->err));
+ PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->charset_id, (ub4 *)0, OCI_ATTR_CHARSET_ID, statement->err));
- if (statement->errcode != OCI_SUCCESS) {
+ if (errstatus != OCI_SUCCESS) {
PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM));
- statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC);
+ statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
return 1;
}
/* get size of the column */
- PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->data_size, (dvoid *)0, OCI_ATTR_DATA_SIZE, statement->err));
+ PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->data_size, (dvoid *)0, OCI_ATTR_DATA_SIZE, statement->err));
- if (statement->errcode != OCI_SUCCESS) {
+ if (errstatus != OCI_SUCCESS) {
PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM));
- statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC);
+ statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
return 1;
}
@@ -559,31 +649,31 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
outcol->retlen = outcol->data_size;
/* get scale of the column */
- PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->scale, (dvoid *)0, OCI_ATTR_SCALE, statement->err));
+ PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->scale, (dvoid *)0, OCI_ATTR_SCALE, statement->err));
- if (statement->errcode != OCI_SUCCESS) {
+ if (errstatus != OCI_SUCCESS) {
PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM));
- statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC);
+ statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
return 1;
}
/* get precision of the column */
- PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->precision, (dvoid *)0, OCI_ATTR_PRECISION, statement->err));
+ PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->precision, (dvoid *)0, OCI_ATTR_PRECISION, statement->err));
- if (statement->errcode != OCI_SUCCESS) {
+ if (errstatus != OCI_SUCCESS) {
PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM));
- statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC);
+ statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
return 1;
}
/* get name of the column */
- PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid **)&colname, (ub4 *)&outcol->name_len, (ub4)OCI_ATTR_NAME, statement->err));
+ PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid **)&colname, (ub4 *)&outcol->name_len, (ub4)OCI_ATTR_NAME, statement->err));
- if (statement->errcode != OCI_SUCCESS) {
+ if (errstatus != OCI_SUCCESS) {
PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM));
- statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC);
+ statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
return 1;
}
@@ -591,7 +681,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
outcol->name = estrndup((char*) colname, outcol->name_len);
- /* find a user-setted define */
+ /* find a user-set define */
if (statement->defines) {
if (zend_hash_find(statement->defines,outcol->name,outcol->name_len,(void **) &outcol->define) == SUCCESS) {
if (outcol->define->type) {
@@ -679,7 +769,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
}
if (dynamic == OCI_DYNAMIC_FETCH) {
- PHP_OCI_CALL_RETURN(statement->errcode,
+ PHP_OCI_CALL_RETURN(errstatus,
OCIDefineByPos,
(
statement->stmt, /* IN/OUT handle to the requested SQL query */
@@ -697,7 +787,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
);
} else {
- PHP_OCI_CALL_RETURN(statement->errcode,
+ PHP_OCI_CALL_RETURN(errstatus,
OCIDefineByPos,
(
statement->stmt, /* IN/OUT handle to the requested SQL query */
@@ -716,10 +806,10 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
}
- if (statement->errcode != OCI_SUCCESS) {
- statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
- return 0;
+ return 1;
}
/* additional OCIDefineDynamic() call */
@@ -729,7 +819,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
case SQLT_BLOB:
case SQLT_CLOB:
case SQLT_BFILE:
- PHP_OCI_CALL_RETURN(statement->errcode,
+ PHP_OCI_CALL_RETURN(errstatus,
OCIDefineDynamic,
(
outcol->oci_define,
@@ -739,9 +829,15 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
)
);
+ if (errstatus != OCI_SUCCESS) {
+ statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC);
+ PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
+ return 1;
+ }
break;
}
}
+ statement->errcode = 0; /* retain backwards compat with OCI8 1.4 */
}
return 0;
@@ -752,10 +848,9 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
Cancel statement */
int php_oci_statement_cancel(php_oci_statement *statement TSRMLS_DC)
{
-
return php_oci_statement_fetch(statement, 0 TSRMLS_CC);
-
-} /* }}} */
+}
+/* }}} */
/* {{{ php_oci_statement_free()
Destroy statement handle and free associated resources */
@@ -764,15 +859,15 @@ void php_oci_statement_free(php_oci_statement *statement TSRMLS_DC)
if (statement->stmt) {
if (statement->last_query_len) { /* FIXME: magical */
PHP_OCI_CALL(OCIStmtRelease, (statement->stmt, statement->err, NULL, 0, statement->errcode ? OCI_STRLS_CACHE_DELETE : OCI_DEFAULT));
- } else {
+ } else if (statement->impres_flag != PHP_OCI_IMPRES_IS_CHILD) { /* Oracle doc says don't free Implicit Result Set handles */
PHP_OCI_CALL(OCIHandleFree, (statement->stmt, OCI_HTYPE_STMT));
}
- statement->stmt = 0;
+ statement->stmt = NULL;
}
if (statement->err) {
PHP_OCI_CALL(OCIHandleFree, (statement->err, OCI_HTYPE_ERROR));
- statement->err = 0;
+ statement->err = NULL;
}
if (statement->last_query) {
@@ -798,11 +893,12 @@ void php_oci_statement_free(php_oci_statement *statement TSRMLS_DC)
zend_list_delete(statement->parent_stmtid);
}
- zend_list_delete(statement->connection->rsrc_id);
+ zend_list_delete(statement->connection->id);
efree(statement);
OCI_G(num_statements)--;
-} /* }}} */
+}
+/* }}} */
/* {{{ php_oci_bind_pre_exec()
Helper function */
@@ -872,6 +968,7 @@ int php_oci_bind_post_exec(void *data TSRMLS_DC)
{
php_oci_bind *bind = (php_oci_bind *) data;
php_oci_connection *connection = bind->parent_statement->connection;
+ sword errstatus;
if (bind->indicator == -1) { /* NULL */
zval *val = bind->zval;
@@ -931,24 +1028,26 @@ int php_oci_bind_post_exec(void *data TSRMLS_DC)
memset((void*)buff,0,sizeof(buff));
if ((i < bind->array.old_length) && (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE)) {
- PHP_OCI_CALL_RETURN(connection->errcode, OCIDateToText, (connection->err, &(((OCIDate *)(bind->array.elements))[i]), 0, 0, 0, 0, &buff_len, buff));
+ PHP_OCI_CALL_RETURN(errstatus, OCIDateToText, (connection->err, &(((OCIDate *)(bind->array.elements))[i]), 0, 0, 0, 0, &buff_len, buff));
zval_dtor(*entry);
- if (connection->errcode != OCI_SUCCESS) {
- connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
ZVAL_NULL(*entry);
} else {
+ connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
ZVAL_STRINGL(*entry, (char *)buff, buff_len, 1);
}
zend_hash_move_forward(hash);
} else {
- PHP_OCI_CALL_RETURN(connection->errcode, OCIDateToText, (connection->err, &(((OCIDate *)(bind->array.elements))[i]), 0, 0, 0, 0, &buff_len, buff));
- if (connection->errcode != OCI_SUCCESS) {
- connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ PHP_OCI_CALL_RETURN(errstatus, OCIDateToText, (connection->err, &(((OCIDate *)(bind->array.elements))[i]), 0, 0, 0, 0, &buff_len, buff));
+ if (errstatus != OCI_SUCCESS) {
+ connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
add_next_index_null(bind->zval);
} else {
+ connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
add_next_index_stringl(bind->zval, (char *)buff, buff_len, 1);
}
}
@@ -982,7 +1081,7 @@ int php_oci_bind_post_exec(void *data TSRMLS_DC)
/* {{{ php_oci_bind_by_name()
Bind zval to the given placeholder */
-int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len, zval* var, long maxlength, ub2 type TSRMLS_DC)
+int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len, zval *var, long maxlength, ub2 type TSRMLS_DC)
{
php_oci_collection *bind_collection = NULL;
php_oci_descriptor *bind_descriptor = NULL;
@@ -994,6 +1093,7 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len,
php_oci_bind bind, *old_bind, *bindp;
int mode = OCI_DATA_AT_EXEC;
sb4 value_sz = -1;
+ sword errstatus;
switch (type) {
case SQLT_NTY:
@@ -1117,7 +1217,7 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len,
bindp->type = type;
zval_add_ref(&var);
- PHP_OCI_CALL_RETURN(statement->errcode,
+ PHP_OCI_CALL_RETURN(errstatus,
OCIBindByName,
(
statement->stmt, /* statement handle */
@@ -1137,14 +1237,14 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len,
)
);
- if (statement->errcode != OCI_SUCCESS) {
- statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
return 1;
}
if (mode == OCI_DATA_AT_EXEC) {
- PHP_OCI_CALL_RETURN(statement->errcode, OCIBindDynamic,
+ PHP_OCI_CALL_RETURN(errstatus, OCIBindDynamic,
(
bindp->bind,
statement->err,
@@ -1155,8 +1255,8 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len,
)
);
- if (statement->errcode != OCI_SUCCESS) {
- statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
return 1;
}
@@ -1164,7 +1264,7 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len,
if (type == SQLT_NTY) {
/* Bind object */
- PHP_OCI_CALL_RETURN(statement->errcode, OCIBindObject,
+ PHP_OCI_CALL_RETURN(errstatus, OCIBindObject,
(
bindp->bind,
statement->err,
@@ -1176,15 +1276,17 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len,
)
);
- if (statement->errcode) {
- statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC);
+ if (errstatus) {
+ statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
return 1;
}
}
+ statement->errcode = 0; /* retain backwards compat with OCI8 1.4 */
return 0;
-} /* }}} */
+}
+/* }}} */
/* {{{ php_oci_bind_in_callback()
Callback used when binding LOBs and VARCHARs */
@@ -1235,7 +1337,8 @@ sb4 php_oci_bind_in_callback(
*piecep = OCI_ONE_PIECE; /* pass all data in one go */
return OCI_CONTINUE;
-}/* }}} */
+}
+/* }}} */
/* {{{ php_oci_bind_out_callback()
Callback used when binding LOBs and VARCHARs */
@@ -1358,55 +1461,61 @@ php_oci_out_column *php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAME
zval_dtor(&tmp);
}
return column;
-} /* }}} */
+}
+/* }}} */
/* {{{ php_oci_statement_get_type()
Return type of the statement */
int php_oci_statement_get_type(php_oci_statement *statement, ub2 *type TSRMLS_DC)
{
ub2 statement_type;
+ sword errstatus;
*type = 0;
- PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (ub2 *)&statement_type, (ub4 *)0, OCI_ATTR_STMT_TYPE, statement->err));
+ PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (ub2 *)&statement_type, (ub4 *)0, OCI_ATTR_STMT_TYPE, statement->err));
- if (statement->errcode != OCI_SUCCESS) {
- statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
return 1;
}
-
+ statement->errcode = 0; /* retain backwards compat with OCI8 1.4 */
*type = statement_type;
return 0;
-} /* }}} */
+}
+/* }}} */
/* {{{ php_oci_statement_get_numrows()
Get the number of rows fetched to the clientside (NOT the number of rows in the result set) */
int php_oci_statement_get_numrows(php_oci_statement *statement, ub4 *numrows TSRMLS_DC)
{
ub4 statement_numrows;
+ sword errstatus;
*numrows = 0;
- PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (ub4 *)&statement_numrows, (ub4 *)0, OCI_ATTR_ROW_COUNT, statement->err));
+ PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (ub4 *)&statement_numrows, (ub4 *)0, OCI_ATTR_ROW_COUNT, statement->err));
- if (statement->errcode != OCI_SUCCESS) {
- statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC);
+ if (errstatus != OCI_SUCCESS) {
+ statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
return 1;
}
-
+ statement->errcode = 0; /* retain backwards compat with OCI8 1.4 */
*numrows = statement_numrows;
return 0;
-} /* }}} */
+}
+/* }}} */
/* {{{ php_oci_bind_array_by_name()
Bind arrays to PL/SQL types */
-int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, int name_len, zval* var, long max_table_length, long maxlength, long type TSRMLS_DC)
+int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, int name_len, zval *var, long max_table_length, long maxlength, long type TSRMLS_DC)
{
php_oci_bind *bind, *bindp;
+ sword errstatus;
convert_to_array(var);
@@ -1470,7 +1579,7 @@ int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, int nam
zval_add_ref(&var);
- PHP_OCI_CALL_RETURN(statement->errcode,
+ PHP_OCI_CALL_RETURN(errstatus,
OCIBindByName,
(
statement->stmt,
@@ -1491,19 +1600,21 @@ int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, int nam
);
- if (statement->errcode != OCI_SUCCESS) {
+ if (errstatus != OCI_SUCCESS) {
efree(bind);
- statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC);
+ statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
return 1;
}
+ statement->errcode = 0; /* retain backwards compat with OCI8 1.4 */
efree(bind);
return 0;
-} /* }}} */
+}
+/* }}} */
/* {{{ php_oci_bind_array_helper_string()
Bind arrays to PL/SQL types */
-php_oci_bind *php_oci_bind_array_helper_string(zval* var, long max_table_length, long maxlength TSRMLS_DC)
+php_oci_bind *php_oci_bind_array_helper_string(zval *var, long max_table_length, long maxlength TSRMLS_DC)
{
php_oci_bind *bind;
ub4 i;
@@ -1568,11 +1679,12 @@ php_oci_bind *php_oci_bind_array_helper_string(zval* var, long max_table_length,
zend_hash_internal_pointer_reset(hash);
return bind;
-} /* }}} */
+}
+/* }}} */
/* {{{ php_oci_bind_array_helper_number()
Bind arrays to PL/SQL types */
-php_oci_bind *php_oci_bind_array_helper_number(zval* var, long max_table_length TSRMLS_DC)
+php_oci_bind *php_oci_bind_array_helper_number(zval *var, long max_table_length TSRMLS_DC)
{
php_oci_bind *bind;
ub4 i;
@@ -1606,11 +1718,12 @@ php_oci_bind *php_oci_bind_array_helper_number(zval* var, long max_table_length
zend_hash_internal_pointer_reset(hash);
return bind;
-} /* }}} */
+}
+/* }}} */
/* {{{ php_oci_bind_array_helper_double()
Bind arrays to PL/SQL types */
-php_oci_bind *php_oci_bind_array_helper_double(zval* var, long max_table_length TSRMLS_DC)
+php_oci_bind *php_oci_bind_array_helper_double(zval *var, long max_table_length TSRMLS_DC)
{
php_oci_bind *bind;
ub4 i;
@@ -1644,16 +1757,18 @@ php_oci_bind *php_oci_bind_array_helper_double(zval* var, long max_table_length
zend_hash_internal_pointer_reset(hash);
return bind;
-} /* }}} */
+}
+/* }}} */
/* {{{ php_oci_bind_array_helper_date()
Bind arrays to PL/SQL types */
-php_oci_bind *php_oci_bind_array_helper_date(zval* var, long max_table_length, php_oci_connection *connection TSRMLS_DC)
+php_oci_bind *php_oci_bind_array_helper_date(zval *var, long max_table_length, php_oci_connection *connection TSRMLS_DC)
{
php_oci_bind *bind;
ub4 i;
HashTable *hash;
zval **entry;
+ sword errstatus;
hash = HASH_OF(var);
@@ -1675,14 +1790,14 @@ php_oci_bind *php_oci_bind_array_helper_date(zval* var, long max_table_length, p
if ((i < bind->array.current_length) && (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE)) {
convert_to_string_ex(entry);
- PHP_OCI_CALL_RETURN(connection->errcode, OCIDateFromText, (connection->err, (CONST text *)Z_STRVAL_PP(entry), Z_STRLEN_PP(entry), NULL, 0, NULL, 0, &oci_date));
+ PHP_OCI_CALL_RETURN(errstatus, OCIDateFromText, (connection->err, (CONST text *)Z_STRVAL_PP(entry), Z_STRLEN_PP(entry), NULL, 0, NULL, 0, &oci_date));
- if (connection->errcode != OCI_SUCCESS) {
+ if (errstatus != OCI_SUCCESS) {
/* failed to convert string to date */
efree(bind->array.element_lengths);
efree(bind->array.elements);
efree(bind);
- connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return NULL;
}
@@ -1690,25 +1805,27 @@ php_oci_bind *php_oci_bind_array_helper_date(zval* var, long max_table_length, p
((OCIDate *)bind->array.elements)[i] = oci_date;
zend_hash_move_forward(hash);
} else {
- PHP_OCI_CALL_RETURN(connection->errcode, OCIDateFromText, (connection->err, (CONST text *)"01-JAN-00", sizeof("01-JAN-00")-1, NULL, 0, NULL, 0, &oci_date));
+ PHP_OCI_CALL_RETURN(errstatus, OCIDateFromText, (connection->err, (CONST text *)"01-JAN-00", sizeof("01-JAN-00")-1, NULL, 0, NULL, 0, &oci_date));
- if (connection->errcode != OCI_SUCCESS) {
+ if (errstatus != OCI_SUCCESS) {
/* failed to convert string to date */
efree(bind->array.element_lengths);
efree(bind->array.elements);
efree(bind);
- connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return NULL;
}
((OCIDate *)bind->array.elements)[i] = oci_date;
}
+ connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
}
zend_hash_internal_pointer_reset(hash);
return bind;
-} /* }}} */
+}
+/* }}} */
#endif /* HAVE_OCI8 */
diff --git a/ext/oci8/package.xml b/ext/oci8/package.xml
index feadf1907b..fcab20cc45 100644
--- a/ext/oci8/package.xml
+++ b/ext/oci8/package.xml
@@ -6,7 +6,14 @@ http://pear.php.net/dtd/package-2.0.xsd">
<name>oci8</name>
<channel>pecl.php.net</channel>
<summary>Extension for Oracle Database</summary>
- <description>This extension allows you to access Oracle databases. It can be built with PHP 4.3.9 to 5.x. It can be linked with Oracle 9.2, 10, 11, or 12.1 client libraries.
+
+ <description>
+ This extension allows you to access Oracle Database. OCI8 2.0 can
+ be built with PHP 4.3.9 onwards. OCI8 can be linked with Oracle
+ Database 9.2, 10, 11, or 12.1 client libraries. Oracle's standard
+ cross-version connectivity applies. For example PHP linked with
+ Oracle Database 11.2 client libraries can connect to Oracle
+ Database 9.2 onwards.
</description>
<lead>
<name>Christopher Jones</name>
@@ -18,7 +25,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
<name>Antony Dovgal</name>
<user>tony2001</user>
<email>tony2001@php.net</email>
- <active>yes</active>
+ <active>no</active>
</lead>
<lead>
<name>Wez Furlong</name>
@@ -33,21 +40,24 @@ http://pear.php.net/dtd/package-2.0.xsd">
<active>no</active>
</lead>
- <date>2013-07-08</date>
+ <date>2013-09-06</date>
<time>12:00:00</time>
- <version>
- <release>1.4.10</release>
- <api>1.4.10</api>
- </version>
- <stability>
- <release>stable</release>
- <api>stable</api>
- </stability>
- <license uri="http://www.php.net/license">PHP</license>
- <notes>
- Bump PECL package info version check to allow PECL installs with PHP 5.5+
- </notes>
+ <version>
+ <release>2.0.2</release>
+ <api>2.0.2</api>
+ </version>
+ <stability>
+ <release>devel</release>
+ <api>devel</api>
+ </stability>
+ <license uri="http://www.php.net/license">PHP</license>
+ <notes>
+Review and improve error handling code and data types.
+Fix oci_set_*($connection, ...) error handling so oci_error($connection) works.
+Add DTrace oci8-connection-close probe
+Add the connection handle to several DTrace probes.
+ </notes>
<contents>
<dir name="/">
<dir name="tests">
@@ -94,6 +104,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
<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_2.phpt" role="test" />
<file name="bind_raw.phpt" role="test" />
<file name="bind_rowid.phpt" role="test" />
<file name="bind_sqltafc.phpt" role="test" />
@@ -287,6 +298,38 @@ http://pear.php.net/dtd/package-2.0.xsd">
<file name="field_funcs_old.phpt" role="test" />
<file name="field_funcs.phpt" role="test" />
<file name="function_aliases.phpt" role="test" />
+ <file name="imp_res_1.phpt" role="test" />
+ <file name="imp_res_2.phpt" role="test" />
+ <file name="imp_res_3.phpt" role="test" />
+ <file name="imp_res_4.phpt" role="test" />
+ <file name="imp_res_5.phpt" role="test" />
+ <file name="imp_res_6.phpt" role="test" />
+ <file name="imp_res_7.phpt" role="test" />
+ <file name="imp_res_call_error.phpt" role="test" />
+ <file name="imp_res_cancel.phpt" role="test" />
+ <file name="imp_res_close.phpt" role="test" />
+ <file name="imp_res_cursor.phpt" role="test" />
+ <file name="imp_res_dbmsoutput.phpt" role="test" />
+ <file name="imp_res_field.phpt" role="test" />
+ <file name="imp_res_func_error.phpt" role="test" />
+ <file name="imp_res_get_1.phpt" role="test" />
+ <file name="imp_res_get_2.phpt" role="test" />
+ <file name="imp_res_get_3.phpt" role="test" />
+ <file name="imp_res_get_4.phpt" role="test" />
+ <file name="imp_res_get_5.phpt" role="test" />
+ <file name="imp_res_get_all.phpt" role="test" />
+ <file name="imp_res_get_cancel.phpt" role="test" />
+ <file name="imp_res_get_close_1.phpt" role="test" />
+ <file name="imp_res_get_close_2.phpt" role="test" />
+ <file name="imp_res_get_close_3.phpt" role="test" />
+ <file name="imp_res_get_cursor.phpt" role="test" />
+ <file name="imp_res_get_dbmsoutput.phpt" role="test" />
+ <file name="imp_res_get_exec.phpt" role="test" />
+ <file name="imp_res_get_none.phpt" role="test" />
+ <file name="imp_res_insert.phpt" role="test" />
+ <file name="imp_res_lob.phpt" role="test" />
+ <file name="imp_res_prefetch.phpt" role="test" />
+ <file name="ini_1.phpt" role="test" />
<file name="lob_001.phpt" role="test" />
<file name="lob_002.phpt" role="test" />
<file name="lob_003.phpt" role="test" />
@@ -335,6 +378,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
<file name="lob_aliases.phpt" role="test" />
<file name="lob_null.phpt" role="test" />
<file name="lob_temp1.phpt" role="test" />
+ <file name="lob_temp2.phpt" role="test" />
<file name="lob_temp.phpt" role="test" />
<file name="minfo.phpt" role="test" />
<file name="null_byte_1.phpt" role="test" />
@@ -383,13 +427,14 @@ http://pear.php.net/dtd/package-2.0.xsd">
<file name="config.w32" role="src" />
<file name="CREDITS" role="doc" />
<file name="oci8.c" role="src" />
- <file name="oci8.dsp" role="src" />
+ <file name="oci8_dtrace.d" role="src" />
<file name="oci8_collection.c" role="src" />
<file name="oci8_interface.c" role="src" />
<file name="oci8_lob.c" role="src" />
<file name="oci8_statement.c" role="src" />
<file name="php_oci8.h" role="src" />
<file name="php_oci8_int.h" role="src" />
+ <file name="oci8.dsp" role="src" />
<file name="README" role="doc" />
</dir> <!-- / -->
</contents>
@@ -411,6 +456,116 @@ http://pear.php.net/dtd/package-2.0.xsd">
<changelog>
<release>
+ <version>
+ <release>2.0.1</release>
+ <api>2.0.1</api>
+ </version>
+ <stability>
+ <release>devel</release>
+ <api>devel</api>
+ </stability>
+ <license uri="http://www.php.net/license">PHP</license>
+ <notes>
+Fixed --enable-maintainer-zts mode.
+Allow Implicit Result Set statement resources to inherit the parent's current prefetch count.
+Allow OCI8 to be DTrace-enabled independently from core PHP.
+Require OCI8 to be configured 'shared' when enabling DTrace support.
+ </notes>
+</release>
+
+<release>
+ <version>
+ <release>2.0.0</release>
+ <api>2.0.0</api>
+ </version>
+ <stability>
+ <release>devel</release>
+ <api>devel</api>
+ </stability>
+ <license uri="http://www.php.net/license">PHP</license>
+ <notes>
+- NEW FUNCTIONALITY:
+
+ - Added Implicit Result Set support for Oracle Database 12c.
+ Streaming of all IRS's returned from a PL/SQL block is available
+ via oci_fetch_array, oci_fetch_assoc, oci_fetch_object and
+ oci_fetch_row (but not oci_fetch or oci_fetch_all).
+ Alternatively individual IRS statement resources can be obtained
+ with the new function 'oci_get_implicit_resultset' and passed to
+ any oci_fetch_* function.
+
+ - Added DTrace probes enabled with PHP's generic --enable-dtrace
+
+- IMPROVED FUNCTIONALITY:
+
+ - Using 'oci_execute($s, OCI_NO_AUTO_COMMIT)' for a SELECT no
+ longer unnecessarily initiates an internal ROLLBACK during
+ connection close. This can improve overall scalability by
+ reducing "round trips" between PHP and the database.
+
+- CHANGED FUNCTIONALITY:
+
+ - PHPINFO() CHANGES:
+
+ - The oci8.event and oci8.connection_class values are now shown
+ only when the Oracle client libraries support the respective
+ functionality.
+
+ - Connection statistics are now in a separate phpinfo() table.
+
+ - Temporary LOB and Collection support status lines in
+ phpinfo() were removed. These features have always been
+ enabled since 2007.
+
+ - OCI_INTERNAL_DEBUG() CHANGES:
+
+ - The oci_internal_debug() function is now a no-op. Use PHP's
+ --enable-dtrace functionality with DTrace or SystemTap instead.
+
+- INTERNAL CHANGES:
+
+ - Fixed a potential NULL pointer dereference flagged by Parfait
+ static code analysis.
+
+ - Extended testing of existing OCI8 functionality.
+
+ - Improved test output portability when using the PHP development
+ web server to run tests.
+
+ - Removed no-longer necessary Unicode patterns from tests
+ (vestiges of PHP's previous PHP 6 project)
+
+ - Improved build portability by removing compilation type cast
+ warnings with some compilers.
+
+ - Fixed compilation warnings when building with Oracle 9.2
+ client libraries.
+
+ - Updated code to use internal macro PHP_OCI_REGISTER_RESOURCE.
+
+ - Regularized code prototypes and fixed some in-line documentation
+ prototypes.
+
+ - Fixed code folding.
+ </notes>
+</release>
+
+<release>
+ <version>
+ <release>1.4.10</release>
+ <api>1.4.10</api>
+ </version>
+ <stability>
+ <release>stable</release>
+ <api>stable</api>
+ </stability>
+ <license uri="http://www.php.net/license">PHP</license>
+ <notes>
+ Bump PECL package info version check to allow PECL installs with PHP 5.5+
+ </notes>
+</release>
+
+<release>
<version>
<release>1.4.9</release>
<api>1.4.9</api>
@@ -457,7 +612,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
Fixed OCI8 part of bug #55748 (CVE-2011-4153: multiple NULL pointer dereferences with zend_strndup)
Fixed OCI8 part of bug #55301 (multiple null pointer dereferences with calloc)
Increased maximum Oracle error message buffer length for new Oracle 11.2.0.3 size
- Improve internal initalization failure error messages
+ Improve internal initialization failure error messages
</notes>
</release>
@@ -472,7 +627,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
</stability>
<license uri="http://www.php.net/license">PHP</license>
<notes>
- Added oci_client_version() returning the runtime Oracle client library version
+ Added oci_client_version() returning the run time Oracle client library version
Made OCI8 extension buildable with PHP 5.4-development code
</notes>
</release>
@@ -846,7 +1001,7 @@ Fixed bug #36820 (Privileged connection with an Oracle password file fails)
<date>2006-03-16</date>
<license uri="http://www.php.net/license">PHP</license>
<notes>Changed OCI8 code to use OCIServerVersion() instead of OCIPing(), which may crash Oracle server of version &lt; 10.2
-Fixed bug #36235 (ocicolumnname returns false before a successfull fetch)
+Fixed bug #36235 (ocicolumnname returns false before a successful fetch)
Fixed bug #36096 (oci_result() returns garbage after oci_fetch() failed)
Fixed bug #36055 (possible OCI8 crash in multithreaded environment)
Fixed bug #36010 (Segfault when re-creating and re-executing statements with bound parameters)
diff --git a/ext/oci8/php_oci8.h b/ext/oci8/php_oci8.h
index f1079526f6..8c5fba9ab0 100644
--- a/ext/oci8/php_oci8.h
+++ b/ext/oci8/php_oci8.h
@@ -46,7 +46,7 @@
*/
#undef PHP_OCI8_VERSION
#endif
-#define PHP_OCI8_VERSION "1.4.10"
+#define PHP_OCI8_VERSION "2.0.2-dev"
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 155e57d2cd..6155a883b0 100644
--- a/ext/oci8/php_oci8_int.h
+++ b/ext/oci8/php_oci8_int.h
@@ -31,7 +31,7 @@
# ifndef PHP_OCI8_INT_H
# define PHP_OCI8_INT_H
-/* misc defines {{{ */
+/* {{{ misc defines */
# if (defined(__osf__) && defined(__alpha))
# ifndef A_OSF
# define A_OSF
@@ -44,6 +44,10 @@
# endif
# endif /* osf alpha */
+#ifdef HAVE_OCI8_DTRACE
+#include "oci8_dtrace_gen.h"
+#endif
+
#if defined(min)
#undef min
#endif
@@ -66,7 +70,7 @@ extern int le_session;
extern zend_class_entry *oci_lob_class_entry_ptr;
extern zend_class_entry *oci_coll_class_entry_ptr;
-/* constants {{{ */
+/* {{{ constants */
#define PHP_OCI_SEEK_SET 0
#define PHP_OCI_SEEK_CUR 1
#define PHP_OCI_SEEK_END 2
@@ -101,6 +105,11 @@ extern zend_class_entry *oci_coll_class_entry_ptr;
#error Invalid value for PHP_OCI_CRED_EXT
#endif
+#define PHP_OCI_IMPRES_UNKNOWN 0
+#define PHP_OCI_IMPRES_NO_CHILDREN 1
+#define PHP_OCI_IMPRES_HAS_CHILDREN 2
+#define PHP_OCI_IMPRES_IS_CHILD 3
+
/*
* Name passed to Oracle for tracing. Note some DB views only show
* the first nine characters of the driver name.
@@ -109,16 +118,21 @@ extern zend_class_entry *oci_coll_class_entry_ptr;
/* }}} */
-typedef struct { /* php_oci_spool {{{ */
- OCIEnv *env; /*env of this session pool */
+/* {{{ php_oci_spool */
+typedef struct {
+ int id; /* resource id */
+ OCIEnv *env; /* env of this session pool */
OCIError *err; /* pool's error handle */
OCISPool *poolh; /* pool handle */
void *poolname; /* session pool name */
unsigned int poolname_len; /* length of session pool name */
char *spool_hash_key; /* Hash key for session pool in plist */
-} php_oci_spool; /* }}} */
+} php_oci_spool;
+/* }}} */
-typedef struct { /* php_oci_connection {{{ */
+/* {{{ php_oci_connection */
+typedef struct {
+ int id; /* resource ID */
OCIEnv *env; /* private env handle */
ub2 charset; /* charset ID */
OCIServer *server; /* private server handle */
@@ -127,7 +141,7 @@ typedef struct { /* php_oci_connection {{{ */
OCIAuthInfo *authinfo; /* Cached authinfo handle for OCISessionGet */
OCIError *err; /* private error handle */
php_oci_spool *private_spool; /* private session pool (for persistent) */
- sword errcode; /* last errcode */
+ sb4 errcode; /* last ORA- error number */
HashTable *descriptors; /* descriptors hash, used to flush all the LOBs using this connection on commit */
ulong descriptor_count; /* used to index the descriptors hash table. Not an accurate count */
@@ -135,17 +149,18 @@ typedef struct { /* php_oci_connection {{{ */
unsigned is_attached:1; /* hels to determine if we should detach from the server when closing/freeing the connection */
unsigned is_persistent:1; /* self-descriptive */
unsigned used_this_request:1; /* helps to determine if we should reset connection's next ping time and check its timeout */
- unsigned needs_commit:1; /* helps to determine if we should rollback this connection on close/shutdown */
+ unsigned rb_on_disconnect:1; /* helps to determine if we should rollback this connection on close/shutdown */
unsigned passwd_changed:1; /* helps determine if a persistent connection hash should be invalidated after a password change */
unsigned is_stub:1; /* flag to keep track whether the connection structure has a real OCI connection associated */
unsigned using_spool:1; /* Is this connection from session pool? */
- int rsrc_id; /* resource ID */
time_t idle_expiry; /* time when the connection will be considered as expired */
time_t *next_pingp; /* (pointer to) time of the next ping */
char *hash_key; /* hashed details of the connection */
-} php_oci_connection; /* }}} */
+} php_oci_connection;
+/* }}} */
-typedef struct { /* php_oci_descriptor {{{ */
+/* {{{ php_oci_descriptor */
+typedef struct {
int id;
ulong index; /* descriptors hash table index */
php_oci_connection *connection; /* parent connection handle */
@@ -158,15 +173,19 @@ typedef struct { /* php_oci_descriptor {{{ */
ub1 charset_form; /* charset form, required for NCLOBs */
ub2 charset_id; /* charset ID */
unsigned is_open:1; /* helps to determine if lob is open or not */
-} php_oci_descriptor; /* }}} */
+} php_oci_descriptor;
+/* }}} */
-typedef struct { /* php_oci_lob_ctx {{{ */
+/* {{{ php_oci_lob_ctx */
+typedef struct {
char **lob_data; /* address of pointer to LOB data */
ub4 *lob_len; /* address of LOB length variable (bytes) */
ub4 alloc_len;
-} php_oci_lob_ctx; /* }}} */
+} php_oci_lob_ctx;
+/* }}} */
-typedef struct { /* php_oci_collection {{{ */
+/* {{{ php_oci_collection */
+typedef struct {
int id;
php_oci_connection *connection; /* parent connection handle */
OCIType *tdo; /* collection's type handle */
@@ -175,23 +194,30 @@ typedef struct { /* php_oci_collection {{{ */
OCIType *element_type; /* element's type handle */
OCITypeCode element_typecode; /* element's typecode handle */
OCIColl *collection; /* collection handle */
-} php_oci_collection; /* }}} */
+} php_oci_collection;
+/* }}} */
-typedef struct { /* php_oci_define {{{ */
+/* {{{ php_oci_define */
+typedef struct {
zval *zval; /* zval used in define */
text *name; /* placeholder's name */
ub4 name_len; /* placeholder's name length */
ub4 type; /* define type */
-} php_oci_define; /* }}} */
+} php_oci_define;
+/* }}} */
-typedef struct { /* php_oci_statement {{{ */
+/* {{{ php_oci_statement */
+typedef struct {
int id;
int parent_stmtid; /* parent statement id */
+ struct php_oci_statement *impres_child_stmt;/* child of current Implicit Result Set statement handle */
+ ub4 impres_count; /* count of remaining Implicit Result children on parent statement handle */
php_oci_connection *connection; /* parent connection handle */
- sword errcode; /* last errcode*/
+ sb4 errcode; /* last ORA- error number */
OCIError *err; /* private error handle */
OCIStmt *stmt; /* statement handle */
- char *last_query; /* last query issued. also used to determine if this is a statement or a refcursor received from Oracle */
+ char *last_query; /* last query issued. also used to determine if this is a statement or a refcursor recieved from Oracle */
+ char impres_flag; /* PHP_OCI_IMPRES_*_ */
long last_query_len; /* last query length */
HashTable *columns; /* hash containing all the result columns */
HashTable *binds; /* binds hash */
@@ -201,9 +227,12 @@ typedef struct { /* php_oci_statement {{{ */
unsigned has_data:1; /* statement has more data flag */
unsigned has_descr:1; /* statement has at least one descriptor or cursor column */
ub2 stmttype; /* statement type */
-} php_oci_statement; /* }}} */
+ ub4 prefetch_count; /* current prefetch count */
+} php_oci_statement;
+/* }}} */
-typedef struct { /* php_oci_bind {{{ */
+/* {{{ php_oci_bind */
+typedef struct {
OCIBind *bind; /* bind handle */
zval *zval; /* value */
dvoid *descriptor; /* used for binding of LOBS etc */
@@ -222,9 +251,11 @@ typedef struct { /* php_oci_bind {{{ */
sb2 indicator; /* -1 means NULL */
ub2 retcode;
ub4 dummy_len; /* a dummy var to store alenpp value in bind OUT callback */
-} php_oci_bind; /* }}} */
+} php_oci_bind;
+/* }}} */
-typedef struct { /* php_oci_out_column {{{ */
+/* {{{ php_oci_out_column */
+typedef struct {
php_oci_statement *statement; /* statement handle. used when fetching REFCURSORS */
php_oci_statement *nested_statement; /* statement handle. used when fetching REFCURSORS */
OCIDefine *oci_define; /* define handle */
@@ -249,28 +280,23 @@ typedef struct { /* php_oci_out_column {{{ */
sb2 precision; /* column precision */
ub1 charset_form; /* charset form, required for NCLOBs */
ub2 charset_id; /* charset ID */
-} php_oci_out_column; /* }}} */
+} php_oci_out_column;
+/* }}} */
/* {{{ macros */
-#define PHP_OCI_CALL(func, params) \
- do { \
- if (OCI_G(debug_mode)) { \
- php_printf ("OCI8 DEBUG: " #func " at (%s:%d) \n", __FILE__, __LINE__); \
- } \
- OCI_G(in_call) = 1; \
- func params; \
- OCI_G(in_call) = 0; \
+#define PHP_OCI_CALL(func, params) \
+ do { \
+ OCI_G(in_call) = 1; \
+ func params; \
+ OCI_G(in_call) = 0; \
} while (0)
-#define PHP_OCI_CALL_RETURN(__retval, func, params) \
- do { \
- if (OCI_G(debug_mode)) { \
- php_printf ("OCI8 DEBUG: " #func " at (%s:%d) \n", __FILE__, __LINE__); \
- } \
- OCI_G(in_call) = 1; \
- __retval = func params; \
- OCI_G(in_call) = 0; \
+#define PHP_OCI_CALL_RETURN(__retval, func, params) \
+ do { \
+ OCI_G(in_call) = 1; \
+ __retval = func params; \
+ OCI_G(in_call) = 0; \
} while (0)
/* Check for errors that indicate the connection to the DB is no
@@ -284,6 +310,7 @@ typedef struct { /* php_oci_out_column {{{ */
*/
#define PHP_OCI_HANDLE_ERROR(connection, errcode) \
do { \
+ ub4 serverStatus = OCI_SERVER_NORMAL; \
switch (errcode) { \
case 1013: \
zend_bailout(); \
@@ -313,7 +340,6 @@ typedef struct { /* php_oci_out_column {{{ */
break; \
default: \
{ \
- ub4 serverStatus = OCI_SERVER_NORMAL; \
PHP_OCI_CALL(OCIAttrGet, ((dvoid *)(connection)->server, OCI_HTYPE_SERVER, (dvoid *)&serverStatus, \
(ub4 *)0, OCI_ATTR_SERVER_STATUS, (connection)->err)); \
if (serverStatus != OCI_SERVER_NORMAL) { \
@@ -322,6 +348,7 @@ typedef struct { /* php_oci_out_column {{{ */
} \
break; \
} \
+ php_oci_dtrace_check_connection(connection, errcode, serverStatus); \
} while (0)
#define PHP_OCI_REGISTER_RESOURCE(resource, le_resource) \
@@ -365,117 +392,110 @@ typedef struct { /* php_oci_out_column {{{ */
/* PROTOS */
-/* main prototypes {{{ */
-
-void php_oci_column_hash_dtor (void *data);
-void php_oci_define_hash_dtor (void *data);
-void php_oci_bind_hash_dtor (void *data);
-void php_oci_descriptor_flush_hash_dtor (void *data);
+/* {{{ main prototypes */
+void php_oci_column_hash_dtor(void *data);
+void php_oci_define_hash_dtor(void *data);
+void php_oci_bind_hash_dtor(void *data);
+void php_oci_descriptor_flush_hash_dtor(void *data);
void php_oci_connection_descriptors_free(php_oci_connection *connection TSRMLS_DC);
-
-sb4 php_oci_error (OCIError *, sword TSRMLS_DC);
-sb4 php_oci_fetch_errmsg(OCIError *, text ** TSRMLS_DC);
-int php_oci_fetch_sqltext_offset(php_oci_statement *, text **, ub2 * TSRMLS_DC);
-
-void php_oci_do_connect (INTERNAL_FUNCTION_PARAMETERS, int , int);
+sb4 php_oci_error(OCIError *err_p, sword status TSRMLS_DC);
+sb4 php_oci_fetch_errmsg(OCIError *error_handle, text **error_buf TSRMLS_DC);
+int php_oci_fetch_sqltext_offset(php_oci_statement *statement, text **sqltext, ub2 *error_offset TSRMLS_DC);
+void php_oci_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent, int exclusive);
php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char *password, int password_len, char *new_password, int new_password_len, char *dbname, int dbname_len, char *charset, long session_mode, int persistent, int exclusive TSRMLS_DC);
-
-int php_oci_connection_rollback(php_oci_connection * TSRMLS_DC);
-int php_oci_connection_commit(php_oci_connection * TSRMLS_DC);
+int php_oci_connection_rollback(php_oci_connection *connection TSRMLS_DC);
+int php_oci_connection_commit(php_oci_connection *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);
-int php_oci_column_to_zval(php_oci_out_column *, zval *, int TSRMLS_DC);
+int php_oci_password_change(php_oci_connection *connection, char *user, int user_len, char *pass_old, int pass_old_len, char *pass_new, int pass_new_len TSRMLS_DC);
+void php_oci_client_get_version(char **version TSRMLS_DC);
+int php_oci_server_get_version(php_oci_connection *connection, char **version TSRMLS_DC);
+void php_oci_fetch_row(INTERNAL_FUNCTION_PARAMETERS, int mode, int expected_args);
+int php_oci_column_to_zval(php_oci_out_column *column, zval *value, int mode TSRMLS_DC);
+void php_oci_dtrace_check_connection(php_oci_connection *connection, sb4 errcode, ub4 serverStatus);
/* }}} */
-/* lob related prototypes {{{ */
-
-php_oci_descriptor * php_oci_lob_create (php_oci_connection *, long TSRMLS_DC);
-int php_oci_lob_get_length (php_oci_descriptor *, ub4 * TSRMLS_DC);
-int php_oci_lob_read (php_oci_descriptor *, long, long, char **, ub4 * TSRMLS_DC);
-int php_oci_lob_write (php_oci_descriptor *, ub4, char *, int, ub4 * TSRMLS_DC);
-int php_oci_lob_flush (php_oci_descriptor *, long TSRMLS_DC);
-int php_oci_lob_set_buffering (php_oci_descriptor *, int TSRMLS_DC);
-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 *, 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);
-int php_oci_lob_truncate (php_oci_descriptor *, long TSRMLS_DC);
-int php_oci_lob_erase (php_oci_descriptor *, long, ub4, ub4 * TSRMLS_DC);
-int php_oci_lob_is_equal (php_oci_descriptor *, php_oci_descriptor *, boolean * TSRMLS_DC);
+/* {{{ lob related prototypes */
+
+php_oci_descriptor *php_oci_lob_create(php_oci_connection *connection, long type TSRMLS_DC);
+int php_oci_lob_get_length(php_oci_descriptor *descriptor, ub4 *length TSRMLS_DC);
+int php_oci_lob_read(php_oci_descriptor *descriptor, long read_length, long inital_offset, char **data, ub4 *data_len TSRMLS_DC);
+int php_oci_lob_write(php_oci_descriptor *descriptor, ub4 offset, char *data, int data_len, ub4 *bytes_written TSRMLS_DC);
+int php_oci_lob_flush(php_oci_descriptor *descriptor, long flush_flag TSRMLS_DC);
+int php_oci_lob_set_buffering(php_oci_descriptor *descriptor, int on_off TSRMLS_DC);
+int php_oci_lob_get_buffering(php_oci_descriptor *descriptor);
+int php_oci_lob_copy(php_oci_descriptor *descriptor, php_oci_descriptor *descriptor_from, long length TSRMLS_DC);
+int php_oci_lob_close(php_oci_descriptor *descriptor TSRMLS_DC);
+int php_oci_temp_lob_close(php_oci_descriptor *descriptor TSRMLS_DC);
+int php_oci_lob_write_tmp(php_oci_descriptor *descriptor, long type, char *data, int data_len TSRMLS_DC);
+void php_oci_lob_free(php_oci_descriptor *descriptor TSRMLS_DC);
+int php_oci_lob_import(php_oci_descriptor *descriptor, char *filename TSRMLS_DC);
+int php_oci_lob_append(php_oci_descriptor *descriptor_dest, php_oci_descriptor *descriptor_from TSRMLS_DC);
+int php_oci_lob_truncate(php_oci_descriptor *descriptor, long new_lob_length TSRMLS_DC);
+int php_oci_lob_erase(php_oci_descriptor *descriptor, long offset, ub4 length, ub4 *bytes_erased TSRMLS_DC);
+int php_oci_lob_is_equal(php_oci_descriptor *descriptor_first, php_oci_descriptor *descriptor_second, boolean *result TSRMLS_DC);
#if defined(HAVE_OCI_LOB_READ2)
-sb4 php_oci_lob_callback (dvoid *ctxp, CONST dvoid *bufxp, oraub8 len, ub1 piece, dvoid **changed_bufpp, oraub8 *changed_lenp);
+sb4 php_oci_lob_callback(dvoid *ctxp, CONST dvoid *bufxp, oraub8 len, ub1 piece, dvoid **changed_bufpp, oraub8 *changed_lenp);
#else
-sb4 php_oci_lob_callback (dvoid *ctxp, CONST dvoid *bufxp, ub4 len, ub1 piece);
+sb4 php_oci_lob_callback(dvoid *ctxp, CONST dvoid *bufxp, ub4 len, ub1 piece);
#endif
/* }}} */
-/* collection related prototypes {{{ */
-
-php_oci_collection * php_oci_collection_create(php_oci_connection *, char *, int, char *, int TSRMLS_DC);
-int php_oci_collection_size(php_oci_collection *, sb4 * TSRMLS_DC);
-int php_oci_collection_max(php_oci_collection *, long * TSRMLS_DC);
-int php_oci_collection_trim(php_oci_collection *, long TSRMLS_DC);
-int php_oci_collection_append(php_oci_collection *, char *, int TSRMLS_DC);
-int php_oci_collection_element_get(php_oci_collection *, long, zval** TSRMLS_DC);
-int php_oci_collection_element_set(php_oci_collection *, long, char *, int TSRMLS_DC);
-int php_oci_collection_element_set_null(php_oci_collection *, long TSRMLS_DC);
-int php_oci_collection_element_set_date(php_oci_collection *, long, char *, int TSRMLS_DC);
-int php_oci_collection_element_set_number(php_oci_collection *, long, char *, int TSRMLS_DC);
-int php_oci_collection_element_set_string(php_oci_collection *, long, char *, int TSRMLS_DC);
-int php_oci_collection_assign(php_oci_collection *, php_oci_collection * TSRMLS_DC);
-void php_oci_collection_close(php_oci_collection * TSRMLS_DC);
-int php_oci_collection_append_null(php_oci_collection * TSRMLS_DC);
-int php_oci_collection_append_date(php_oci_collection *, char *, int TSRMLS_DC);
-int php_oci_collection_append_number(php_oci_collection *, char *, int TSRMLS_DC);
-int php_oci_collection_append_string(php_oci_collection *, char *, int TSRMLS_DC);
+/* {{{ collection related prototypes */
+
+php_oci_collection *php_oci_collection_create(php_oci_connection *connection, char *tdo, int tdo_len, char *schema, int schema_len TSRMLS_DC);
+int php_oci_collection_size(php_oci_collection *collection, sb4 *size TSRMLS_DC);
+int php_oci_collection_max(php_oci_collection *collection, long *max TSRMLS_DC);
+int php_oci_collection_trim(php_oci_collection *collection, long trim_size TSRMLS_DC);
+int php_oci_collection_append(php_oci_collection *collection, char *element, int element_len TSRMLS_DC);
+int php_oci_collection_element_get(php_oci_collection *collection, long index, zval **result_element TSRMLS_DC);
+int php_oci_collection_element_set(php_oci_collection *collection, long index, char *value, int value_len TSRMLS_DC);
+int php_oci_collection_element_set_null(php_oci_collection *collection, long index TSRMLS_DC);
+int php_oci_collection_element_set_date(php_oci_collection *collection, long index, char *date, int date_len TSRMLS_DC);
+int php_oci_collection_element_set_number(php_oci_collection *collection, long index, char *number, int number_len TSRMLS_DC);
+int php_oci_collection_element_set_string(php_oci_collection *collection, long index, char *element, int element_len TSRMLS_DC);
+int php_oci_collection_assign(php_oci_collection *collection_dest, php_oci_collection *collection_from TSRMLS_DC);
+void php_oci_collection_close(php_oci_collection *collection TSRMLS_DC);
+int php_oci_collection_append_null(php_oci_collection *collection TSRMLS_DC);
+int php_oci_collection_append_date(php_oci_collection *collection, char *date, int date_len TSRMLS_DC);
+int php_oci_collection_append_number(php_oci_collection *collection, char *number, int number_len TSRMLS_DC);
+int php_oci_collection_append_string(php_oci_collection *collection, char *element, int element_len TSRMLS_DC);
/* }}} */
-/* statement related prototypes {{{ */
+/* {{{ statement related prototypes */
-php_oci_statement * php_oci_statement_create (php_oci_connection *, char *, int TSRMLS_DC);
-int php_oci_statement_set_prefetch (php_oci_statement *, long TSRMLS_DC);
-int php_oci_statement_fetch (php_oci_statement *, ub4 TSRMLS_DC);
-php_oci_out_column * php_oci_statement_get_column (php_oci_statement *, long, char *, int TSRMLS_DC);
-int php_oci_statement_execute (php_oci_statement *, ub4 TSRMLS_DC);
-int php_oci_statement_cancel (php_oci_statement * TSRMLS_DC);
-void php_oci_statement_free (php_oci_statement * TSRMLS_DC);
+php_oci_statement *php_oci_statement_create(php_oci_connection *connection, char *query, int query_len TSRMLS_DC);
+php_oci_statement *php_oci_get_implicit_resultset(php_oci_statement *statement TSRMLS_DC);
+int php_oci_statement_set_prefetch(php_oci_statement *statement, ub4 prefetch TSRMLS_DC);
+int php_oci_statement_fetch(php_oci_statement *statement, ub4 nrows TSRMLS_DC);
+php_oci_out_column *php_oci_statement_get_column(php_oci_statement *statement, long column_index, char *column_name, int column_name_len TSRMLS_DC);
+int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC);
+int php_oci_statement_cancel(php_oci_statement *statement TSRMLS_DC);
+void php_oci_statement_free(php_oci_statement *statement TSRMLS_DC);
int php_oci_bind_pre_exec(void *data, void *result TSRMLS_DC);
int php_oci_bind_post_exec(void *data TSRMLS_DC);
-int php_oci_bind_by_name(php_oci_statement *, char *, int, zval*, long, ub2 TSRMLS_DC);
-sb4 php_oci_bind_in_callback(dvoid *, OCIBind *, ub4, ub4, dvoid **, ub4 *, ub1 *, dvoid **);
-sb4 php_oci_bind_out_callback(dvoid *, OCIBind *, ub4, ub4, dvoid **, ub4 **, ub1 *, dvoid **, ub2 **);
+int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len, zval *var, long maxlength, ub2 type TSRMLS_DC);
+sb4 php_oci_bind_in_callback(dvoid *ictxp, OCIBind *bindp, ub4 iter, ub4 index, dvoid **bufpp, ub4 *alenp, ub1 *piecep, dvoid **indpp);
+sb4 php_oci_bind_out_callback(dvoid *octxp, OCIBind *bindp, ub4 iter, ub4 index, dvoid **bufpp, ub4 **alenpp, ub1 *piecep, dvoid **indpp, ub2 **rcodepp);
php_oci_out_column *php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAMETERS, int need_data);
int php_oci_cleanup_pre_fetch(void *data TSRMLS_DC);
-
-int php_oci_statement_get_type(php_oci_statement *, ub2 * TSRMLS_DC);
-int php_oci_statement_get_numrows(php_oci_statement *, ub4 * TSRMLS_DC);
-int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, int name_len, zval* var, long max_table_length, long maxlength, long type TSRMLS_DC);
-php_oci_bind *php_oci_bind_array_helper_number(zval* var, long max_table_length TSRMLS_DC);
-php_oci_bind *php_oci_bind_array_helper_double(zval* var, long max_table_length TSRMLS_DC);
-php_oci_bind *php_oci_bind_array_helper_string(zval* var, long max_table_length, long maxlength TSRMLS_DC);
-php_oci_bind *php_oci_bind_array_helper_date(zval* var, long max_table_length, php_oci_connection *connection TSRMLS_DC);
+int php_oci_statement_get_type(php_oci_statement *statement, ub2 *type TSRMLS_DC);
+int php_oci_statement_get_numrows(php_oci_statement *statement, ub4 *numrows TSRMLS_DC);
+int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, int name_len, zval *var, long max_table_length, long maxlength, long type TSRMLS_DC);
+php_oci_bind *php_oci_bind_array_helper_number(zval *var, long max_table_length TSRMLS_DC);
+php_oci_bind *php_oci_bind_array_helper_double(zval *var, long max_table_length TSRMLS_DC);
+php_oci_bind *php_oci_bind_array_helper_string(zval *var, long max_table_length, long maxlength TSRMLS_DC);
+php_oci_bind *php_oci_bind_array_helper_date(zval *var, long max_table_length, php_oci_connection *connection TSRMLS_DC);
/* }}} */
-ZEND_BEGIN_MODULE_GLOBALS(oci) /* {{{ */
- sword errcode; /* global last error code (used when connect fails, for example) */
+ZEND_BEGIN_MODULE_GLOBALS(oci) /* {{{ Module globals */
+ sb4 errcode; /* global last ORA- error number. Used when connect fails, for example */
OCIError *err; /* global error handle */
- zend_bool debug_mode; /* debug mode flag */
-
long max_persistent; /* maximum number of persistent connections per process */
long num_persistent; /* number of existing persistent connections */
long num_links; /* non-persistent + persistent connections */
diff --git a/ext/oci8/tests/bind_char_1.phpt b/ext/oci8/tests/bind_char_1.phpt
index 91fa4b75b7..d68991a7f2 100644
--- a/ext/oci8/tests/bind_char_1.phpt
+++ b/ext/oci8/tests/bind_char_1.phpt
@@ -5,12 +5,15 @@ SELECT oci_bind_by_name with SQLT_AFC aka CHAR
if (!extension_loaded('oci8')) die ("skip no oci8 extension");
require(dirname(__FILE__)."/connect.inc");
// The bind buffer size edge cases seem to change each DB version.
-if (preg_match('/Release 10\.2\./', oci_server_version($c), $matches) !== 1) {
- if (preg_match('/Release 11\.2\.0\.2/', oci_server_version($c), $matches) !== 2) {
- die("skip expected output only valid when using Oracle 10gR2 or 11.2.0.2 databases");
- }
+preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
+if (!(isset($matches[0]) &&
+ (($matches[1] == 10 && $matches[2] >= 2) ||
+ ($matches[1] == 11 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] == 2)
+ ))) {
+ die("skip expected output only valid when using Oracle 10gR2 or 11.2.0.2 databases");
}
-if (preg_match('/^11\./', oci_client_version()) != 1) {
+preg_match('/^[[:digit:]]+/', oci_client_version(), $matches);
+if (isset($matches[0]) && $matches[0] < 11) {
die("skip test expected to work only with Oracle 11g or greater version of client");
}
?>
diff --git a/ext/oci8/tests/bind_char_1_11gR1.phpt b/ext/oci8/tests/bind_char_1_11gR1.phpt
index a7feff9f6a..2a7c713aa7 100644
--- a/ext/oci8/tests/bind_char_1_11gR1.phpt
+++ b/ext/oci8/tests/bind_char_1_11gR1.phpt
@@ -5,10 +5,12 @@ SELECT oci_bind_by_name with SQLT_AFC aka CHAR
if (!extension_loaded('oci8')) die ("skip no oci8 extension");
require(dirname(__FILE__)."/connect.inc");
// The bind buffer size edge cases seem to change each DB version.
-if (preg_match('/Release 11\.1\./', oci_server_version($c), $matches) !== 1) {
- if (preg_match('/Release 11\.2\.0\.3/', oci_server_version($c), $matches) !== 1) {
- die("skip expected output only valid when using Oracle 11gR1 or 11.2.0.3 databases");
- }
+preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
+if (!(isset($matches[0]) &&
+ (($matches[1] == 11 && $matches[2] == 1) ||
+ ($matches[1] == 11 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] == 3)
+ ))) {
+ die("skip expected output only valid when using Oracle 11gR1 or 11.2.0.3 databases");
}
?>
--ENV--
diff --git a/ext/oci8/tests/bind_char_2.phpt b/ext/oci8/tests/bind_char_2.phpt
index 43661a065d..3695c85854 100644
--- a/ext/oci8/tests/bind_char_2.phpt
+++ b/ext/oci8/tests/bind_char_2.phpt
@@ -5,12 +5,15 @@ SELECT oci_bind_by_name with SQLT_AFC aka CHAR and dates
if (!extension_loaded('oci8')) die ("skip no oci8 extension");
require(dirname(__FILE__)."/connect.inc");
// The bind buffer size edge cases seem to change each DB version.
-if (preg_match('/Release 10\.2\./', oci_server_version($c), $matches) !== 1) {
- if (preg_match('/Release 11\.2\.0\.2/', oci_server_version($c), $matches) !== 2) {
- die("skip expected output only valid when using Oracle 10gR2 or 11.2.0.2 databases");
- }
+preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
+if (!(isset($matches[0]) &&
+ (($matches[1] == 10 && $matches[2] >= 2) ||
+ ($matches[1] == 11 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] == 2)
+ ))) {
+ die("skip expected output only valid when using Oracle 10gR2 or 11.2.0.2 databases");
}
-if (preg_match('/^11\./', oci_client_version()) != 1) {
+preg_match('/^[[:digit:]]+/', oci_client_version(), $matches);
+if (isset($matches[0]) && $matches[0] < 11) {
die("skip test expected to work only with Oracle 11g or greater version of client");
}
?>
diff --git a/ext/oci8/tests/bind_char_2_11gR1.phpt b/ext/oci8/tests/bind_char_2_11gR1.phpt
index edb2a12ff0..b9afd6940b 100644
--- a/ext/oci8/tests/bind_char_2_11gR1.phpt
+++ b/ext/oci8/tests/bind_char_2_11gR1.phpt
@@ -5,10 +5,12 @@ SELECT oci_bind_by_name with SQLT_AFC aka CHAR and dates
if (!extension_loaded('oci8')) die ("skip no oci8 extension");
require(dirname(__FILE__)."/connect.inc");
// The bind buffer size edge cases seem to change each DB version.
-if (preg_match('/Release 11\.1\./', oci_server_version($c), $matches) !== 1) {
- if (preg_match('/Release 11\.2\.0\.3/', oci_server_version($c), $matches) !== 1) {
- die("skip expected output only valid when using Oracle 11gR1 or 11.2.0.3 databases");
- }
+preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
+if (!(isset($matches[0]) &&
+ (($matches[1] == 11 && $matches[2] == 1) ||
+ ($matches[1] == 11 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] == 3)
+ ))) {
+ die("skip expected output only valid when using Oracle 11gR1 or 11.2.0.3 databases");
}
?>
--ENV--
diff --git a/ext/oci8/tests/bind_char_3.phpt b/ext/oci8/tests/bind_char_3.phpt
index 25115836df..009e60a542 100644
--- a/ext/oci8/tests/bind_char_3.phpt
+++ b/ext/oci8/tests/bind_char_3.phpt
@@ -5,12 +5,15 @@ PL/SQL oci_bind_by_name with SQLT_AFC aka CHAR to CHAR parameter
if (!extension_loaded('oci8')) die ("skip no oci8 extension");
require(dirname(__FILE__)."/connect.inc");
// The bind buffer size edge cases seem to change each DB version.
-if (preg_match('/Release 10\.2\./', oci_server_version($c), $matches) !== 1) {
- if (preg_match('/Release 11\.2\.0\.2/', oci_server_version($c), $matches) !== 2) {
- die("skip expected output only valid when using Oracle 10gR2 or 11.2.0.2 databases");
- }
+preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
+if (!(isset($matches[0]) &&
+ (($matches[1] == 10 && $matches[2] >= 2) ||
+ ($matches[1] == 11 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] == 2)
+ ))) {
+ die("skip expected output only valid when using Oracle 10gR2 or 11.2.0.2 databases");
}
-if (preg_match('/^11\./', oci_client_version()) != 1) {
+preg_match('/^[[:digit:]]+/', oci_client_version(), $matches);
+if (isset($matches[0]) && $matches[0] < 11) {
die("skip test expected to work only with Oracle 11g or greater version of client");
}
?>
diff --git a/ext/oci8/tests/bind_char_3_11gR1.phpt b/ext/oci8/tests/bind_char_3_11gR1.phpt
index fea77754d1..a894de00c0 100644
--- a/ext/oci8/tests/bind_char_3_11gR1.phpt
+++ b/ext/oci8/tests/bind_char_3_11gR1.phpt
@@ -5,10 +5,12 @@ PL/SQL oci_bind_by_name with SQLT_AFC aka CHAR to CHAR parameter
if (!extension_loaded('oci8')) die ("skip no oci8 extension");
require(dirname(__FILE__)."/connect.inc");
// The bind buffer size edge cases seem to change each DB version.
-if (preg_match('/Release 11\.1\./', oci_server_version($c), $matches) !== 1) {
- if (preg_match('/Release 11\.2\.0\.3/', oci_server_version($c), $matches) !== 1) {
- die("skip expected output only valid when using Oracle 11gR1 or 11.2.0.3 databases");
- }
+preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
+if (!(isset($matches[0]) &&
+ (($matches[1] == 11 && $matches[2] == 1) ||
+ ($matches[1] == 11 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] == 3)
+ ))) {
+ die("skip expected output only valid when using Oracle 11gR1 or 11.2.0.3 databases");
}
?>
--ENV--
diff --git a/ext/oci8/tests/bind_char_4.phpt b/ext/oci8/tests/bind_char_4.phpt
index 36765f8137..0ac60e503d 100644
--- a/ext/oci8/tests/bind_char_4.phpt
+++ b/ext/oci8/tests/bind_char_4.phpt
@@ -5,12 +5,15 @@ PL/SQL oci_bind_by_name with SQLT_AFC aka CHAR to VARCHAR2 parameter
if (!extension_loaded('oci8')) die ("skip no oci8 extension");
require(dirname(__FILE__)."/connect.inc");
// The bind buffer size edge cases seem to change each DB version.
-if (preg_match('/Release 10\.2\./', oci_server_version($c), $matches) !== 1) {
- if (preg_match('/Release 11\.2\.0\.2/', oci_server_version($c), $matches) !== 2) {
- die("skip expected output only valid when using Oracle 10gR2 or 11.2.0.2 databases");
- }
+preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
+if (!(isset($matches[0]) &&
+ (($matches[1] == 10 && $matches[2] >= 2) ||
+ ($matches[1] == 11 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] == 2)
+ ))) {
+ die("skip expected output only valid when using Oracle 10gR2 or 11.2.0.2 databases");
}
-if (preg_match('/^11\./', oci_client_version()) != 1) {
+preg_match('/^[[:digit:]]+/', oci_client_version(), $matches);
+if (isset($matches[0]) && $matches[0] < 11) {
die("skip test expected to work only with Oracle 11g or greater version of client");
}
?>
diff --git a/ext/oci8/tests/bind_char_4_11gR1.phpt b/ext/oci8/tests/bind_char_4_11gR1.phpt
index 2bc2f14246..d5ce116afb 100644
--- a/ext/oci8/tests/bind_char_4_11gR1.phpt
+++ b/ext/oci8/tests/bind_char_4_11gR1.phpt
@@ -5,10 +5,12 @@ PL/SQL oci_bind_by_name with SQLT_AFC aka CHAR to VARCHAR2 parameter
if (!extension_loaded('oci8')) die ("skip no oci8 extension");
require(dirname(__FILE__)."/connect.inc");
// The bind buffer size edge cases seem to change each DB version.
-if (preg_match('/Release 11\.1\./', oci_server_version($c), $matches) !== 1) {
- if (preg_match('/Release 11\.2\.0\.3/', oci_server_version($c), $matches) !== 1) {
- die("skip expected output only valid when using Oracle 11gR1 or 11.2.0.3 databases");
- }
+preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
+if (!(isset($matches[0]) &&
+ (($matches[1] == 11 && $matches[2] == 1) ||
+ ($matches[1] == 11 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] == 3)
+ ))) {
+ die("skip expected output only valid when using Oracle 11gR1 or 11.2.0.3 databases");
}
?>
--ENV--
diff --git a/ext/oci8/tests/bind_unsupported_2.phpt b/ext/oci8/tests/bind_unsupported_2.phpt
index d3e5375df6..a2bf9de5a6 100644
--- a/ext/oci8/tests/bind_unsupported_2.phpt
+++ b/ext/oci8/tests/bind_unsupported_2.phpt
@@ -3,7 +3,8 @@ 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) {
+preg_match('/^[[:digit:]]+/', oci_client_version(), $matches);
+if (isset($matches[0]) && $matches[0] < 10) {
die ("skip expected output only valid for Oracle 10g+ clients");
}
?>
diff --git a/ext/oci8/tests/bug27303_1.phpt b/ext/oci8/tests/bug27303_1.phpt
index 40ab4ebed2..0ef47f13dd 100644
--- a/ext/oci8/tests/bug27303_1.phpt
+++ b/ext/oci8/tests/bug27303_1.phpt
@@ -5,12 +5,15 @@ Bug #27303 (OCIBindByName binds numeric PHP values as characters)
if (!extension_loaded('oci8')) die ("skip no oci8 extension");
require(dirname(__FILE__)."/connect.inc");
// The bind buffer size edge cases seem to change each DB version.
-if (preg_match('/Release 10\.2\.0\.2/', oci_server_version($c), $matches) !== 1 &&
- preg_match('/Release 11\.2\.0\.2/', oci_server_version($c), $matches) !== 1) {
- die("skip expected output only valid when using Oracle 10.2.0.2 or 11.2.0.2 databases");
- // Other point releases may also work
+preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
+if (!(isset($matches[0]) &&
+ (($matches[1] == 10 && $matches[2] >= 2) ||
+ ($matches[1] == 11 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] == 2)
+ ))) {
+ die("skip expected output only valid when using Oracle 10gR2 or 11.2.0.2 databases");
}
-if (preg_match('/^11\./', oci_client_version()) != 1) {
+preg_match('/^[[:digit:]]+/', oci_client_version(), $matches);
+if (isset($matches[0]) && $matches[0] < 11) {
die("skip test expected to work only with Oracle 11g or greater version of client");
}
?>
diff --git a/ext/oci8/tests/bug27303_1_11gR1.phpt b/ext/oci8/tests/bug27303_1_11gR1.phpt
index 6de9b99378..7b4c158561 100644
--- a/ext/oci8/tests/bug27303_1_11gR1.phpt
+++ b/ext/oci8/tests/bug27303_1_11gR1.phpt
@@ -5,12 +5,13 @@ Bug #27303 (OCIBindByName binds numeric PHP values as characters)
if (!extension_loaded('oci8')) die ("skip no oci8 extension");
require(dirname(__FILE__)."/connect.inc");
// The bind buffer size edge cases seem to change each DB version.
-if (preg_match('/Release 10\.2\.0\.3/', oci_server_version($c), $matches) !== 1) {
- if (preg_match('/Release 11\.1\.0\.6/', oci_server_version($c), $matches) !== 1) {
- if (preg_match('/Release 11\.2\.0\.3/', oci_server_version($c), $matches) !== 1) {
- die("skip expected output only valid when using specific Oracle database versions");
- }
- }
+preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
+if (!(isset($matches[0]) &&
+ (($matches[1] == 10 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] == 3) ||
+ ($matches[1] == 11 && $matches[2] == 1 && $matches[3] == 0 && $matches[4] == 6) ||
+ ($matches[1] == 11 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] == 3)
+ ))) {
+ die("skip expected output only valid when using Oracle 10gR2 or 11.2.0.2 databases");
}
?>
--FILE--
diff --git a/ext/oci8/tests/bug27303_2.phpt b/ext/oci8/tests/bug27303_2.phpt
index 1fb2b31682..72d4e5a7dd 100644
--- a/ext/oci8/tests/bug27303_2.phpt
+++ b/ext/oci8/tests/bug27303_2.phpt
@@ -5,12 +5,15 @@ Bug #27303 (OCIBindByName binds numeric PHP values as characters)
if (!extension_loaded('oci8')) die ("skip no oci8 extension");
require(dirname(__FILE__)."/connect.inc");
// The bind buffer size edge cases seem to change each DB version.
-if (preg_match('/Release 10\.2\.0\.2/', oci_server_version($c), $matches) !== 1 &&
- preg_match('/Release 11\.2\.0\.2/', oci_server_version($c), $matches) !== 1) {
- die("skip expected output only valid when using Oracle 10.2.0.2 or 11.2.0.2 databases");
- // Other point releases may also work
+preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
+if (!(isset($matches[0]) &&
+ (($matches[1] == 10 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] == 2) ||
+ ($matches[1] == 11 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] == 2)
+ ))) {
+ die("skip expected output only valid when using Oracle 10.2.0.2 or 11.2.0.2 databases");
}
-if (preg_match('/^11\./', oci_client_version()) != 1) {
+preg_match('/^[[:digit:]]+/', oci_client_version(), $matches);
+if (isset($matches[0]) && $matches[0] < 11) {
die("skip test expected to work only with Oracle 11g or greater version of client");
}
?>
diff --git a/ext/oci8/tests/bug27303_2_11gR1.phpt b/ext/oci8/tests/bug27303_2_11gR1.phpt
index 1e3e3105ad..27d8a585bd 100644
--- a/ext/oci8/tests/bug27303_2_11gR1.phpt
+++ b/ext/oci8/tests/bug27303_2_11gR1.phpt
@@ -5,12 +5,13 @@ Bug #27303 (OCIBindByName binds numeric PHP values as characters)
if (!extension_loaded('oci8')) die ("skip no oci8 extension");
require(dirname(__FILE__)."/connect.inc");
// The bind buffer size edge cases seem to change each DB version.
-if (preg_match('/Release 10\.2\.0\.3/', oci_server_version($c), $matches) !== 1) {
- if (preg_match('/Release 11\.1\.0\.6/', oci_server_version($c), $matches) !== 1) {
- if (preg_match('/Release 11\.2\.0\.3/', oci_server_version($c), $matches) !== 1) {
- die("skip expected output only valid when using specific Oracle database versions");
- }
- }
+preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
+if (!(isset($matches[0]) &&
+ (($matches[1] == 10 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] == 3) ||
+ ($matches[1] == 11 && $matches[2] == 1 && $matches[3] == 0 && $matches[4] == 6) ||
+ ($matches[1] == 11 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] == 3)
+ ))) {
+ die("skip expected output only valid when using specific Oracle database versions");
}
?>
--FILE--
diff --git a/ext/oci8/tests/bug27303_4.phpt b/ext/oci8/tests/bug27303_4.phpt
index 3137db8659..a24ae705ab 100644
--- a/ext/oci8/tests/bug27303_4.phpt
+++ b/ext/oci8/tests/bug27303_4.phpt
@@ -5,12 +5,16 @@ Bug #27303 (OCIBindByName binds numeric PHP values as characters)
if (!extension_loaded('oci8')) die ("skip no oci8 extension");
require(dirname(__FILE__)."/connect.inc");
// The bind buffer size edge cases seem to change each DB version.
-if (preg_match('/Release 10\.2\.0\.2/', oci_server_version($c), $matches) !== 1 &&
- preg_match('/Release 11\.2\.0\.2/', oci_server_version($c), $matches) !== 1) {
- die("skip expected output only valid when using Oracle 10.2.0.2 or 11.2.0.2 databases");
- // Other point releases may also work
+preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
+if (!(isset($matches[0]) &&
+ (($matches[1] == 10 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] == 2) ||
+ ($matches[1] == 11 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] == 2)
+ ))) {
+ die("skip expected output only valid when using Oracle 10.2.0.2 or 11.2.0.2 databases");
+ // Other point releases may also work
}
-if (preg_match('/^11\./', oci_client_version()) != 1) {
+preg_match('/^[[:digit:]]+/', oci_client_version(), $matches);
+if (isset($matches[0]) && $matches[0] < 11) {
die("skip test expected to work only with Oracle 11g or greater version of client");
}
?>
diff --git a/ext/oci8/tests/bug27303_4_11gR1.phpt b/ext/oci8/tests/bug27303_4_11gR1.phpt
index f9bc2da8a2..01db1dc5a0 100644
--- a/ext/oci8/tests/bug27303_4_11gR1.phpt
+++ b/ext/oci8/tests/bug27303_4_11gR1.phpt
@@ -5,12 +5,13 @@ Bug #27303 (OCIBindByName binds numeric PHP values as characters)
if (!extension_loaded('oci8')) die ("skip no oci8 extension");
require(dirname(__FILE__)."/connect.inc");
// The bind buffer size edge cases seem to change each DB version.
-if (preg_match('/Release 10\.2\.0\.3/', oci_server_version($c), $matches) !== 1) {
- if (preg_match('/Release 11\.1\.0\.6/', oci_server_version($c), $matches) !== 1) {
- if (preg_match('/Release 11\.2\.0\.3/', oci_server_version($c), $matches) !== 1) {
- die("skip expected output only valid when using specific Oracle database versions");
- }
- }
+preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
+if (!(isset($matches[0]) &&
+ (($matches[1] == 10 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] == 3) ||
+ ($matches[1] == 11 && $matches[2] == 1 && $matches[3] == 0 && $matches[4] == 6) ||
+ ($matches[1] == 11 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] == 3)
+ ))) {
+ die("skip expected output only valid when using specific Oracle database versions");
}
?>
--FILE--
diff --git a/ext/oci8/tests/bug36403.phpt b/ext/oci8/tests/bug36403.phpt
index 53dae694ec..4ac32c4b06 100644
--- a/ext/oci8/tests/bug36403.phpt
+++ b/ext/oci8/tests/bug36403.phpt
@@ -3,8 +3,9 @@ Bug #36403 (oci_execute no longer supports OCI_DESCRIBE_ONLY)
--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 with Oracle 10g or greater version of client");
+preg_match('/^[[:digit:]]+/', oci_client_version(), $matches);
+if (isset($matches[0]) && $matches[0] < 10) {
+ die("skip test expected to work only with Oracle 10g or greater version of client");
}
?>
--FILE--
diff --git a/ext/oci8/tests/bug43497.phpt b/ext/oci8/tests/bug43497.phpt
index 8c57fabeef..05798889c4 100644
--- a/ext/oci8/tests/bug43497.phpt
+++ b/ext/oci8/tests/bug43497.phpt
@@ -5,8 +5,9 @@ Bug #43497 (OCI8 XML/getClobVal aka temporary LOBs leak UGA memory)
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
require(dirname(__FILE__).'/skipif.inc');
if (getenv('SKIP_SLOW_TESTS')) die('skip slow tests excluded by request');
-if (preg_match('/^1[01]\./', oci_client_version()) != 1) {
- die("skip expected output only valid with Oracle 10g or greater version of client");
+preg_match('/^[[:digit:]]+/', oci_client_version(), $matches);
+if (isset($matches[0]) && $matches[0] < 10) {
+ die("skip test expected to work only with Oracle 10g or greater version of client");
}
?>
--FILE--
diff --git a/ext/oci8/tests/bug47281.phpt b/ext/oci8/tests/bug47281.phpt
index d0e0023537..0098ec5ebb 100644
--- a/ext/oci8/tests/bug47281.phpt
+++ b/ext/oci8/tests/bug47281.phpt
@@ -6,11 +6,12 @@ $target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on t
require(dirname(__FILE__).'/skipif.inc');
// error3.phpt obsoletes this test for newer Oracle client versions
// Assume runtime client version is >= compile time client version
-$cv = explode('.', oci_client_version());
-if ($cv[0] > 11 || ($cv[0] == 11 && $cv[1] > 2) || ($cv[0] == 11 && $cv[1] == 2 && $cv[3] >= 3)) {
+preg_match('/^[[:digit:]]+/', oci_client_version(), $matches);
+if (!isset($matches[0]) ||
+ ($matches[0] > 11 || ($matches[0] == 11 && $matches[1] > 2) || ($matches[0] == 11 && $matches[1] == 2 && $matches[3] >= 3)
+ )) {
die("skip test works only with Oracle 11.2.0.2 or earlier Oracle client libraries");
}
-
?>
--ENV--
NLS_LANG=.AL32UTF8
diff --git a/ext/oci8/tests/commit_001.phpt b/ext/oci8/tests/commit_001.phpt
index 806fb193a0..ef4018118e 100644
--- a/ext/oci8/tests/commit_001.phpt
+++ b/ext/oci8/tests/commit_001.phpt
@@ -81,48 +81,48 @@ echo "Done\n";
bool(true)
int(0)
array(5) {
- [%u|b%"ID"]=>
+ ["ID"]=>
array(0) {
}
- [%u|b%"VALUE"]=>
+ ["VALUE"]=>
array(0) {
}
- [%u|b%"BLOB"]=>
+ ["BLOB"]=>
array(0) {
}
- [%u|b%"CLOB"]=>
+ ["CLOB"]=>
array(0) {
}
- [%u|b%"STRING"]=>
+ ["STRING"]=>
array(0) {
}
}
bool(true)
int(4)
array(5) {
- [%u|b%"ID"]=>
+ ["ID"]=>
array(4) {
[0]=>
- %string|unicode%(1) "1"
+ string(1) "1"
[1]=>
- %string|unicode%(1) "1"
+ string(1) "1"
[2]=>
- %string|unicode%(1) "1"
+ string(1) "1"
[3]=>
- %string|unicode%(1) "1"
+ string(1) "1"
}
- [%u|b%"VALUE"]=>
+ ["VALUE"]=>
array(4) {
[0]=>
- %string|unicode%(1) "1"
+ string(1) "1"
[1]=>
- %string|unicode%(1) "1"
+ string(1) "1"
[2]=>
- %string|unicode%(1) "1"
+ string(1) "1"
[3]=>
- %string|unicode%(1) "1"
+ string(1) "1"
}
- [%u|b%"BLOB"]=>
+ ["BLOB"]=>
array(4) {
[0]=>
NULL
@@ -133,7 +133,7 @@ array(5) {
[3]=>
NULL
}
- [%u|b%"CLOB"]=>
+ ["CLOB"]=>
array(4) {
[0]=>
NULL
@@ -144,7 +144,7 @@ array(5) {
[3]=>
NULL
}
- [%u|b%"STRING"]=>
+ ["STRING"]=>
array(4) {
[0]=>
NULL
diff --git a/ext/oci8/tests/conn_attr.inc b/ext/oci8/tests/conn_attr.inc
index 220e688210..2edc1c9552 100644
--- a/ext/oci8/tests/conn_attr.inc
+++ b/ext/oci8/tests/conn_attr.inc
@@ -2,30 +2,28 @@
require(dirname(__FILE__)."/connect.inc");
-$sv = oci_server_version($c);
-$sv = preg_match('/Release (11\.2|12)\./', $sv, $matches);
-if ($sv == 1) {
+preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
+if ((isset($matches[1]) && $matches[1] >= 11)) {
// Server is Oracle 11.2+
$stmtarray = array(
- "drop user testuser cascade",
- "create user testuser identified by testuser",
- "grant connect,resource,dba to testuser",
- "alter user testuser enable editions",
- "drop edition myedition1",
- "drop edition myedition",
- "grant create any edition to testuser",
+ "drop user $testuser cascade",
+ "create user $testuser identified by $testpassword", // $testuser should be set by the file that includes conn_attr.inc
+ "grant connect,resource,dba to $testuser",
+ "alter user $testuser enable editions",
+ "drop edition myedition1 cascade",
+ "drop edition myedition cascade",
+ "grant create any edition to $testuser",
"create edition myedition",
"create edition myedition1 as child of myedition",
- "grant use on edition myedition to testuser",
- "grant use on edition myedition1 to testuser",
+ "grant use on edition myedition to $testuser",
+ "grant use on edition myedition1 to $testuser",
);
-}
-else {
+} else {
// Server is Pre 11.2
$stmtarray = array(
- "drop user testuser cascade",
- "create user testuser identified by testuser",
- "grant connect,resource,dba to testuser",
+ "drop user $testuser cascade",
+ "create user $testuser identified by $testpassword",
+ "grant connect,resource,dba to $testuser",
);
}
@@ -68,8 +66,8 @@ function get_attr($conn,$attr)
function get_conn($conn_type)
{
- $user = 'testuser';
- $password = 'testuser';
+ $user = $GLOBALS['testuser'];
+ $password = $GLOBALS['testpassword'];
$dbase = $GLOBALS['dbase'];
switch($conn_type) {
case 1:
@@ -139,9 +137,9 @@ function get_sys_attr($conn,$attr)
function clean_up($c) {
$stmtarray = array(
- "drop user testuser cascade",
- "drop edition myedition1",
- "drop edition myedition",
+ "drop edition myedition1 cascade",
+ "drop edition myedition cascade",
+ "drop user " . $GLOBALS['testuser'] . " cascade",
);
foreach ($stmtarray as $stmt) {
diff --git a/ext/oci8/tests/conn_attr_1.phpt b/ext/oci8/tests/conn_attr_1.phpt
index ad508a2ed2..631bc19c1d 100644
--- a/ext/oci8/tests/conn_attr_1.phpt
+++ b/ext/oci8/tests/conn_attr_1.phpt
@@ -9,15 +9,21 @@ 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 (preg_match('/Release 1[01]\./', oci_server_version($c), $matches) !== 1) {
+preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
+if (!(isset($matches[0]) && $matches[1] >= 10)) {
die("skip expected output only valid when using Oracle 10g or greater database server");
-} else if (preg_match('/^1[01]\./', oci_client_version()) != 1) {
+}
+preg_match('/^[[:digit:]]+/', oci_client_version(), $matches);
+if (isset($matches[0]) && $matches[0] < 10) {
die("skip test expected to work only with Oracle 10g or greater version of client");
}
-
?>
--FILE--
<?php
+
+$testuser = 'testuser_attr_1'; // Used in conn_attr.inc
+$testpassword = 'testuser';
+
require(dirname(__FILE__)."/conn_attr.inc");
$attr_array = array('MODULE','ACTION','CLIENT_INFO','CLIENT_IDENTIFIER');
diff --git a/ext/oci8/tests/conn_attr_2.phpt b/ext/oci8/tests/conn_attr_2.phpt
index 1072503529..432a3cff04 100644
--- a/ext/oci8/tests/conn_attr_2.phpt
+++ b/ext/oci8/tests/conn_attr_2.phpt
@@ -8,40 +8,45 @@ 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 (preg_match('/Release 1[01]\./', oci_server_version($c), $matches) !== 1) {
+preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
+if (!(isset($matches[0]) && $matches[1] >= 10)) {
die("skip expected output only valid when using Oracle 10g or greater database server");
-} else if (preg_match('/^1[01]\./', oci_client_version()) != 1) {
+}
+preg_match('/^[[:digit:]]+/', oci_client_version(), $matches);
+if (isset($matches[0]) && $matches[0] < 10) {
die("skip test expected to work only with Oracle 10g or greater version of client");
}
-
?>
--INI--
oci8.privileged_connect = On
--FILE--
<?php
+
+$testuser = 'testuser_attr_2'; // Used in conn_attr.inc
+$testpassword = 'testuser';
+
require(dirname(__FILE__)."/conn_attr.inc");
-$user='testuser';
-$password='testuser';
+
$attr_array = array('MODULE','ACTION','CLIENT_INFO','CLIENT_IDENTIFIER');
echo"**Set values using pconnect-1**\n";
-var_dump($pc1 = oci_pconnect($user,$password,$dbase));
+var_dump($pc1 = oci_pconnect($testuser,$testpassword,$dbase));
foreach($attr_array as $attr) {
set_attr($pc1,$attr,100);
}
// using pc1 again
echo"\n**Get values using pconnect-2**\n";
-var_dump($pc3 = oci_pconnect($user,$password,$dbase));
+var_dump($pc3 = oci_pconnect($testuser,$testpassword,$dbase));
foreach($attr_array as $attr) {
get_attr($pc3,$attr);
}
// Get with different pconnect
echo"\n**Get values using pconnect-3**\n";
-var_dump($pc2 = oci_pconnect($user,$password,$dbase,'UTF8'));
+var_dump($pc2 = oci_pconnect($testuser,$testpassword,$dbase,'UTF8'));
foreach($attr_array as $attr) {
get_attr($pc2,$attr);
}
@@ -52,15 +57,22 @@ oci_close($pc3);
// Re-open a persistent connection and check for the attr values.
echo "\n**Re-open a pconnect()**\n";
-var_dump($pc4 = oci_pconnect($user,$password,$dbase));
+var_dump($pc4 = oci_pconnect($testuser,$testpassword,$dbase));
foreach($attr_array as $attr) {
get_attr($pc4,$attr);
}
oci_close($pc4);
// Test with SYSDBA connection.
-var_dump($sys_c1 = oci_pconnect($user,$password,$dbase,false,OCI_SYSDBA));
-if ($sys_c1) {
+echo "\n**Test with SYSDBA connection**\n";
+$sys_c1 = @oci_pconnect($testuser,$testpassword,$dbase,false,OCI_SYSDBA);
+var_dump($sys_c1);
+if (!$sys_c1) {
+ $e = oci_error();
+ if ($e['code'] != 1031 && $e['code'] != 1017) {
+ var_dump($e);
+ }
+} else {
set_attr($sys_c1,'ACTION',10);
get_sys_attr($sys_c1,'ACTION');
get_attr($pc2,'ACTION');
@@ -100,6 +112,6 @@ The value of ACTION is TASK100
The value of CLIENT_INFO is INFO1100
The value of CLIENT_IDENTIFIER is ID00100
-Warning: oci_pconnect(): ORA-01031: %s on line %d
+**Test with SYSDBA connection**
bool(false)
Done
diff --git a/ext/oci8/tests/conn_attr_3.phpt b/ext/oci8/tests/conn_attr_3.phpt
index be8d3306de..921487c9a0 100644
--- a/ext/oci8/tests/conn_attr_3.phpt
+++ b/ext/oci8/tests/conn_attr_3.phpt
@@ -8,14 +8,21 @@ 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 (preg_match('/Release 1[01]\./', oci_server_version($c), $matches) !== 1) {
+preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
+if (!(isset($matches[0]) && $matches[1] >= 10)) {
die("skip expected output only valid when using Oracle 10g or greater database server");
-} else if (preg_match('/^1[01]\./', oci_client_version()) != 1) {
+}
+preg_match('/^[[:digit:]]+/', oci_client_version(), $matches);
+if (isset($matches[0]) && $matches[0] < 10) {
die("skip test expected to work only with Oracle 10g or greater version of client");
}
?>
--FILE--
<?php
+
+$testuser = 'testuser_attr_3'; // Used in conn_attr.inc
+$testpassword = 'testuser';
+
require(dirname(__FILE__)."/conn_attr.inc");
echo"**Test Set and get values for the attributes with oci_close() ************\n";
diff --git a/ext/oci8/tests/conn_attr_4.phpt b/ext/oci8/tests/conn_attr_4.phpt
index 4885f80b71..f32f9876d5 100644
--- a/ext/oci8/tests/conn_attr_4.phpt
+++ b/ext/oci8/tests/conn_attr_4.phpt
@@ -9,21 +9,27 @@ if (getenv('SKIP_SLOW_TESTS')) die('skip slow tests excluded by request');
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 (preg_match('/Release (11\.2|12)\./', oci_server_version($c), $matches) !== 1) {
- // Bug fixed in 11.2 prevents client_info being rest
+preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
+if (!(isset($matches[0]) &&
+ (($matches[1] == 11 && $matches[2] >= 2) ||
+ ($matches[1] >= 12)
+ ))) {
+ // Bug fixed in 11.2 prevents client_info being reset
die("skip expected output only valid when using Oracle 11gR2 or greater database server");
-} else if (preg_match('/^1[01]\./', oci_client_version()) != 1) {
+}
+preg_match('/^[[:digit:]]+/', oci_client_version(), $matches);
+if (isset($matches[0]) && $matches[0] < 10) {
die("skip test expected to work only with Oracle 10g or greater version of client");
}
?>
--FILE--
<?php
+$testuser = 'testuser_attr_4'; // Used in conn_attr.inc
+$testpassword = 'testuser';
require(dirname(__FILE__)."/conn_attr.inc");
-$user='testuser';
-$password='testuser';
$attr_array = array('MODULE','ACTION','CLIENT_INFO','CLIENT_IDENTIFIER');
echo"**Test Negative cases************\n";
@@ -40,7 +46,7 @@ var_dump(oci_set_client_info($str1,$str1));
// Setting an Invalid value.
echo "\nInvalid Value \n";
-$c1=oci_connect($user,$password,$dbase);
+$c1=oci_connect($testuser,$testpassword,$dbase);
var_dump(oci_set_action($c1,$c1));
// Setting values multiple times.
diff --git a/ext/oci8/tests/conn_attr_5.phpt b/ext/oci8/tests/conn_attr_5.phpt
index d694ec06a5..77f233b4e2 100644
--- a/ext/oci8/tests/conn_attr_5.phpt
+++ b/ext/oci8/tests/conn_attr_5.phpt
@@ -8,14 +8,21 @@ 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 (preg_match('/Release 1[01]\./', oci_server_version($c), $matches) !== 1) {
+preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
+if (!(isset($matches[0]) && $matches[1] >= 10)) {
die("skip expected output only valid when using Oracle 10g or greater database server");
-} else if (preg_match('/^1[01]\./', oci_client_version()) != 1) {
+}
+preg_match('/^[[:digit:]]+/', oci_client_version(), $matches);
+if (isset($matches[0]) && $matches[0] < 10) {
die("skip test expected to work only with Oracle 10g or greater version of client");
}
?>
--FILE--
<?php
+
+$testuser = 'testuser_attr_5'; // Used in conn_attr.inc
+$testpassword = 'testuser';
+
require(dirname(__FILE__)."/conn_attr.inc");
echo"**Test - Set and get values for the attributes with scope end ************\n";
diff --git a/ext/oci8/tests/connect_without_oracle_home.phpt b/ext/oci8/tests/connect_without_oracle_home.phpt
index e14fb93695..0acd2bc33a 100644
--- a/ext/oci8/tests/connect_without_oracle_home.phpt
+++ b/ext/oci8/tests/connect_without_oracle_home.phpt
@@ -10,8 +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) {
+preg_match('/^[[:digit:]]+/', oci_client_version(), $matches);
+if (!isset($matches[0]) || !($matches[0] == 10 && $matches[0] == 2)) {
die ("skip tests a feature that works only with Oracle 10gR2");
}
?>
diff --git a/ext/oci8/tests/connect_without_oracle_home_11.phpt b/ext/oci8/tests/connect_without_oracle_home_11.phpt
index 1620803dbb..40dc5a98fc 100644
--- a/ext/oci8/tests/connect_without_oracle_home_11.phpt
+++ b/ext/oci8/tests/connect_without_oracle_home_11.phpt
@@ -10,7 +10,11 @@ $ov = preg_match('/Compile-time ORACLE_HOME/', $phpinfo);
if ($ov != 1) {
die ("skip Test only valid when OCI8 is built with an ORACLE_HOME");
}
-if (preg_match('/^11\.2|12\./', oci_client_version()) != 1) {
+preg_match('/^[[:digit:]]+/', oci_client_version(), $matches);
+if (!(isset($matches[0]) &&
+ (($matches[0] == 11 && $matches[1] >= 2) ||
+ ($matches[0] >= 12)
+ ))) {
die("skip test expected to work only with Oracle 11gR2 or greater version of client");
}
?>
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 c7cfecf396..e04016f41a 100644
--- a/ext/oci8/tests/connect_without_oracle_home_old_11.phpt
+++ b/ext/oci8/tests/connect_without_oracle_home_old_11.phpt
@@ -10,7 +10,11 @@ $ov = preg_match('/Compile-time ORACLE_HOME/', $phpinfo);
if ($ov !== 1) {
die ("skip Test only valid when OCI8 is built with an ORACLE_HOME");
}
-if (preg_match('/^11\.2|12\./', oci_client_version()) != 1) {
+preg_match('/^[[:digit:]]+/', oci_client_version(), $matches);
+if (!(isset($matches[0]) &&
+ (($matches[0] == 11 && $matches[1] >= 2) ||
+ ($matches[0] >= 12)
+ ))) {
die("skip test expected to work only with Oracle 11gR2 or greater version of client");
}
?>
diff --git a/ext/oci8/tests/cursors_old.phpt b/ext/oci8/tests/cursors_old.phpt
index d60e2ff1ea..aa25937570 100644
--- a/ext/oci8/tests/cursors_old.phpt
+++ b/ext/oci8/tests/cursors_old.phpt
@@ -52,19 +52,19 @@ echo "Done\n";
?>
--EXPECTF--
array(2) {
- [%u|b%"ID"]=>
- %unicode|string%(1) "1"
- [%u|b%"VALUE"]=>
- %unicode|string%(1) "1"
+ ["ID"]=>
+ string(1) "1"
+ ["VALUE"]=>
+ string(1) "1"
}
bool(true)
Warning: ocifetchinto():%sORA-01002: %s in %scursors_old.php on line %d
array(2) {
- [%u|b%"ID"]=>
- %unicode|string%(1) "1"
- [%u|b%"VALUE"]=>
- %unicode|string%(1) "1"
+ ["ID"]=>
+ string(1) "1"
+ ["VALUE"]=>
+ string(1) "1"
}
bool(true)
Done
diff --git a/ext/oci8/tests/debug.phpt b/ext/oci8/tests/debug.phpt
index fe96e6e87e..66ab0f0d00 100644
--- a/ext/oci8/tests/debug.phpt
+++ b/ext/oci8/tests/debug.phpt
@@ -16,10 +16,9 @@ else {
oci_connect($user, $password);
}
-echo "Done\n";
-
oci_internal_debug(false);
?>
---EXPECTREGEX--
-^OCI8 DEBUG: .*Done$
+===DONE===
+--EXPECT--
+===DONE===
diff --git a/ext/oci8/tests/define.phpt b/ext/oci8/tests/define.phpt
index c6ce7bd9b3..b78f698e7c 100644
--- a/ext/oci8/tests/define.phpt
+++ b/ext/oci8/tests/define.phpt
@@ -44,5 +44,5 @@ echo "Done\n";
?>
--EXPECTF--
-%unicode|string%(%d) "some"
+string(%d) "some"
Done
diff --git a/ext/oci8/tests/define1.phpt b/ext/oci8/tests/define1.phpt
index 6e4b74e3ba..be16271d5b 100644
--- a/ext/oci8/tests/define1.phpt
+++ b/ext/oci8/tests/define1.phpt
@@ -55,5 +55,5 @@ bool(false)
Warning: oci_define_by_name() expects at least 3 parameters, 2 given in %s on line %d
NULL
-%unicode|string%(4) "some"
+string(4) "some"
Done
diff --git a/ext/oci8/tests/define4.phpt b/ext/oci8/tests/define4.phpt
index 266fd7edd7..3114a73937 100644
--- a/ext/oci8/tests/define4.phpt
+++ b/ext/oci8/tests/define4.phpt
@@ -58,15 +58,15 @@ echo "Done\n";
Test 1
bool(true)
Test 2
-%unicode|string%(4) "1234"
-%unicode|string%(4) "some"
-%unicode|string%(4) "some"
-%unicode|string%(4) "some"
-%unicode|string%(4) "1234"
-%unicode|string%(4) "some"
+string(4) "1234"
+string(4) "some"
+string(4) "some"
+string(4) "some"
+string(4) "1234"
+string(4) "some"
Test 3
bool(true)
-%unicode|string%(4) "some"
+string(4) "some"
Warning: oci_result(): %d is not a valid oci8 statement resource in %s on line %d
bool(false)
diff --git a/ext/oci8/tests/define5.phpt b/ext/oci8/tests/define5.phpt
index 68fa01d09a..978d66b260 100644
--- a/ext/oci8/tests/define5.phpt
+++ b/ext/oci8/tests/define5.phpt
@@ -61,12 +61,12 @@ echo "Done\n";
Test 1 - must do define before execute
bool(true)
NULL
-%unicode|string%(4) "some"
+string(4) "some"
Test 2 - normal define order
bool(true)
-%unicode|string%(4) "some"
+string(4) "some"
Test 3 - no new define done
-%unicode|string%(4) "some"
-%unicode|string%(5) "thing"
+string(4) "some"
+string(5) "thing"
Done
diff --git a/ext/oci8/tests/define_old.phpt b/ext/oci8/tests/define_old.phpt
index f65e6b8080..cc07e2ea94 100644
--- a/ext/oci8/tests/define_old.phpt
+++ b/ext/oci8/tests/define_old.phpt
@@ -44,5 +44,5 @@ echo "Done\n";
?>
--EXPECTF--
-%unicode|string%(4) "some"
+string(4) "some"
Done
diff --git a/ext/oci8/tests/details.inc b/ext/oci8/tests/details.inc
index 9a86c46868..e54ea84abd 100644
--- a/ext/oci8/tests/details.inc
+++ b/ext/oci8/tests/details.inc
@@ -52,7 +52,7 @@ if (!function_exists('oci8_test_sql_execute')) {
$s = oci_parse($c, $stmt);
if (!$s) {
$m = oci_error($c);
- echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
+ echo "oci8_test_sql_execute() error:". PHP_EOL . $stmt . PHP_EOL . $m['message'] . PHP_EOL;
}
else {
$r = @oci_execute($s);
@@ -66,7 +66,7 @@ if (!function_exists('oci8_test_sql_execute')) {
, 4080 // trigger does not exist
, 38802 // edition does not exist
))) {
- echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
+ echo "oci8_test_sql_execute() error:". PHP_EOL . $stmt . PHP_EOL . $m['message'] . PHP_EOL;
}
}
}
diff --git a/ext/oci8/tests/edition_1.phpt b/ext/oci8/tests/edition_1.phpt
index b9c8fd817e..d8ca53cddf 100644
--- a/ext/oci8/tests/edition_1.phpt
+++ b/ext/oci8/tests/edition_1.phpt
@@ -24,6 +24,9 @@ if (preg_match('/Release (1[1]\.2|12)\./', oci_server_version($c), $matches) !==
* already
*/
+$testuser = 'testuser_attr_1'; // Used in conn_attr.inc
+$testpassword = 'testuser';
+
require(dirname(__FILE__)."/conn_attr.inc");
function select_fn($conn) {
@@ -39,7 +42,7 @@ function select_fn($conn) {
select from both the editions and verify the contents. */
set_edit_attr('MYEDITION');
-$conn = oci_connect('testuser','testuser',$dbase);
+$conn = oci_connect($testuser,$testpassword,$dbase);
if ($conn === false) {
$m = oci_error();
die("Error:" . $m['message']);
@@ -61,7 +64,7 @@ select_fn($conn);
// Create a different version of view_ed in MYEDITION1.
set_edit_attr('MYEDITION1');
-$conn2 = oci_new_connect('testuser','testuser',$dbase);
+$conn2 = oci_new_connect($testuser,$testpassword,$dbase);
$stmt = "create or replace editioning view view_ed as select name,age,job,salary from edit_tab";
$s = oci_parse($conn2, $stmt);
oci_execute($s);
@@ -87,58 +90,58 @@ The value of edition has been successfully set
The value of current EDITION is MYEDITION
array(3) {
[0]=>
- %unicode|string%(%d) "mike"
+ string(%d) "mike"
[1]=>
- %unicode|string%(%d) "30"
+ string(%d) "30"
[2]=>
- %unicode|string%(%d) "Senior engineer"
+ string(%d) "Senior engineer"
}
array(3) {
[0]=>
- %unicode|string%(%d) "juan"
+ string(%d) "juan"
[1]=>
- %unicode|string%(%d) "25"
+ string(%d) "25"
[2]=>
- %unicode|string%(%d) "engineer"
+ string(%d) "engineer"
}
The value of edition has been successfully set
The value of current EDITION is MYEDITION1
array(4) {
[0]=>
- %unicode|string%(%d) "mike"
+ string(%d) "mike"
[1]=>
- %unicode|string%(%d) "30"
+ string(%d) "30"
[2]=>
- %unicode|string%(%d) "Senior engineer"
+ string(%d) "Senior engineer"
[3]=>
- %unicode|string%(%d) "200"
+ string(%d) "200"
}
array(4) {
[0]=>
- %unicode|string%(%d) "juan"
+ string(%d) "juan"
[1]=>
- %unicode|string%(%d) "25"
+ string(%d) "25"
[2]=>
- %unicode|string%(%d) "engineer"
+ string(%d) "engineer"
[3]=>
- %unicode|string%(%d) "100"
+ string(%d) "100"
}
version of view_ed in MYEDITION
The value of current EDITION is MYEDITION
array(3) {
[0]=>
- %unicode|string%(%d) "mike"
+ string(%d) "mike"
[1]=>
- %unicode|string%(%d) "30"
+ string(%d) "30"
[2]=>
- %unicode|string%(%d) "Senior engineer"
+ string(%d) "Senior engineer"
}
array(3) {
[0]=>
- %unicode|string%(%d) "juan"
+ string(%d) "juan"
[1]=>
- %unicode|string%(%d) "25"
+ string(%d) "25"
[2]=>
- %unicode|string%(%d) "engineer"
+ string(%d) "engineer"
}
Done
diff --git a/ext/oci8/tests/edition_2.phpt b/ext/oci8/tests/edition_2.phpt
index 030e6a673c..0ffb62dc32 100644
--- a/ext/oci8/tests/edition_2.phpt
+++ b/ext/oci8/tests/edition_2.phpt
@@ -24,10 +24,10 @@ if (preg_match('/Release (1[1]\.2|12)\./', oci_server_version($c), $matches) !==
* already
*/
-require(dirname(__FILE__)."/conn_attr.inc");
+$testuser = 'testuser_ed_2'; // Used in conn_attr.inc
+$testpassword = 'testuser';
-$user = 'testuser';
-$password = 'testuser';
+require(dirname(__FILE__)."/conn_attr.inc");
echo"**Test 1.1 - Default value for the attribute **************\n";
get_edit_attr($c);
@@ -50,7 +50,7 @@ get_edit_attr($conn3);
oci_close($conn1);
// With a oci_pconnect with a different charset.
-$pc1 = oci_pconnect($user,$password,$dbase,"utf8");
+$pc1 = oci_pconnect($testuser,$testpassword,$dbase,"utf8");
get_edit_attr($pc1);
oci_close($pc1);
@@ -145,7 +145,7 @@ function set_scope() {
}
function get_scope() {
- $sc1 = oci_connect($GLOBALS['user'],$GLOBALS['password'],$GLOBALS['dbase']);
+ $sc1 = oci_connect($GLOBALS['testuser'],$GLOBALS['testpassword'],$GLOBALS['dbase']);
if ($sc1 === false) {
$m = oci_error();
die("Error:" . $m['message']);
diff --git a/ext/oci8/tests/error_set.phpt b/ext/oci8/tests/error_set.phpt
new file mode 100644
index 0000000000..ad56e8aefa
--- /dev/null
+++ b/ext/oci8/tests/error_set.phpt
@@ -0,0 +1,72 @@
+--TEST--
+Check oci_set_{action,client_identifier,module_name,client_info} error handling
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+error_reporting(E_ALL);
+ini_set('display_errors', 'Off');
+
+echo "Test 1\n";
+
+// Generates "ORA-24960: the attribute OCI_ATTR_* is greater than the maximum allowable length of 64"
+$s = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
+
+$r = oci_set_action($c, $s);
+var_dump($r);
+$m = oci_error($c);
+echo $m['code'] , "\n";
+
+$r = oci_set_client_identifier($c, $s);
+var_dump($r);
+$m = oci_error($c);
+echo $m['code'] , "\n";
+
+$r = oci_set_module_name($c, $s);
+var_dump($r);
+$m = oci_error($c);
+echo $m['code'] , "\n";
+
+$r = oci_set_client_info($c, $s);
+var_dump($r);
+$m = oci_error($c);
+echo $m['code'] , "\n";
+
+echo "\nTest 2\n";
+$s = "x";
+
+$r = oci_set_action($c, $s);
+var_dump($r);
+
+$r = oci_set_client_identifier($c, $s);
+var_dump($r);
+
+$r = oci_set_module_name($c, $s);
+var_dump($r);
+
+$r = oci_set_client_info($c, $s);
+var_dump($r);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1
+bool(false)
+24960
+bool(false)
+24960
+bool(false)
+24960
+bool(false)
+24960
+
+Test 2
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+===DONE===
diff --git a/ext/oci8/tests/extauth_01.phpt b/ext/oci8/tests/extauth_01.phpt
index 37f8f3834d..1194ae180d 100644
--- a/ext/oci8/tests/extauth_01.phpt
+++ b/ext/oci8/tests/extauth_01.phpt
@@ -143,56 +143,56 @@ Test 7
Warning: oci_connect(): ORA-12154: %s in %s on line %d
array(4) {
- [%u|b%"code"]=>
+ ["code"]=>
int(12154)
- [%u|b%"message"]=>
- %unicode|string%(%d) "ORA-12154: %s"
- [%u|b%"offset"]=>
+ ["message"]=>
+ string(%d) "ORA-12154: %s"
+ ["offset"]=>
int(0)
- [%u|b%"sqltext"]=>
- %unicode|string%(0) ""
+ ["sqltext"]=>
+ string(0) ""
}
bool(false)
Test 8
Warning: oci_connect(): ORA-12154: %s in %s on line %d
array(4) {
- [%u|b%"code"]=>
+ ["code"]=>
int(12154)
- [%u|b%"message"]=>
- %unicode|string%(%d) "ORA-12154: %s"
- [%u|b%"offset"]=>
+ ["message"]=>
+ string(%d) "ORA-12154: %s"
+ ["offset"]=>
int(0)
- [%u|b%"sqltext"]=>
- %unicode|string%(0) ""
+ ["sqltext"]=>
+ string(0) ""
}
bool(false)
Test 9
Warning: oci_connect(): ORA-%d: TNS:%s in %s on line %d
array(4) {
- [%u|b%"code"]=>
+ ["code"]=>
int(%d)
- [%u|b%"message"]=>
- %unicode|string%(%d) "ORA-%d: %s"
- [%u|b%"offset"]=>
+ ["message"]=>
+ string(%d) "ORA-%d: %s"
+ ["offset"]=>
int(0)
- [%u|b%"sqltext"]=>
- %unicode|string%(0) ""
+ ["sqltext"]=>
+ string(0) ""
}
bool(false)
Test 10
Warning: oci_connect(): ORA-%d: TNS:%s in %s on line %d
array(4) {
- [%u|b%"code"]=>
+ ["code"]=>
int(%d)
- [%u|b%"message"]=>
- %unicode|string%(%d) "ORA-%d: %s"
- [%u|b%"offset"]=>
+ ["message"]=>
+ string(%d) "ORA-%d: %s"
+ ["offset"]=>
int(0)
- [%u|b%"sqltext"]=>
- %unicode|string%(0) ""
+ ["sqltext"]=>
+ string(0) ""
}
bool(false)
===DONE===
diff --git a/ext/oci8/tests/extauth_02.phpt b/ext/oci8/tests/extauth_02.phpt
index f3b517f730..0a3227019c 100644
--- a/ext/oci8/tests/extauth_02.phpt
+++ b/ext/oci8/tests/extauth_02.phpt
@@ -142,56 +142,56 @@ Test 7
Warning: oci_new_connect(): ORA-12154: %s in %s on line %d
array(4) {
- [%u|b%"code"]=>
+ ["code"]=>
int(12154)
- [%u|b%"message"]=>
- %unicode|string%(%d) "ORA-12154: %s"
- [%u|b%"offset"]=>
+ ["message"]=>
+ string(%d) "ORA-12154: %s"
+ ["offset"]=>
int(0)
- [%u|b%"sqltext"]=>
- %unicode|string%(0) ""
+ ["sqltext"]=>
+ string(0) ""
}
bool(false)
Test 8
Warning: oci_new_connect(): ORA-12154: %s in %s on line %d
array(4) {
- [%u|b%"code"]=>
+ ["code"]=>
int(12154)
- [%u|b%"message"]=>
- %unicode|string%(%d) "ORA-12154: %s"
- [%u|b%"offset"]=>
+ ["message"]=>
+ string(%d) "ORA-12154: %s"
+ ["offset"]=>
int(0)
- [%u|b%"sqltext"]=>
- %unicode|string%(0) ""
+ ["sqltext"]=>
+ string(0) ""
}
bool(false)
Test 9
Warning: oci_new_connect(): ORA-%d: TNS:%s %s on line %d
array(4) {
- [%u|b%"code"]=>
+ ["code"]=>
int(%d)
- [%u|b%"message"]=>
- %unicode|string%(%d) "ORA-%d: %s"
- [%u|b%"offset"]=>
+ ["message"]=>
+ string(%d) "ORA-%d: %s"
+ ["offset"]=>
int(0)
- [%u|b%"sqltext"]=>
- %unicode|string%(0) ""
+ ["sqltext"]=>
+ string(0) ""
}
bool(false)
Test 10
Warning: oci_new_connect(): ORA-%d: TNS:%s %s on line %d
array(4) {
- [%u|b%"code"]=>
+ ["code"]=>
int(%d)
- [%u|b%"message"]=>
- %unicode|string%(%d) "ORA-%d: %s"
- [%u|b%"offset"]=>
+ ["message"]=>
+ string(%d) "ORA-%d: %s"
+ ["offset"]=>
int(0)
- [%u|b%"sqltext"]=>
- %unicode|string%(0) ""
+ ["sqltext"]=>
+ string(0) ""
}
bool(false)
===DONE===
diff --git a/ext/oci8/tests/extauth_03.phpt b/ext/oci8/tests/extauth_03.phpt
index e6685eb176..d7884ce6b4 100644
--- a/ext/oci8/tests/extauth_03.phpt
+++ b/ext/oci8/tests/extauth_03.phpt
@@ -142,56 +142,56 @@ Test 7
Warning: oci_pconnect(): ORA-12154: %s in %s on line %d
array(4) {
- [%u|b%"code"]=>
+ ["code"]=>
int(12154)
- [%u|b%"message"]=>
- %unicode|string%(%d) "ORA-12154: %s"
- [%u|b%"offset"]=>
+ ["message"]=>
+ string(%d) "ORA-12154: %s"
+ ["offset"]=>
int(0)
- [%u|b%"sqltext"]=>
- %unicode|string%(0) ""
+ ["sqltext"]=>
+ string(0) ""
}
bool(false)
Test 8
Warning: oci_pconnect(): ORA-12154: %s in %s on line %d
array(4) {
- [%u|b%"code"]=>
+ ["code"]=>
int(12154)
- [%u|b%"message"]=>
- %unicode|string%(%d) "ORA-12154: %s"
- [%u|b%"offset"]=>
+ ["message"]=>
+ string(%d) "ORA-12154: %s"
+ ["offset"]=>
int(0)
- [%u|b%"sqltext"]=>
- %unicode|string%(0) ""
+ ["sqltext"]=>
+ string(0) ""
}
bool(false)
Test 9
Warning: oci_pconnect(): ORA-%d: TNS:%s in %s on line %d
array(4) {
- [%u|b%"code"]=>
+ ["code"]=>
int(%d)
- [%u|b%"message"]=>
- %unicode|string%(%d) "ORA-%d: %s"
- [%u|b%"offset"]=>
+ ["message"]=>
+ string(%d) "ORA-%d: %s"
+ ["offset"]=>
int(0)
- [%u|b%"sqltext"]=>
- %unicode|string%(0) ""
+ ["sqltext"]=>
+ string(0) ""
}
bool(false)
Test 10
Warning: oci_pconnect(): ORA-%d: TNS:%s in %s on line %d
array(4) {
- [%u|b%"code"]=>
+ ["code"]=>
int(%d)
- [%u|b%"message"]=>
- %unicode|string%(%d) "ORA-%d: %s"
- [%u|b%"offset"]=>
+ ["message"]=>
+ string(%d) "ORA-%d: %s"
+ ["offset"]=>
int(0)
- [%u|b%"sqltext"]=>
- %unicode|string%(0) ""
+ ["sqltext"]=>
+ string(0) ""
}
bool(false)
===DONE===
diff --git a/ext/oci8/tests/fetch.phpt b/ext/oci8/tests/fetch.phpt
index e48aeefd87..b968ae4bf6 100644
--- a/ext/oci8/tests/fetch.phpt
+++ b/ext/oci8/tests/fetch.phpt
@@ -47,10 +47,10 @@ oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
?>
--EXPECTF--
-%unicode|string%(1) "1"
-%unicode|string%(1) "1"
-%unicode|string%(1) "1"
-%unicode|string%(1) "1"
-%unicode|string%(1) "1"
-%unicode|string%(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
Done
diff --git a/ext/oci8/tests/fetch_all.phpt b/ext/oci8/tests/fetch_all.phpt
index 4fc41daad4..b8155b170b 100644
--- a/ext/oci8/tests/fetch_all.phpt
+++ b/ext/oci8/tests/fetch_all.phpt
@@ -51,44 +51,44 @@ echo "Done\n";
--EXPECTF--
int(3)
array(2) {
- [%u|b%"ID"]=>
+ ["ID"]=>
array(3) {
[0]=>
- %unicode|string%(1) "1"
+ string(1) "1"
[1]=>
- %unicode|string%(1) "1"
+ string(1) "1"
[2]=>
- %unicode|string%(1) "1"
+ string(1) "1"
}
- [%u|b%"VALUE"]=>
+ ["VALUE"]=>
array(3) {
[0]=>
- %unicode|string%(1) "1"
+ string(1) "1"
[1]=>
- %unicode|string%(1) "1"
+ string(1) "1"
[2]=>
- %unicode|string%(1) "1"
+ string(1) "1"
}
}
int(3)
array(2) {
- [%u|b%"ID"]=>
+ ["ID"]=>
array(3) {
[0]=>
- %unicode|string%(1) "1"
+ string(1) "1"
[1]=>
- %unicode|string%(1) "1"
+ string(1) "1"
[2]=>
- %unicode|string%(1) "1"
+ string(1) "1"
}
- [%u|b%"VALUE"]=>
+ ["VALUE"]=>
array(3) {
[0]=>
- %unicode|string%(1) "1"
+ string(1) "1"
[1]=>
- %unicode|string%(1) "1"
+ string(1) "1"
[2]=>
- %unicode|string%(1) "1"
+ string(1) "1"
}
}
Done
diff --git a/ext/oci8/tests/fetch_all1.phpt b/ext/oci8/tests/fetch_all1.phpt
index 4fc41daad4..b8155b170b 100644
--- a/ext/oci8/tests/fetch_all1.phpt
+++ b/ext/oci8/tests/fetch_all1.phpt
@@ -51,44 +51,44 @@ echo "Done\n";
--EXPECTF--
int(3)
array(2) {
- [%u|b%"ID"]=>
+ ["ID"]=>
array(3) {
[0]=>
- %unicode|string%(1) "1"
+ string(1) "1"
[1]=>
- %unicode|string%(1) "1"
+ string(1) "1"
[2]=>
- %unicode|string%(1) "1"
+ string(1) "1"
}
- [%u|b%"VALUE"]=>
+ ["VALUE"]=>
array(3) {
[0]=>
- %unicode|string%(1) "1"
+ string(1) "1"
[1]=>
- %unicode|string%(1) "1"
+ string(1) "1"
[2]=>
- %unicode|string%(1) "1"
+ string(1) "1"
}
}
int(3)
array(2) {
- [%u|b%"ID"]=>
+ ["ID"]=>
array(3) {
[0]=>
- %unicode|string%(1) "1"
+ string(1) "1"
[1]=>
- %unicode|string%(1) "1"
+ string(1) "1"
[2]=>
- %unicode|string%(1) "1"
+ string(1) "1"
}
- [%u|b%"VALUE"]=>
+ ["VALUE"]=>
array(3) {
[0]=>
- %unicode|string%(1) "1"
+ string(1) "1"
[1]=>
- %unicode|string%(1) "1"
+ string(1) "1"
[2]=>
- %unicode|string%(1) "1"
+ string(1) "1"
}
}
Done
diff --git a/ext/oci8/tests/fetch_all3.phpt b/ext/oci8/tests/fetch_all3.phpt
index 1748ea5658..4c0be1cc07 100644
--- a/ext/oci8/tests/fetch_all3.phpt
+++ b/ext/oci8/tests/fetch_all3.phpt
@@ -129,105 +129,105 @@ echo "Done\n";
None
int(4)
array(2) {
- [%u|b%"ID"]=>
+ ["ID"]=>
array(4) {
[0]=>
- %unicode|string%(1) "1"
+ string(1) "1"
[1]=>
- %unicode|string%(1) "2"
+ string(1) "2"
[2]=>
- %unicode|string%(1) "3"
+ string(1) "3"
[3]=>
- %unicode|string%(1) "4"
+ string(1) "4"
}
- [%u|b%"VALUE"]=>
+ ["VALUE"]=>
array(4) {
[0]=>
- %unicode|string%(2) "-1"
+ string(2) "-1"
[1]=>
- %unicode|string%(2) "-2"
+ string(2) "-2"
[2]=>
- %unicode|string%(2) "-3"
+ string(2) "-3"
[3]=>
- %unicode|string%(2) "-4"
+ string(2) "-4"
}
}
OCI_ASSOC
int(4)
array(2) {
- [%u|b%"ID"]=>
+ ["ID"]=>
array(4) {
[0]=>
- %unicode|string%(1) "1"
+ string(1) "1"
[1]=>
- %unicode|string%(1) "2"
+ string(1) "2"
[2]=>
- %unicode|string%(1) "3"
+ string(1) "3"
[3]=>
- %unicode|string%(1) "4"
+ string(1) "4"
}
- [%u|b%"VALUE"]=>
+ ["VALUE"]=>
array(4) {
[0]=>
- %unicode|string%(2) "-1"
+ string(2) "-1"
[1]=>
- %unicode|string%(2) "-2"
+ string(2) "-2"
[2]=>
- %unicode|string%(2) "-3"
+ string(2) "-3"
[3]=>
- %unicode|string%(2) "-4"
+ string(2) "-4"
}
}
OCI_FETCHSTATEMENT_BY_COLUMN
int(4)
array(2) {
- [%u|b%"ID"]=>
+ ["ID"]=>
array(4) {
[0]=>
- %unicode|string%(1) "1"
+ string(1) "1"
[1]=>
- %unicode|string%(1) "2"
+ string(1) "2"
[2]=>
- %unicode|string%(1) "3"
+ string(1) "3"
[3]=>
- %unicode|string%(1) "4"
+ string(1) "4"
}
- [%u|b%"VALUE"]=>
+ ["VALUE"]=>
array(4) {
[0]=>
- %unicode|string%(2) "-1"
+ string(2) "-1"
[1]=>
- %unicode|string%(2) "-2"
+ string(2) "-2"
[2]=>
- %unicode|string%(2) "-3"
+ string(2) "-3"
[3]=>
- %unicode|string%(2) "-4"
+ string(2) "-4"
}
}
OCI_FETCHSTATEMENT_BY_COLUMN|OCI_ASSOC
int(4)
array(2) {
- [%u|b%"ID"]=>
+ ["ID"]=>
array(4) {
[0]=>
- %unicode|string%(1) "1"
+ string(1) "1"
[1]=>
- %unicode|string%(1) "2"
+ string(1) "2"
[2]=>
- %unicode|string%(1) "3"
+ string(1) "3"
[3]=>
- %unicode|string%(1) "4"
+ string(1) "4"
}
- [%u|b%"VALUE"]=>
+ ["VALUE"]=>
array(4) {
[0]=>
- %unicode|string%(2) "-1"
+ string(2) "-1"
[1]=>
- %unicode|string%(2) "-2"
+ string(2) "-2"
[2]=>
- %unicode|string%(2) "-3"
+ string(2) "-3"
[3]=>
- %unicode|string%(2) "-4"
+ string(2) "-4"
}
}
OCI_FETCHSTATEMENT_BY_COLUMN|OCI_NUM
@@ -236,24 +236,24 @@ array(2) {
[0]=>
array(4) {
[0]=>
- %unicode|string%(1) "1"
+ string(1) "1"
[1]=>
- %unicode|string%(1) "2"
+ string(1) "2"
[2]=>
- %unicode|string%(1) "3"
+ string(1) "3"
[3]=>
- %unicode|string%(1) "4"
+ string(1) "4"
}
[1]=>
array(4) {
[0]=>
- %unicode|string%(2) "-1"
+ string(2) "-1"
[1]=>
- %unicode|string%(2) "-2"
+ string(2) "-2"
[2]=>
- %unicode|string%(2) "-3"
+ string(2) "-3"
[3]=>
- %unicode|string%(2) "-4"
+ string(2) "-4"
}
}
OCI_FETCHSTATEMENT_BY_COLUMN|OCI_NUM|OCI_ASSOC
@@ -262,24 +262,24 @@ array(2) {
[0]=>
array(4) {
[0]=>
- %unicode|string%(1) "1"
+ string(1) "1"
[1]=>
- %unicode|string%(1) "2"
+ string(1) "2"
[2]=>
- %unicode|string%(1) "3"
+ string(1) "3"
[3]=>
- %unicode|string%(1) "4"
+ string(1) "4"
}
[1]=>
array(4) {
[0]=>
- %unicode|string%(2) "-1"
+ string(2) "-1"
[1]=>
- %unicode|string%(2) "-2"
+ string(2) "-2"
[2]=>
- %unicode|string%(2) "-3"
+ string(2) "-3"
[3]=>
- %unicode|string%(2) "-4"
+ string(2) "-4"
}
}
OCI_FETCHSTATEMENT_BY_ROW
@@ -287,31 +287,31 @@ int(4)
array(4) {
[0]=>
array(2) {
- [%u|b%"ID"]=>
- %unicode|string%(1) "1"
- [%u|b%"VALUE"]=>
- %unicode|string%(2) "-1"
+ ["ID"]=>
+ string(1) "1"
+ ["VALUE"]=>
+ string(2) "-1"
}
[1]=>
array(2) {
- [%u|b%"ID"]=>
- %unicode|string%(1) "2"
- [%u|b%"VALUE"]=>
- %unicode|string%(2) "-2"
+ ["ID"]=>
+ string(1) "2"
+ ["VALUE"]=>
+ string(2) "-2"
}
[2]=>
array(2) {
- [%u|b%"ID"]=>
- %unicode|string%(1) "3"
- [%u|b%"VALUE"]=>
- %unicode|string%(2) "-3"
+ ["ID"]=>
+ string(1) "3"
+ ["VALUE"]=>
+ string(2) "-3"
}
[3]=>
array(2) {
- [%u|b%"ID"]=>
- %unicode|string%(1) "4"
- [%u|b%"VALUE"]=>
- %unicode|string%(2) "-4"
+ ["ID"]=>
+ string(1) "4"
+ ["VALUE"]=>
+ string(2) "-4"
}
}
OCI_FETCHSTATEMENT_BY_ROW|OCI_ASSOC
@@ -319,31 +319,31 @@ int(4)
array(4) {
[0]=>
array(2) {
- [%u|b%"ID"]=>
- %unicode|string%(1) "1"
- [%u|b%"VALUE"]=>
- %unicode|string%(2) "-1"
+ ["ID"]=>
+ string(1) "1"
+ ["VALUE"]=>
+ string(2) "-1"
}
[1]=>
array(2) {
- [%u|b%"ID"]=>
- %unicode|string%(1) "2"
- [%u|b%"VALUE"]=>
- %unicode|string%(2) "-2"
+ ["ID"]=>
+ string(1) "2"
+ ["VALUE"]=>
+ string(2) "-2"
}
[2]=>
array(2) {
- [%u|b%"ID"]=>
- %unicode|string%(1) "3"
- [%u|b%"VALUE"]=>
- %unicode|string%(2) "-3"
+ ["ID"]=>
+ string(1) "3"
+ ["VALUE"]=>
+ string(2) "-3"
}
[3]=>
array(2) {
- [%u|b%"ID"]=>
- %unicode|string%(1) "4"
- [%u|b%"VALUE"]=>
- %unicode|string%(2) "-4"
+ ["ID"]=>
+ string(1) "4"
+ ["VALUE"]=>
+ string(2) "-4"
}
}
OCI_FETCHSTATEMENT_BY_ROW|OCI_FETCHSTATEMENT_BY_COLUMN
@@ -351,31 +351,31 @@ int(4)
array(4) {
[0]=>
array(2) {
- [%u|b%"ID"]=>
- %unicode|string%(1) "1"
- [%u|b%"VALUE"]=>
- %unicode|string%(2) "-1"
+ ["ID"]=>
+ string(1) "1"
+ ["VALUE"]=>
+ string(2) "-1"
}
[1]=>
array(2) {
- [%u|b%"ID"]=>
- %unicode|string%(1) "2"
- [%u|b%"VALUE"]=>
- %unicode|string%(2) "-2"
+ ["ID"]=>
+ string(1) "2"
+ ["VALUE"]=>
+ string(2) "-2"
}
[2]=>
array(2) {
- [%u|b%"ID"]=>
- %unicode|string%(1) "3"
- [%u|b%"VALUE"]=>
- %unicode|string%(2) "-3"
+ ["ID"]=>
+ string(1) "3"
+ ["VALUE"]=>
+ string(2) "-3"
}
[3]=>
array(2) {
- [%u|b%"ID"]=>
- %unicode|string%(1) "4"
- [%u|b%"VALUE"]=>
- %unicode|string%(2) "-4"
+ ["ID"]=>
+ string(1) "4"
+ ["VALUE"]=>
+ string(2) "-4"
}
}
OCI_FETCHSTATEMENT_BY_ROW|OCI_FETCHSTATEMENT_BY_COLUMN|OCI_ASSOC
@@ -383,31 +383,31 @@ int(4)
array(4) {
[0]=>
array(2) {
- [%u|b%"ID"]=>
- %unicode|string%(1) "1"
- [%u|b%"VALUE"]=>
- %unicode|string%(2) "-1"
+ ["ID"]=>
+ string(1) "1"
+ ["VALUE"]=>
+ string(2) "-1"
}
[1]=>
array(2) {
- [%u|b%"ID"]=>
- %unicode|string%(1) "2"
- [%u|b%"VALUE"]=>
- %unicode|string%(2) "-2"
+ ["ID"]=>
+ string(1) "2"
+ ["VALUE"]=>
+ string(2) "-2"
}
[2]=>
array(2) {
- [%u|b%"ID"]=>
- %unicode|string%(1) "3"
- [%u|b%"VALUE"]=>
- %unicode|string%(2) "-3"
+ ["ID"]=>
+ string(1) "3"
+ ["VALUE"]=>
+ string(2) "-3"
}
[3]=>
array(2) {
- [%u|b%"ID"]=>
- %unicode|string%(1) "4"
- [%u|b%"VALUE"]=>
- %unicode|string%(2) "-4"
+ ["ID"]=>
+ string(1) "4"
+ ["VALUE"]=>
+ string(2) "-4"
}
}
OCI_FETCHSTATEMENT_BY_ROW|OCI_FETCHSTATEMENT_BY_COLUMN|OCI_NUM
@@ -416,30 +416,30 @@ array(4) {
[0]=>
array(2) {
[0]=>
- %unicode|string%(1) "1"
+ string(1) "1"
[1]=>
- %unicode|string%(2) "-1"
+ string(2) "-1"
}
[1]=>
array(2) {
[0]=>
- %unicode|string%(1) "2"
+ string(1) "2"
[1]=>
- %unicode|string%(2) "-2"
+ string(2) "-2"
}
[2]=>
array(2) {
[0]=>
- %unicode|string%(1) "3"
+ string(1) "3"
[1]=>
- %unicode|string%(2) "-3"
+ string(2) "-3"
}
[3]=>
array(2) {
[0]=>
- %unicode|string%(1) "4"
+ string(1) "4"
[1]=>
- %unicode|string%(2) "-4"
+ string(2) "-4"
}
}
OCI_FETCHSTATEMENT_BY_ROW|OCI_FETCHSTATEMENT_BY_COLUMN|OCI_NUM|OCI_ASSOC
@@ -448,30 +448,30 @@ array(4) {
[0]=>
array(2) {
[0]=>
- %unicode|string%(1) "1"
+ string(1) "1"
[1]=>
- %unicode|string%(2) "-1"
+ string(2) "-1"
}
[1]=>
array(2) {
[0]=>
- %unicode|string%(1) "2"
+ string(1) "2"
[1]=>
- %unicode|string%(2) "-2"
+ string(2) "-2"
}
[2]=>
array(2) {
[0]=>
- %unicode|string%(1) "3"
+ string(1) "3"
[1]=>
- %unicode|string%(2) "-3"
+ string(2) "-3"
}
[3]=>
array(2) {
[0]=>
- %unicode|string%(1) "4"
+ string(1) "4"
[1]=>
- %unicode|string%(2) "-4"
+ string(2) "-4"
}
}
OCI_FETCHSTATEMENT_BY_ROW|OCI_NUM
@@ -480,30 +480,30 @@ array(4) {
[0]=>
array(2) {
[0]=>
- %unicode|string%(1) "1"
+ string(1) "1"
[1]=>
- %unicode|string%(2) "-1"
+ string(2) "-1"
}
[1]=>
array(2) {
[0]=>
- %unicode|string%(1) "2"
+ string(1) "2"
[1]=>
- %unicode|string%(2) "-2"
+ string(2) "-2"
}
[2]=>
array(2) {
[0]=>
- %unicode|string%(1) "3"
+ string(1) "3"
[1]=>
- %unicode|string%(2) "-3"
+ string(2) "-3"
}
[3]=>
array(2) {
[0]=>
- %unicode|string%(1) "4"
+ string(1) "4"
[1]=>
- %unicode|string%(2) "-4"
+ string(2) "-4"
}
}
OCI_FETCHSTATEMENT_BY_ROW|OCI_NUM|OCI_ASSOC
@@ -512,30 +512,30 @@ array(4) {
[0]=>
array(2) {
[0]=>
- %unicode|string%(1) "1"
+ string(1) "1"
[1]=>
- %unicode|string%(2) "-1"
+ string(2) "-1"
}
[1]=>
array(2) {
[0]=>
- %unicode|string%(1) "2"
+ string(1) "2"
[1]=>
- %unicode|string%(2) "-2"
+ string(2) "-2"
}
[2]=>
array(2) {
[0]=>
- %unicode|string%(1) "3"
+ string(1) "3"
[1]=>
- %unicode|string%(2) "-3"
+ string(2) "-3"
}
[3]=>
array(2) {
[0]=>
- %unicode|string%(1) "4"
+ string(1) "4"
[1]=>
- %unicode|string%(2) "-4"
+ string(2) "-4"
}
}
OCI_NUM
@@ -544,24 +544,24 @@ array(2) {
[0]=>
array(4) {
[0]=>
- %unicode|string%(1) "1"
+ string(1) "1"
[1]=>
- %unicode|string%(1) "2"
+ string(1) "2"
[2]=>
- %unicode|string%(1) "3"
+ string(1) "3"
[3]=>
- %unicode|string%(1) "4"
+ string(1) "4"
}
[1]=>
array(4) {
[0]=>
- %unicode|string%(2) "-1"
+ string(2) "-1"
[1]=>
- %unicode|string%(2) "-2"
+ string(2) "-2"
[2]=>
- %unicode|string%(2) "-3"
+ string(2) "-3"
[3]=>
- %unicode|string%(2) "-4"
+ string(2) "-4"
}
}
OCI_NUM|OCI_ASSOC
@@ -570,24 +570,24 @@ array(2) {
[0]=>
array(4) {
[0]=>
- %unicode|string%(1) "1"
+ string(1) "1"
[1]=>
- %unicode|string%(1) "2"
+ string(1) "2"
[2]=>
- %unicode|string%(1) "3"
+ string(1) "3"
[3]=>
- %unicode|string%(1) "4"
+ string(1) "4"
}
[1]=>
array(4) {
[0]=>
- %unicode|string%(2) "-1"
+ string(2) "-1"
[1]=>
- %unicode|string%(2) "-2"
+ string(2) "-2"
[2]=>
- %unicode|string%(2) "-3"
+ string(2) "-3"
[3]=>
- %unicode|string%(2) "-4"
+ string(2) "-4"
}
}
Done
diff --git a/ext/oci8/tests/fetch_all4.phpt b/ext/oci8/tests/fetch_all4.phpt
index 1d3c9677ee..1d4a8df7b7 100644
--- a/ext/oci8/tests/fetch_all4.phpt
+++ b/ext/oci8/tests/fetch_all4.phpt
@@ -51,10 +51,10 @@ oci8_test_sql_execute($c, $stmtarray);
Test 1
int(0)
array(2) {
- [%u|b%"MYCOL1"]=>
+ ["MYCOL1"]=>
array(0) {
}
- [%u|b%"MYCOL2"]=>
+ ["MYCOL2"]=>
array(0) {
}
}
diff --git a/ext/oci8/tests/fetch_all5.phpt b/ext/oci8/tests/fetch_all5.phpt
index a6bb3c3f18..d82fd30e41 100644
--- a/ext/oci8/tests/fetch_all5.phpt
+++ b/ext/oci8/tests/fetch_all5.phpt
@@ -62,45 +62,45 @@ oci_close($c);
Test 1
int(3)
array(2) {
- [%u|b%"MYCOL1"]=>
+ ["MYCOL1"]=>
array(3) {
[0]=>
- %unicode|string%(1) "1"
+ string(1) "1"
[1]=>
- %unicode|string%(1) "2"
+ string(1) "2"
[2]=>
- %unicode|string%(1) "3"
+ string(1) "3"
}
- [%u|b%"MYCOL2"]=>
+ ["MYCOL2"]=>
array(3) {
[0]=>
- %unicode|string%(3) "abc"
+ string(3) "abc"
[1]=>
- %unicode|string%(3) "def"
+ string(3) "def"
[2]=>
- %unicode|string%(3) "ghi"
+ string(3) "ghi"
}
}
Test 1
int(3)
array(2) {
- [%u|b%"MYCOL1"]=>
+ ["MYCOL1"]=>
array(3) {
[0]=>
- %unicode|string%(1) "1"
+ string(1) "1"
[1]=>
- %unicode|string%(1) "2"
+ string(1) "2"
[2]=>
- %unicode|string%(1) "3"
+ string(1) "3"
}
- [%u|b%"MYCOL2"]=>
+ ["MYCOL2"]=>
array(3) {
[0]=>
- %unicode|string%(3) "abc"
+ string(3) "abc"
[1]=>
- %unicode|string%(3) "def"
+ string(3) "def"
[2]=>
- %unicode|string%(3) "ghi"
+ string(3) "ghi"
}
}
Test 3
diff --git a/ext/oci8/tests/fetch_into.phpt b/ext/oci8/tests/fetch_into.phpt
index 45a6a8132e..d90c4d95dc 100644
--- a/ext/oci8/tests/fetch_into.phpt
+++ b/ext/oci8/tests/fetch_into.phpt
@@ -53,19 +53,19 @@ echo "Done\n";
int(2)
array(2) {
[0]=>
- %unicode|string%(1) "1"
+ string(1) "1"
[1]=>
- %unicode|string%(1) "1"
+ string(1) "1"
}
int(2)
array(4) {
[0]=>
- %unicode|string%(1) "1"
- [%u|b%"ID"]=>
- %unicode|string%(1) "1"
+ string(1) "1"
+ ["ID"]=>
+ string(1) "1"
[1]=>
- %unicode|string%(1) "1"
- [%u|b%"VALUE"]=>
- %unicode|string%(1) "1"
+ string(1) "1"
+ ["VALUE"]=>
+ string(1) "1"
}
Done
diff --git a/ext/oci8/tests/fetch_object.phpt b/ext/oci8/tests/fetch_object.phpt
index 1c290d5e95..73711baa18 100644
--- a/ext/oci8/tests/fetch_object.phpt
+++ b/ext/oci8/tests/fetch_object.phpt
@@ -82,28 +82,28 @@ oci8_test_sql_execute($c, $stmtarray);
--EXPECTF--
Test 1
object(stdClass)#1 (3) {
- [%u|b%"caseSensitive"]=>
- %unicode|string%(3) "123"
- [%u|b%"SECONDCOL"]=>
- %unicode|string%(19) "1st row col2 string"
- [%u|b%"ANOTHERCOL"]=>
- %unicode|string%(15) "1 more text "
+ ["caseSensitive"]=>
+ string(3) "123"
+ ["SECONDCOL"]=>
+ string(19) "1st row col2 string"
+ ["ANOTHERCOL"]=>
+ string(15) "1 more text "
}
object(stdClass)#2 (3) {
- [%u|b%"caseSensitive"]=>
- %unicode|string%(3) "456"
- [%u|b%"SECONDCOL"]=>
- %unicode|string%(19) "2nd row col2 string"
- [%u|b%"ANOTHERCOL"]=>
- %unicode|string%(15) "2 more text "
+ ["caseSensitive"]=>
+ string(3) "456"
+ ["SECONDCOL"]=>
+ string(19) "2nd row col2 string"
+ ["ANOTHERCOL"]=>
+ string(15) "2 more text "
}
object(stdClass)#1 (3) {
- [%u|b%"caseSensitive"]=>
- %unicode|string%(3) "789"
- [%u|b%"SECONDCOL"]=>
- %unicode|string%(19) "3rd row col2 string"
- [%u|b%"ANOTHERCOL"]=>
- %unicode|string%(15) "3 more text "
+ ["caseSensitive"]=>
+ string(3) "789"
+ ["SECONDCOL"]=>
+ string(19) "3rd row col2 string"
+ ["ANOTHERCOL"]=>
+ string(15) "3 more text "
}
Test 2
123
diff --git a/ext/oci8/tests/fetch_row.phpt b/ext/oci8/tests/fetch_row.phpt
index 2b28634ab3..40bc4f893c 100644
--- a/ext/oci8/tests/fetch_row.phpt
+++ b/ext/oci8/tests/fetch_row.phpt
@@ -46,20 +46,20 @@ echo "Done\n";
--EXPECTF--
array(2) {
[0]=>
- %unicode|string%(1) "1"
+ string(1) "1"
[1]=>
- %unicode|string%(1) "1"
+ string(1) "1"
}
array(2) {
[0]=>
- %unicode|string%(1) "1"
+ string(1) "1"
[1]=>
- %unicode|string%(1) "1"
+ string(1) "1"
}
array(2) {
[0]=>
- %unicode|string%(1) "1"
+ string(1) "1"
[1]=>
- %unicode|string%(1) "1"
+ string(1) "1"
}
Done
diff --git a/ext/oci8/tests/field_funcs1.phpt b/ext/oci8/tests/field_funcs1.phpt
index c14ee8957e..41d8627ce4 100644
--- a/ext/oci8/tests/field_funcs1.phpt
+++ b/ext/oci8/tests/field_funcs1.phpt
@@ -85,9 +85,9 @@ echo "Done\n";
--EXPECTF--
array(2) {
[0]=>
- %unicode|string%(1) "1"
+ string(1) "1"
[1]=>
- %unicode|string%(1) "1"
+ string(1) "1"
}
Test 1
diff --git a/ext/oci8/tests/function_aliases.phpt b/ext/oci8/tests/function_aliases.phpt
index 4c6ce83759..2c890d6403 100644
--- a/ext/oci8/tests/function_aliases.phpt
+++ b/ext/oci8/tests/function_aliases.phpt
@@ -104,8 +104,6 @@ NULL
Warning: ocifreestatement() expects exactly 1 parameter, 0 given in %s on line %d
NULL
-
-Warning: ociinternaldebug() expects exactly 1 parameter, 0 given in %s on line %d
NULL
Warning: ocinumcols() expects exactly 1 parameter, 0 given in %s on line %d
diff --git a/ext/oci8/tests/imp_res_1.phpt b/ext/oci8/tests/imp_res_1.phpt
new file mode 100644
index 0000000000..a36f89f4da
--- /dev/null
+++ b/ext/oci8/tests/imp_res_1.phpt
@@ -0,0 +1,630 @@
+--TEST--
+Oracle Database 12c Implicit Result Sets: basic test
+--SKIPIF--
+<?php
+if (!extension_loaded('oci8')) die ("skip no oci8 extension");
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
+if (!(isset($matches[0]) && $matches[1] >= 12)) {
+ die("skip expected output only valid when using Oracle Database 12c or greater");
+}
+preg_match('/^[[:digit:]]+/', oci_client_version(), $matches);
+if (!(isset($matches[0]) && $matches[0] >= 12)) {
+ die("skip works only with Oracle 12c or greater version of Oracle client libraries");
+}
+?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+ "drop table imp_res_1_tab_1",
+ "create table imp_res_1_tab_1 (c1 number, c2 varchar2(10))",
+ "insert into imp_res_1_tab_1 values (1, 'abcde')",
+ "insert into imp_res_1_tab_1 values (2, 'fghij')",
+ "insert into imp_res_1_tab_1 values (3, 'klmno')",
+
+ "drop table imp_res_1_tab_2",
+ "create table imp_res_1_tab_2 (c3 varchar2(1))",
+ "insert into imp_res_1_tab_2 values ('t')",
+ "insert into imp_res_1_tab_2 values ('u')",
+ "insert into imp_res_1_tab_2 values ('v')",
+
+ "create or replace procedure imp_res_1_proc as
+ c1 sys_refcursor;
+ begin
+ open c1 for select * from imp_res_1_tab_1 order by 1;
+ dbms_sql.return_result(c1);
+
+ open c1 for select * from imp_res_1_tab_2 where rownum < 3 order by 1;
+ dbms_sql.return_result(c1);
+
+ open c1 for select 99 from dual;
+ dbms_sql.return_result (c1);
+
+ open c1 for select NULL, 'Z' from dual;
+ dbms_sql.return_result (c1);
+
+ open c1 for select * from imp_res_1_tab_1 order by 1;
+ dbms_sql.return_result(c1);
+ end;"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+// Run Test
+
+echo "Test 1 - oci_fetch_assoc\n";
+$s = oci_parse($c, "begin imp_res_1_proc(); end;");
+oci_execute($s);
+while (($row = oci_fetch_assoc($s)) != false)
+ var_dump($row);
+
+echo "\nTest 2 - oci_fetch_object\n";
+$s = oci_parse($c, "begin imp_res_1_proc(); end;");
+oci_execute($s);
+while (($row = oci_fetch_object($s)) != false)
+ var_dump($row);
+
+echo "\nTest 3 - oci_fetch_row\n";
+$s = oci_parse($c, "begin imp_res_1_proc(); end;");
+oci_execute($s);
+while (($row = oci_fetch_row($s)) != false)
+ var_dump($row);
+
+echo "\nTest 4 - oci_fetch_array(OCI_ASSOC+OCI_RETURN_NULLS)\n";
+$s = oci_parse($c, "begin imp_res_1_proc(); end;");
+oci_execute($s);
+while (($row = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS)) != false)
+ var_dump($row);
+
+echo "\nTest 5 - oci_fetch_array(OCI_ASSOC)\n";
+$s = oci_parse($c, "begin imp_res_1_proc(); end;");
+oci_execute($s);
+while (($row = oci_fetch_array($s, OCI_ASSOC)) != false)
+ var_dump($row);
+
+echo "\nTest 6 - oci_fetch_array(OCI_NUM)\n";
+$s = oci_parse($c, "begin imp_res_1_proc(); end;");
+oci_execute($s);
+while (($row = oci_fetch_array($s, OCI_NUM)) != false)
+ var_dump($row);
+
+echo "\nTest 7 - oci_fetch_array(OCI_BOTH)\n";
+$s = oci_parse($c, "begin imp_res_1_proc(); end;");
+oci_execute($s);
+while (($row = oci_fetch_array($s, OCI_BOTH)) != false)
+ var_dump($row);
+
+echo "\nTest 8 - oci_fetch_array(OCI_BOTH+OCI_RETURN_NULLS)\n";
+$s = oci_parse($c, "begin imp_res_1_proc(); end;");
+oci_execute($s);
+while (($row = oci_fetch_array($s, OCI_BOTH+OCI_RETURN_NULLS)) != false)
+ var_dump($row);
+
+// Clean up
+
+$stmtarray = array(
+ "drop procedure imp_res_1_proc",
+ "drop table imp_res_1_tab_1",
+ "drop table imp_res_1_tab_2"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1 - oci_fetch_assoc
+array(2) {
+ ["C1"]=>
+ string(1) "1"
+ ["C2"]=>
+ string(5) "abcde"
+}
+array(2) {
+ ["C1"]=>
+ string(1) "2"
+ ["C2"]=>
+ string(5) "fghij"
+}
+array(2) {
+ ["C1"]=>
+ string(1) "3"
+ ["C2"]=>
+ string(5) "klmno"
+}
+array(1) {
+ ["C3"]=>
+ string(1) "t"
+}
+array(1) {
+ ["C3"]=>
+ string(1) "u"
+}
+array(1) {
+ [99]=>
+ string(2) "99"
+}
+array(2) {
+ ["NULL"]=>
+ NULL
+ ["'Z'"]=>
+ string(1) "Z"
+}
+array(2) {
+ ["C1"]=>
+ string(1) "1"
+ ["C2"]=>
+ string(5) "abcde"
+}
+array(2) {
+ ["C1"]=>
+ string(1) "2"
+ ["C2"]=>
+ string(5) "fghij"
+}
+array(2) {
+ ["C1"]=>
+ string(1) "3"
+ ["C2"]=>
+ string(5) "klmno"
+}
+
+Test 2 - oci_fetch_object
+object(stdClass)#%d (2) {
+ ["C1"]=>
+ string(1) "1"
+ ["C2"]=>
+ string(5) "abcde"
+}
+object(stdClass)#%d (2) {
+ ["C1"]=>
+ string(1) "2"
+ ["C2"]=>
+ string(5) "fghij"
+}
+object(stdClass)#%d (2) {
+ ["C1"]=>
+ string(1) "3"
+ ["C2"]=>
+ string(5) "klmno"
+}
+object(stdClass)#%d (1) {
+ ["C3"]=>
+ string(1) "t"
+}
+object(stdClass)#%d (1) {
+ ["C3"]=>
+ string(1) "u"
+}
+object(stdClass)#%d (1) {
+ [99]=>
+ string(2) "99"
+}
+object(stdClass)#%d (2) {
+ ["NULL"]=>
+ NULL
+ ["'Z'"]=>
+ string(1) "Z"
+}
+object(stdClass)#%d (2) {
+ ["C1"]=>
+ string(1) "1"
+ ["C2"]=>
+ string(5) "abcde"
+}
+object(stdClass)#%d (2) {
+ ["C1"]=>
+ string(1) "2"
+ ["C2"]=>
+ string(5) "fghij"
+}
+object(stdClass)#%d (2) {
+ ["C1"]=>
+ string(1) "3"
+ ["C2"]=>
+ string(5) "klmno"
+}
+
+Test 3 - oci_fetch_row
+array(2) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(5) "abcde"
+}
+array(2) {
+ [0]=>
+ string(1) "2"
+ [1]=>
+ string(5) "fghij"
+}
+array(2) {
+ [0]=>
+ string(1) "3"
+ [1]=>
+ string(5) "klmno"
+}
+array(1) {
+ [0]=>
+ string(1) "t"
+}
+array(1) {
+ [0]=>
+ string(1) "u"
+}
+array(1) {
+ [0]=>
+ string(2) "99"
+}
+array(2) {
+ [0]=>
+ NULL
+ [1]=>
+ string(1) "Z"
+}
+array(2) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(5) "abcde"
+}
+array(2) {
+ [0]=>
+ string(1) "2"
+ [1]=>
+ string(5) "fghij"
+}
+array(2) {
+ [0]=>
+ string(1) "3"
+ [1]=>
+ string(5) "klmno"
+}
+
+Test 4 - oci_fetch_array(OCI_ASSOC+OCI_RETURN_NULLS)
+array(2) {
+ ["C1"]=>
+ string(1) "1"
+ ["C2"]=>
+ string(5) "abcde"
+}
+array(2) {
+ ["C1"]=>
+ string(1) "2"
+ ["C2"]=>
+ string(5) "fghij"
+}
+array(2) {
+ ["C1"]=>
+ string(1) "3"
+ ["C2"]=>
+ string(5) "klmno"
+}
+array(1) {
+ ["C3"]=>
+ string(1) "t"
+}
+array(1) {
+ ["C3"]=>
+ string(1) "u"
+}
+array(1) {
+ [99]=>
+ string(2) "99"
+}
+array(2) {
+ ["NULL"]=>
+ NULL
+ ["'Z'"]=>
+ string(1) "Z"
+}
+array(2) {
+ ["C1"]=>
+ string(1) "1"
+ ["C2"]=>
+ string(5) "abcde"
+}
+array(2) {
+ ["C1"]=>
+ string(1) "2"
+ ["C2"]=>
+ string(5) "fghij"
+}
+array(2) {
+ ["C1"]=>
+ string(1) "3"
+ ["C2"]=>
+ string(5) "klmno"
+}
+
+Test 5 - oci_fetch_array(OCI_ASSOC)
+array(2) {
+ ["C1"]=>
+ string(1) "1"
+ ["C2"]=>
+ string(5) "abcde"
+}
+array(2) {
+ ["C1"]=>
+ string(1) "2"
+ ["C2"]=>
+ string(5) "fghij"
+}
+array(2) {
+ ["C1"]=>
+ string(1) "3"
+ ["C2"]=>
+ string(5) "klmno"
+}
+array(1) {
+ ["C3"]=>
+ string(1) "t"
+}
+array(1) {
+ ["C3"]=>
+ string(1) "u"
+}
+array(1) {
+ [99]=>
+ string(2) "99"
+}
+array(1) {
+ ["'Z'"]=>
+ string(1) "Z"
+}
+array(2) {
+ ["C1"]=>
+ string(1) "1"
+ ["C2"]=>
+ string(5) "abcde"
+}
+array(2) {
+ ["C1"]=>
+ string(1) "2"
+ ["C2"]=>
+ string(5) "fghij"
+}
+array(2) {
+ ["C1"]=>
+ string(1) "3"
+ ["C2"]=>
+ string(5) "klmno"
+}
+
+Test 6 - oci_fetch_array(OCI_NUM)
+array(2) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(5) "abcde"
+}
+array(2) {
+ [0]=>
+ string(1) "2"
+ [1]=>
+ string(5) "fghij"
+}
+array(2) {
+ [0]=>
+ string(1) "3"
+ [1]=>
+ string(5) "klmno"
+}
+array(1) {
+ [0]=>
+ string(1) "t"
+}
+array(1) {
+ [0]=>
+ string(1) "u"
+}
+array(1) {
+ [0]=>
+ string(2) "99"
+}
+array(1) {
+ [1]=>
+ string(1) "Z"
+}
+array(2) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(5) "abcde"
+}
+array(2) {
+ [0]=>
+ string(1) "2"
+ [1]=>
+ string(5) "fghij"
+}
+array(2) {
+ [0]=>
+ string(1) "3"
+ [1]=>
+ string(5) "klmno"
+}
+
+Test 7 - oci_fetch_array(OCI_BOTH)
+array(4) {
+ [0]=>
+ string(1) "1"
+ ["C1"]=>
+ string(1) "1"
+ [1]=>
+ string(5) "abcde"
+ ["C2"]=>
+ string(5) "abcde"
+}
+array(4) {
+ [0]=>
+ string(1) "2"
+ ["C1"]=>
+ string(1) "2"
+ [1]=>
+ string(5) "fghij"
+ ["C2"]=>
+ string(5) "fghij"
+}
+array(4) {
+ [0]=>
+ string(1) "3"
+ ["C1"]=>
+ string(1) "3"
+ [1]=>
+ string(5) "klmno"
+ ["C2"]=>
+ string(5) "klmno"
+}
+array(2) {
+ [0]=>
+ string(1) "t"
+ ["C3"]=>
+ string(1) "t"
+}
+array(2) {
+ [0]=>
+ string(1) "u"
+ ["C3"]=>
+ string(1) "u"
+}
+array(2) {
+ [0]=>
+ string(2) "99"
+ [99]=>
+ string(2) "99"
+}
+array(2) {
+ [1]=>
+ string(1) "Z"
+ ["'Z'"]=>
+ string(1) "Z"
+}
+array(4) {
+ [0]=>
+ string(1) "1"
+ ["C1"]=>
+ string(1) "1"
+ [1]=>
+ string(5) "abcde"
+ ["C2"]=>
+ string(5) "abcde"
+}
+array(4) {
+ [0]=>
+ string(1) "2"
+ ["C1"]=>
+ string(1) "2"
+ [1]=>
+ string(5) "fghij"
+ ["C2"]=>
+ string(5) "fghij"
+}
+array(4) {
+ [0]=>
+ string(1) "3"
+ ["C1"]=>
+ string(1) "3"
+ [1]=>
+ string(5) "klmno"
+ ["C2"]=>
+ string(5) "klmno"
+}
+
+Test 8 - oci_fetch_array(OCI_BOTH+OCI_RETURN_NULLS)
+array(4) {
+ [0]=>
+ string(1) "1"
+ ["C1"]=>
+ string(1) "1"
+ [1]=>
+ string(5) "abcde"
+ ["C2"]=>
+ string(5) "abcde"
+}
+array(4) {
+ [0]=>
+ string(1) "2"
+ ["C1"]=>
+ string(1) "2"
+ [1]=>
+ string(5) "fghij"
+ ["C2"]=>
+ string(5) "fghij"
+}
+array(4) {
+ [0]=>
+ string(1) "3"
+ ["C1"]=>
+ string(1) "3"
+ [1]=>
+ string(5) "klmno"
+ ["C2"]=>
+ string(5) "klmno"
+}
+array(2) {
+ [0]=>
+ string(1) "t"
+ ["C3"]=>
+ string(1) "t"
+}
+array(2) {
+ [0]=>
+ string(1) "u"
+ ["C3"]=>
+ string(1) "u"
+}
+array(2) {
+ [0]=>
+ string(2) "99"
+ [99]=>
+ string(2) "99"
+}
+array(4) {
+ [0]=>
+ NULL
+ ["NULL"]=>
+ NULL
+ [1]=>
+ string(1) "Z"
+ ["'Z'"]=>
+ string(1) "Z"
+}
+array(4) {
+ [0]=>
+ string(1) "1"
+ ["C1"]=>
+ string(1) "1"
+ [1]=>
+ string(5) "abcde"
+ ["C2"]=>
+ string(5) "abcde"
+}
+array(4) {
+ [0]=>
+ string(1) "2"
+ ["C1"]=>
+ string(1) "2"
+ [1]=>
+ string(5) "fghij"
+ ["C2"]=>
+ string(5) "fghij"
+}
+array(4) {
+ [0]=>
+ string(1) "3"
+ ["C1"]=>
+ string(1) "3"
+ [1]=>
+ string(5) "klmno"
+ ["C2"]=>
+ string(5) "klmno"
+}
+===DONE===
diff --git a/ext/oci8/tests/imp_res_2.phpt b/ext/oci8/tests/imp_res_2.phpt
new file mode 100644
index 0000000000..860a5fbb34
--- /dev/null
+++ b/ext/oci8/tests/imp_res_2.phpt
@@ -0,0 +1,99 @@
+--TEST--
+Oracle Database 12c Implicit Result Sets: Zero Rows
+--SKIPIF--
+<?php
+if (!extension_loaded('oci8')) die ("skip no oci8 extension");
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
+if (!(isset($matches[0]) && $matches[1] >= 12)) {
+ die("skip expected output only valid when using Oracle Database 12c or greater");
+}
+preg_match('/^[[:digit:]]+/', oci_client_version(), $matches);
+if (!(isset($matches[0]) && $matches[0] >= 12)) {
+ die("skip works only with Oracle 12c or greater version of Oracle client libraries");
+}
+?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+ "create or replace procedure imp_res_2_proc_a as
+ c1 sys_refcursor;
+ begin
+ open c1 for select * from dual where 1 = 0;
+ dbms_sql.return_result(c1);
+ end;",
+
+ "create or replace procedure imp_res_2_proc_b as
+ c1 sys_refcursor;
+ begin
+ open c1 for select * from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select * from dual where 1 = 0;
+ dbms_sql.return_result(c1);
+ end;",
+
+ "create or replace procedure imp_res_2_proc_c as
+ c1 sys_refcursor;
+ begin
+ open c1 for select * from dual where 1 = 0;
+ dbms_sql.return_result(c1);
+ open c1 for select * from dual;
+ dbms_sql.return_result(c1);
+ end;"
+
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+// Run Test
+
+echo "Test 1\n";
+$s = oci_parse($c, "begin imp_res_2_proc_a(); end;");
+oci_execute($s);
+while (($row = oci_fetch_row($s)) != false)
+ var_dump($row);
+
+echo "Test 2\n";
+$s = oci_parse($c, "begin imp_res_2_proc_b(); end;");
+oci_execute($s);
+while (($row = oci_fetch_row($s)) != false)
+ var_dump($row);
+
+echo "Test 2\n";
+$s = oci_parse($c, "begin imp_res_2_proc_c(); end;");
+oci_execute($s);
+while (($row = oci_fetch_row($s)) != false)
+ var_dump($row);
+
+// Clean up
+
+$stmtarray = array(
+ "drop procedure imp_res_2_proc_a",
+ "drop procedure imp_res_2_proc_b",
+ "drop procedure imp_res_2_proc_c"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1
+Test 2
+array(1) {
+ [0]=>
+ string(1) "X"
+}
+Test 2
+array(1) {
+ [0]=>
+ string(1) "X"
+}
+===DONE===
diff --git a/ext/oci8/tests/imp_res_3.phpt b/ext/oci8/tests/imp_res_3.phpt
new file mode 100644
index 0000000000..0fc4815893
--- /dev/null
+++ b/ext/oci8/tests/imp_res_3.phpt
@@ -0,0 +1,1257 @@
+--TEST--
+Oracle Database 12c Implicit Result Sets: bigger data size
+--SKIPIF--
+<?php
+if (!extension_loaded('oci8')) die ("skip no oci8 extension");
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
+if (!(isset($matches[0]) && $matches[1] >= 12)) {
+ die("skip expected output only valid when using Oracle Database 12c or greater");
+}
+preg_match('/^[[:digit:]]+/', oci_client_version(), $matches);
+if (!(isset($matches[0]) && $matches[0] >= 12)) {
+ die("skip works only with Oracle 12c or greater version of Oracle client libraries");
+}
+?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+ "drop table imp_res_3_tab_1",
+ "create table imp_res_3_tab_1 (c1 number, c2 varchar2(10))",
+ "insert into imp_res_3_tab_1 values (1, 'a')",
+ "insert into imp_res_3_tab_1 values (2, 'f')",
+
+ "drop table imp_res_3_tab_2",
+ "create table imp_res_3_tab_2 (c3 varchar2(1))",
+ "insert into imp_res_3_tab_2 values ('t')",
+ "insert into imp_res_3_tab_2 values ('u')",
+ "insert into imp_res_3_tab_2 values ('v')",
+ "insert into imp_res_3_tab_2 values ('w')",
+
+ "create or replace procedure imp_res_3_proc as
+ c1 sys_refcursor;
+ i pls_integer;
+ begin
+ for i in 1..30 loop -- if this value is too big for Oracle's open_cursors, calling imp_res_3_proc() can fail with ORA-1000
+ open c1 for select t1.*, t2.*, t3.*, t4.*, t5.*
+ from imp_res_3_tab_1 t1, imp_res_3_tab_1 t2, imp_res_3_tab_1 t3,
+ imp_res_3_tab_1 t4, imp_res_3_tab_1 t5 order by 1,3,5,7,9,2,4,6,8,10;
+ dbms_sql.return_result(c1);
+ open c1 for select c2 from imp_res_3_tab_1 order by 1;
+ dbms_sql.return_result(c1);
+ open c1 for select * from imp_res_3_tab_2 order by 1;
+ dbms_sql.return_result(c1);
+ open c1 for select * from dual;
+ dbms_sql.return_result (c1);
+ end loop;
+ end;"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+// Run Test
+
+echo "Test 1\n";
+
+$s = oci_parse($c, "begin imp_res_3_proc(); end;");
+oci_execute($s);
+
+while (($row = oci_fetch_array($s, OCI_NUM+OCI_RETURN_NULLS)) != false) {
+ foreach ($row as $item) {
+ echo " ".$item;
+ }
+ echo "\n";
+}
+
+// Clean up
+
+$stmtarray = array(
+ "drop procedure imp_res_3_proc",
+ "drop table imp_res_3_tab_1",
+ "drop table imp_res_3_tab_2"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1
+ 1 a 1 a 1 a 1 a 1 a
+ 1 a 1 a 1 a 1 a 2 f
+ 1 a 1 a 1 a 2 f 1 a
+ 1 a 1 a 1 a 2 f 2 f
+ 1 a 1 a 2 f 1 a 1 a
+ 1 a 1 a 2 f 1 a 2 f
+ 1 a 1 a 2 f 2 f 1 a
+ 1 a 1 a 2 f 2 f 2 f
+ 1 a 2 f 1 a 1 a 1 a
+ 1 a 2 f 1 a 1 a 2 f
+ 1 a 2 f 1 a 2 f 1 a
+ 1 a 2 f 1 a 2 f 2 f
+ 1 a 2 f 2 f 1 a 1 a
+ 1 a 2 f 2 f 1 a 2 f
+ 1 a 2 f 2 f 2 f 1 a
+ 1 a 2 f 2 f 2 f 2 f
+ 2 f 1 a 1 a 1 a 1 a
+ 2 f 1 a 1 a 1 a 2 f
+ 2 f 1 a 1 a 2 f 1 a
+ 2 f 1 a 1 a 2 f 2 f
+ 2 f 1 a 2 f 1 a 1 a
+ 2 f 1 a 2 f 1 a 2 f
+ 2 f 1 a 2 f 2 f 1 a
+ 2 f 1 a 2 f 2 f 2 f
+ 2 f 2 f 1 a 1 a 1 a
+ 2 f 2 f 1 a 1 a 2 f
+ 2 f 2 f 1 a 2 f 1 a
+ 2 f 2 f 1 a 2 f 2 f
+ 2 f 2 f 2 f 1 a 1 a
+ 2 f 2 f 2 f 1 a 2 f
+ 2 f 2 f 2 f 2 f 1 a
+ 2 f 2 f 2 f 2 f 2 f
+ a
+ f
+ t
+ u
+ v
+ w
+ X
+ 1 a 1 a 1 a 1 a 1 a
+ 1 a 1 a 1 a 1 a 2 f
+ 1 a 1 a 1 a 2 f 1 a
+ 1 a 1 a 1 a 2 f 2 f
+ 1 a 1 a 2 f 1 a 1 a
+ 1 a 1 a 2 f 1 a 2 f
+ 1 a 1 a 2 f 2 f 1 a
+ 1 a 1 a 2 f 2 f 2 f
+ 1 a 2 f 1 a 1 a 1 a
+ 1 a 2 f 1 a 1 a 2 f
+ 1 a 2 f 1 a 2 f 1 a
+ 1 a 2 f 1 a 2 f 2 f
+ 1 a 2 f 2 f 1 a 1 a
+ 1 a 2 f 2 f 1 a 2 f
+ 1 a 2 f 2 f 2 f 1 a
+ 1 a 2 f 2 f 2 f 2 f
+ 2 f 1 a 1 a 1 a 1 a
+ 2 f 1 a 1 a 1 a 2 f
+ 2 f 1 a 1 a 2 f 1 a
+ 2 f 1 a 1 a 2 f 2 f
+ 2 f 1 a 2 f 1 a 1 a
+ 2 f 1 a 2 f 1 a 2 f
+ 2 f 1 a 2 f 2 f 1 a
+ 2 f 1 a 2 f 2 f 2 f
+ 2 f 2 f 1 a 1 a 1 a
+ 2 f 2 f 1 a 1 a 2 f
+ 2 f 2 f 1 a 2 f 1 a
+ 2 f 2 f 1 a 2 f 2 f
+ 2 f 2 f 2 f 1 a 1 a
+ 2 f 2 f 2 f 1 a 2 f
+ 2 f 2 f 2 f 2 f 1 a
+ 2 f 2 f 2 f 2 f 2 f
+ a
+ f
+ t
+ u
+ v
+ w
+ X
+ 1 a 1 a 1 a 1 a 1 a
+ 1 a 1 a 1 a 1 a 2 f
+ 1 a 1 a 1 a 2 f 1 a
+ 1 a 1 a 1 a 2 f 2 f
+ 1 a 1 a 2 f 1 a 1 a
+ 1 a 1 a 2 f 1 a 2 f
+ 1 a 1 a 2 f 2 f 1 a
+ 1 a 1 a 2 f 2 f 2 f
+ 1 a 2 f 1 a 1 a 1 a
+ 1 a 2 f 1 a 1 a 2 f
+ 1 a 2 f 1 a 2 f 1 a
+ 1 a 2 f 1 a 2 f 2 f
+ 1 a 2 f 2 f 1 a 1 a
+ 1 a 2 f 2 f 1 a 2 f
+ 1 a 2 f 2 f 2 f 1 a
+ 1 a 2 f 2 f 2 f 2 f
+ 2 f 1 a 1 a 1 a 1 a
+ 2 f 1 a 1 a 1 a 2 f
+ 2 f 1 a 1 a 2 f 1 a
+ 2 f 1 a 1 a 2 f 2 f
+ 2 f 1 a 2 f 1 a 1 a
+ 2 f 1 a 2 f 1 a 2 f
+ 2 f 1 a 2 f 2 f 1 a
+ 2 f 1 a 2 f 2 f 2 f
+ 2 f 2 f 1 a 1 a 1 a
+ 2 f 2 f 1 a 1 a 2 f
+ 2 f 2 f 1 a 2 f 1 a
+ 2 f 2 f 1 a 2 f 2 f
+ 2 f 2 f 2 f 1 a 1 a
+ 2 f 2 f 2 f 1 a 2 f
+ 2 f 2 f 2 f 2 f 1 a
+ 2 f 2 f 2 f 2 f 2 f
+ a
+ f
+ t
+ u
+ v
+ w
+ X
+ 1 a 1 a 1 a 1 a 1 a
+ 1 a 1 a 1 a 1 a 2 f
+ 1 a 1 a 1 a 2 f 1 a
+ 1 a 1 a 1 a 2 f 2 f
+ 1 a 1 a 2 f 1 a 1 a
+ 1 a 1 a 2 f 1 a 2 f
+ 1 a 1 a 2 f 2 f 1 a
+ 1 a 1 a 2 f 2 f 2 f
+ 1 a 2 f 1 a 1 a 1 a
+ 1 a 2 f 1 a 1 a 2 f
+ 1 a 2 f 1 a 2 f 1 a
+ 1 a 2 f 1 a 2 f 2 f
+ 1 a 2 f 2 f 1 a 1 a
+ 1 a 2 f 2 f 1 a 2 f
+ 1 a 2 f 2 f 2 f 1 a
+ 1 a 2 f 2 f 2 f 2 f
+ 2 f 1 a 1 a 1 a 1 a
+ 2 f 1 a 1 a 1 a 2 f
+ 2 f 1 a 1 a 2 f 1 a
+ 2 f 1 a 1 a 2 f 2 f
+ 2 f 1 a 2 f 1 a 1 a
+ 2 f 1 a 2 f 1 a 2 f
+ 2 f 1 a 2 f 2 f 1 a
+ 2 f 1 a 2 f 2 f 2 f
+ 2 f 2 f 1 a 1 a 1 a
+ 2 f 2 f 1 a 1 a 2 f
+ 2 f 2 f 1 a 2 f 1 a
+ 2 f 2 f 1 a 2 f 2 f
+ 2 f 2 f 2 f 1 a 1 a
+ 2 f 2 f 2 f 1 a 2 f
+ 2 f 2 f 2 f 2 f 1 a
+ 2 f 2 f 2 f 2 f 2 f
+ a
+ f
+ t
+ u
+ v
+ w
+ X
+ 1 a 1 a 1 a 1 a 1 a
+ 1 a 1 a 1 a 1 a 2 f
+ 1 a 1 a 1 a 2 f 1 a
+ 1 a 1 a 1 a 2 f 2 f
+ 1 a 1 a 2 f 1 a 1 a
+ 1 a 1 a 2 f 1 a 2 f
+ 1 a 1 a 2 f 2 f 1 a
+ 1 a 1 a 2 f 2 f 2 f
+ 1 a 2 f 1 a 1 a 1 a
+ 1 a 2 f 1 a 1 a 2 f
+ 1 a 2 f 1 a 2 f 1 a
+ 1 a 2 f 1 a 2 f 2 f
+ 1 a 2 f 2 f 1 a 1 a
+ 1 a 2 f 2 f 1 a 2 f
+ 1 a 2 f 2 f 2 f 1 a
+ 1 a 2 f 2 f 2 f 2 f
+ 2 f 1 a 1 a 1 a 1 a
+ 2 f 1 a 1 a 1 a 2 f
+ 2 f 1 a 1 a 2 f 1 a
+ 2 f 1 a 1 a 2 f 2 f
+ 2 f 1 a 2 f 1 a 1 a
+ 2 f 1 a 2 f 1 a 2 f
+ 2 f 1 a 2 f 2 f 1 a
+ 2 f 1 a 2 f 2 f 2 f
+ 2 f 2 f 1 a 1 a 1 a
+ 2 f 2 f 1 a 1 a 2 f
+ 2 f 2 f 1 a 2 f 1 a
+ 2 f 2 f 1 a 2 f 2 f
+ 2 f 2 f 2 f 1 a 1 a
+ 2 f 2 f 2 f 1 a 2 f
+ 2 f 2 f 2 f 2 f 1 a
+ 2 f 2 f 2 f 2 f 2 f
+ a
+ f
+ t
+ u
+ v
+ w
+ X
+ 1 a 1 a 1 a 1 a 1 a
+ 1 a 1 a 1 a 1 a 2 f
+ 1 a 1 a 1 a 2 f 1 a
+ 1 a 1 a 1 a 2 f 2 f
+ 1 a 1 a 2 f 1 a 1 a
+ 1 a 1 a 2 f 1 a 2 f
+ 1 a 1 a 2 f 2 f 1 a
+ 1 a 1 a 2 f 2 f 2 f
+ 1 a 2 f 1 a 1 a 1 a
+ 1 a 2 f 1 a 1 a 2 f
+ 1 a 2 f 1 a 2 f 1 a
+ 1 a 2 f 1 a 2 f 2 f
+ 1 a 2 f 2 f 1 a 1 a
+ 1 a 2 f 2 f 1 a 2 f
+ 1 a 2 f 2 f 2 f 1 a
+ 1 a 2 f 2 f 2 f 2 f
+ 2 f 1 a 1 a 1 a 1 a
+ 2 f 1 a 1 a 1 a 2 f
+ 2 f 1 a 1 a 2 f 1 a
+ 2 f 1 a 1 a 2 f 2 f
+ 2 f 1 a 2 f 1 a 1 a
+ 2 f 1 a 2 f 1 a 2 f
+ 2 f 1 a 2 f 2 f 1 a
+ 2 f 1 a 2 f 2 f 2 f
+ 2 f 2 f 1 a 1 a 1 a
+ 2 f 2 f 1 a 1 a 2 f
+ 2 f 2 f 1 a 2 f 1 a
+ 2 f 2 f 1 a 2 f 2 f
+ 2 f 2 f 2 f 1 a 1 a
+ 2 f 2 f 2 f 1 a 2 f
+ 2 f 2 f 2 f 2 f 1 a
+ 2 f 2 f 2 f 2 f 2 f
+ a
+ f
+ t
+ u
+ v
+ w
+ X
+ 1 a 1 a 1 a 1 a 1 a
+ 1 a 1 a 1 a 1 a 2 f
+ 1 a 1 a 1 a 2 f 1 a
+ 1 a 1 a 1 a 2 f 2 f
+ 1 a 1 a 2 f 1 a 1 a
+ 1 a 1 a 2 f 1 a 2 f
+ 1 a 1 a 2 f 2 f 1 a
+ 1 a 1 a 2 f 2 f 2 f
+ 1 a 2 f 1 a 1 a 1 a
+ 1 a 2 f 1 a 1 a 2 f
+ 1 a 2 f 1 a 2 f 1 a
+ 1 a 2 f 1 a 2 f 2 f
+ 1 a 2 f 2 f 1 a 1 a
+ 1 a 2 f 2 f 1 a 2 f
+ 1 a 2 f 2 f 2 f 1 a
+ 1 a 2 f 2 f 2 f 2 f
+ 2 f 1 a 1 a 1 a 1 a
+ 2 f 1 a 1 a 1 a 2 f
+ 2 f 1 a 1 a 2 f 1 a
+ 2 f 1 a 1 a 2 f 2 f
+ 2 f 1 a 2 f 1 a 1 a
+ 2 f 1 a 2 f 1 a 2 f
+ 2 f 1 a 2 f 2 f 1 a
+ 2 f 1 a 2 f 2 f 2 f
+ 2 f 2 f 1 a 1 a 1 a
+ 2 f 2 f 1 a 1 a 2 f
+ 2 f 2 f 1 a 2 f 1 a
+ 2 f 2 f 1 a 2 f 2 f
+ 2 f 2 f 2 f 1 a 1 a
+ 2 f 2 f 2 f 1 a 2 f
+ 2 f 2 f 2 f 2 f 1 a
+ 2 f 2 f 2 f 2 f 2 f
+ a
+ f
+ t
+ u
+ v
+ w
+ X
+ 1 a 1 a 1 a 1 a 1 a
+ 1 a 1 a 1 a 1 a 2 f
+ 1 a 1 a 1 a 2 f 1 a
+ 1 a 1 a 1 a 2 f 2 f
+ 1 a 1 a 2 f 1 a 1 a
+ 1 a 1 a 2 f 1 a 2 f
+ 1 a 1 a 2 f 2 f 1 a
+ 1 a 1 a 2 f 2 f 2 f
+ 1 a 2 f 1 a 1 a 1 a
+ 1 a 2 f 1 a 1 a 2 f
+ 1 a 2 f 1 a 2 f 1 a
+ 1 a 2 f 1 a 2 f 2 f
+ 1 a 2 f 2 f 1 a 1 a
+ 1 a 2 f 2 f 1 a 2 f
+ 1 a 2 f 2 f 2 f 1 a
+ 1 a 2 f 2 f 2 f 2 f
+ 2 f 1 a 1 a 1 a 1 a
+ 2 f 1 a 1 a 1 a 2 f
+ 2 f 1 a 1 a 2 f 1 a
+ 2 f 1 a 1 a 2 f 2 f
+ 2 f 1 a 2 f 1 a 1 a
+ 2 f 1 a 2 f 1 a 2 f
+ 2 f 1 a 2 f 2 f 1 a
+ 2 f 1 a 2 f 2 f 2 f
+ 2 f 2 f 1 a 1 a 1 a
+ 2 f 2 f 1 a 1 a 2 f
+ 2 f 2 f 1 a 2 f 1 a
+ 2 f 2 f 1 a 2 f 2 f
+ 2 f 2 f 2 f 1 a 1 a
+ 2 f 2 f 2 f 1 a 2 f
+ 2 f 2 f 2 f 2 f 1 a
+ 2 f 2 f 2 f 2 f 2 f
+ a
+ f
+ t
+ u
+ v
+ w
+ X
+ 1 a 1 a 1 a 1 a 1 a
+ 1 a 1 a 1 a 1 a 2 f
+ 1 a 1 a 1 a 2 f 1 a
+ 1 a 1 a 1 a 2 f 2 f
+ 1 a 1 a 2 f 1 a 1 a
+ 1 a 1 a 2 f 1 a 2 f
+ 1 a 1 a 2 f 2 f 1 a
+ 1 a 1 a 2 f 2 f 2 f
+ 1 a 2 f 1 a 1 a 1 a
+ 1 a 2 f 1 a 1 a 2 f
+ 1 a 2 f 1 a 2 f 1 a
+ 1 a 2 f 1 a 2 f 2 f
+ 1 a 2 f 2 f 1 a 1 a
+ 1 a 2 f 2 f 1 a 2 f
+ 1 a 2 f 2 f 2 f 1 a
+ 1 a 2 f 2 f 2 f 2 f
+ 2 f 1 a 1 a 1 a 1 a
+ 2 f 1 a 1 a 1 a 2 f
+ 2 f 1 a 1 a 2 f 1 a
+ 2 f 1 a 1 a 2 f 2 f
+ 2 f 1 a 2 f 1 a 1 a
+ 2 f 1 a 2 f 1 a 2 f
+ 2 f 1 a 2 f 2 f 1 a
+ 2 f 1 a 2 f 2 f 2 f
+ 2 f 2 f 1 a 1 a 1 a
+ 2 f 2 f 1 a 1 a 2 f
+ 2 f 2 f 1 a 2 f 1 a
+ 2 f 2 f 1 a 2 f 2 f
+ 2 f 2 f 2 f 1 a 1 a
+ 2 f 2 f 2 f 1 a 2 f
+ 2 f 2 f 2 f 2 f 1 a
+ 2 f 2 f 2 f 2 f 2 f
+ a
+ f
+ t
+ u
+ v
+ w
+ X
+ 1 a 1 a 1 a 1 a 1 a
+ 1 a 1 a 1 a 1 a 2 f
+ 1 a 1 a 1 a 2 f 1 a
+ 1 a 1 a 1 a 2 f 2 f
+ 1 a 1 a 2 f 1 a 1 a
+ 1 a 1 a 2 f 1 a 2 f
+ 1 a 1 a 2 f 2 f 1 a
+ 1 a 1 a 2 f 2 f 2 f
+ 1 a 2 f 1 a 1 a 1 a
+ 1 a 2 f 1 a 1 a 2 f
+ 1 a 2 f 1 a 2 f 1 a
+ 1 a 2 f 1 a 2 f 2 f
+ 1 a 2 f 2 f 1 a 1 a
+ 1 a 2 f 2 f 1 a 2 f
+ 1 a 2 f 2 f 2 f 1 a
+ 1 a 2 f 2 f 2 f 2 f
+ 2 f 1 a 1 a 1 a 1 a
+ 2 f 1 a 1 a 1 a 2 f
+ 2 f 1 a 1 a 2 f 1 a
+ 2 f 1 a 1 a 2 f 2 f
+ 2 f 1 a 2 f 1 a 1 a
+ 2 f 1 a 2 f 1 a 2 f
+ 2 f 1 a 2 f 2 f 1 a
+ 2 f 1 a 2 f 2 f 2 f
+ 2 f 2 f 1 a 1 a 1 a
+ 2 f 2 f 1 a 1 a 2 f
+ 2 f 2 f 1 a 2 f 1 a
+ 2 f 2 f 1 a 2 f 2 f
+ 2 f 2 f 2 f 1 a 1 a
+ 2 f 2 f 2 f 1 a 2 f
+ 2 f 2 f 2 f 2 f 1 a
+ 2 f 2 f 2 f 2 f 2 f
+ a
+ f
+ t
+ u
+ v
+ w
+ X
+ 1 a 1 a 1 a 1 a 1 a
+ 1 a 1 a 1 a 1 a 2 f
+ 1 a 1 a 1 a 2 f 1 a
+ 1 a 1 a 1 a 2 f 2 f
+ 1 a 1 a 2 f 1 a 1 a
+ 1 a 1 a 2 f 1 a 2 f
+ 1 a 1 a 2 f 2 f 1 a
+ 1 a 1 a 2 f 2 f 2 f
+ 1 a 2 f 1 a 1 a 1 a
+ 1 a 2 f 1 a 1 a 2 f
+ 1 a 2 f 1 a 2 f 1 a
+ 1 a 2 f 1 a 2 f 2 f
+ 1 a 2 f 2 f 1 a 1 a
+ 1 a 2 f 2 f 1 a 2 f
+ 1 a 2 f 2 f 2 f 1 a
+ 1 a 2 f 2 f 2 f 2 f
+ 2 f 1 a 1 a 1 a 1 a
+ 2 f 1 a 1 a 1 a 2 f
+ 2 f 1 a 1 a 2 f 1 a
+ 2 f 1 a 1 a 2 f 2 f
+ 2 f 1 a 2 f 1 a 1 a
+ 2 f 1 a 2 f 1 a 2 f
+ 2 f 1 a 2 f 2 f 1 a
+ 2 f 1 a 2 f 2 f 2 f
+ 2 f 2 f 1 a 1 a 1 a
+ 2 f 2 f 1 a 1 a 2 f
+ 2 f 2 f 1 a 2 f 1 a
+ 2 f 2 f 1 a 2 f 2 f
+ 2 f 2 f 2 f 1 a 1 a
+ 2 f 2 f 2 f 1 a 2 f
+ 2 f 2 f 2 f 2 f 1 a
+ 2 f 2 f 2 f 2 f 2 f
+ a
+ f
+ t
+ u
+ v
+ w
+ X
+ 1 a 1 a 1 a 1 a 1 a
+ 1 a 1 a 1 a 1 a 2 f
+ 1 a 1 a 1 a 2 f 1 a
+ 1 a 1 a 1 a 2 f 2 f
+ 1 a 1 a 2 f 1 a 1 a
+ 1 a 1 a 2 f 1 a 2 f
+ 1 a 1 a 2 f 2 f 1 a
+ 1 a 1 a 2 f 2 f 2 f
+ 1 a 2 f 1 a 1 a 1 a
+ 1 a 2 f 1 a 1 a 2 f
+ 1 a 2 f 1 a 2 f 1 a
+ 1 a 2 f 1 a 2 f 2 f
+ 1 a 2 f 2 f 1 a 1 a
+ 1 a 2 f 2 f 1 a 2 f
+ 1 a 2 f 2 f 2 f 1 a
+ 1 a 2 f 2 f 2 f 2 f
+ 2 f 1 a 1 a 1 a 1 a
+ 2 f 1 a 1 a 1 a 2 f
+ 2 f 1 a 1 a 2 f 1 a
+ 2 f 1 a 1 a 2 f 2 f
+ 2 f 1 a 2 f 1 a 1 a
+ 2 f 1 a 2 f 1 a 2 f
+ 2 f 1 a 2 f 2 f 1 a
+ 2 f 1 a 2 f 2 f 2 f
+ 2 f 2 f 1 a 1 a 1 a
+ 2 f 2 f 1 a 1 a 2 f
+ 2 f 2 f 1 a 2 f 1 a
+ 2 f 2 f 1 a 2 f 2 f
+ 2 f 2 f 2 f 1 a 1 a
+ 2 f 2 f 2 f 1 a 2 f
+ 2 f 2 f 2 f 2 f 1 a
+ 2 f 2 f 2 f 2 f 2 f
+ a
+ f
+ t
+ u
+ v
+ w
+ X
+ 1 a 1 a 1 a 1 a 1 a
+ 1 a 1 a 1 a 1 a 2 f
+ 1 a 1 a 1 a 2 f 1 a
+ 1 a 1 a 1 a 2 f 2 f
+ 1 a 1 a 2 f 1 a 1 a
+ 1 a 1 a 2 f 1 a 2 f
+ 1 a 1 a 2 f 2 f 1 a
+ 1 a 1 a 2 f 2 f 2 f
+ 1 a 2 f 1 a 1 a 1 a
+ 1 a 2 f 1 a 1 a 2 f
+ 1 a 2 f 1 a 2 f 1 a
+ 1 a 2 f 1 a 2 f 2 f
+ 1 a 2 f 2 f 1 a 1 a
+ 1 a 2 f 2 f 1 a 2 f
+ 1 a 2 f 2 f 2 f 1 a
+ 1 a 2 f 2 f 2 f 2 f
+ 2 f 1 a 1 a 1 a 1 a
+ 2 f 1 a 1 a 1 a 2 f
+ 2 f 1 a 1 a 2 f 1 a
+ 2 f 1 a 1 a 2 f 2 f
+ 2 f 1 a 2 f 1 a 1 a
+ 2 f 1 a 2 f 1 a 2 f
+ 2 f 1 a 2 f 2 f 1 a
+ 2 f 1 a 2 f 2 f 2 f
+ 2 f 2 f 1 a 1 a 1 a
+ 2 f 2 f 1 a 1 a 2 f
+ 2 f 2 f 1 a 2 f 1 a
+ 2 f 2 f 1 a 2 f 2 f
+ 2 f 2 f 2 f 1 a 1 a
+ 2 f 2 f 2 f 1 a 2 f
+ 2 f 2 f 2 f 2 f 1 a
+ 2 f 2 f 2 f 2 f 2 f
+ a
+ f
+ t
+ u
+ v
+ w
+ X
+ 1 a 1 a 1 a 1 a 1 a
+ 1 a 1 a 1 a 1 a 2 f
+ 1 a 1 a 1 a 2 f 1 a
+ 1 a 1 a 1 a 2 f 2 f
+ 1 a 1 a 2 f 1 a 1 a
+ 1 a 1 a 2 f 1 a 2 f
+ 1 a 1 a 2 f 2 f 1 a
+ 1 a 1 a 2 f 2 f 2 f
+ 1 a 2 f 1 a 1 a 1 a
+ 1 a 2 f 1 a 1 a 2 f
+ 1 a 2 f 1 a 2 f 1 a
+ 1 a 2 f 1 a 2 f 2 f
+ 1 a 2 f 2 f 1 a 1 a
+ 1 a 2 f 2 f 1 a 2 f
+ 1 a 2 f 2 f 2 f 1 a
+ 1 a 2 f 2 f 2 f 2 f
+ 2 f 1 a 1 a 1 a 1 a
+ 2 f 1 a 1 a 1 a 2 f
+ 2 f 1 a 1 a 2 f 1 a
+ 2 f 1 a 1 a 2 f 2 f
+ 2 f 1 a 2 f 1 a 1 a
+ 2 f 1 a 2 f 1 a 2 f
+ 2 f 1 a 2 f 2 f 1 a
+ 2 f 1 a 2 f 2 f 2 f
+ 2 f 2 f 1 a 1 a 1 a
+ 2 f 2 f 1 a 1 a 2 f
+ 2 f 2 f 1 a 2 f 1 a
+ 2 f 2 f 1 a 2 f 2 f
+ 2 f 2 f 2 f 1 a 1 a
+ 2 f 2 f 2 f 1 a 2 f
+ 2 f 2 f 2 f 2 f 1 a
+ 2 f 2 f 2 f 2 f 2 f
+ a
+ f
+ t
+ u
+ v
+ w
+ X
+ 1 a 1 a 1 a 1 a 1 a
+ 1 a 1 a 1 a 1 a 2 f
+ 1 a 1 a 1 a 2 f 1 a
+ 1 a 1 a 1 a 2 f 2 f
+ 1 a 1 a 2 f 1 a 1 a
+ 1 a 1 a 2 f 1 a 2 f
+ 1 a 1 a 2 f 2 f 1 a
+ 1 a 1 a 2 f 2 f 2 f
+ 1 a 2 f 1 a 1 a 1 a
+ 1 a 2 f 1 a 1 a 2 f
+ 1 a 2 f 1 a 2 f 1 a
+ 1 a 2 f 1 a 2 f 2 f
+ 1 a 2 f 2 f 1 a 1 a
+ 1 a 2 f 2 f 1 a 2 f
+ 1 a 2 f 2 f 2 f 1 a
+ 1 a 2 f 2 f 2 f 2 f
+ 2 f 1 a 1 a 1 a 1 a
+ 2 f 1 a 1 a 1 a 2 f
+ 2 f 1 a 1 a 2 f 1 a
+ 2 f 1 a 1 a 2 f 2 f
+ 2 f 1 a 2 f 1 a 1 a
+ 2 f 1 a 2 f 1 a 2 f
+ 2 f 1 a 2 f 2 f 1 a
+ 2 f 1 a 2 f 2 f 2 f
+ 2 f 2 f 1 a 1 a 1 a
+ 2 f 2 f 1 a 1 a 2 f
+ 2 f 2 f 1 a 2 f 1 a
+ 2 f 2 f 1 a 2 f 2 f
+ 2 f 2 f 2 f 1 a 1 a
+ 2 f 2 f 2 f 1 a 2 f
+ 2 f 2 f 2 f 2 f 1 a
+ 2 f 2 f 2 f 2 f 2 f
+ a
+ f
+ t
+ u
+ v
+ w
+ X
+ 1 a 1 a 1 a 1 a 1 a
+ 1 a 1 a 1 a 1 a 2 f
+ 1 a 1 a 1 a 2 f 1 a
+ 1 a 1 a 1 a 2 f 2 f
+ 1 a 1 a 2 f 1 a 1 a
+ 1 a 1 a 2 f 1 a 2 f
+ 1 a 1 a 2 f 2 f 1 a
+ 1 a 1 a 2 f 2 f 2 f
+ 1 a 2 f 1 a 1 a 1 a
+ 1 a 2 f 1 a 1 a 2 f
+ 1 a 2 f 1 a 2 f 1 a
+ 1 a 2 f 1 a 2 f 2 f
+ 1 a 2 f 2 f 1 a 1 a
+ 1 a 2 f 2 f 1 a 2 f
+ 1 a 2 f 2 f 2 f 1 a
+ 1 a 2 f 2 f 2 f 2 f
+ 2 f 1 a 1 a 1 a 1 a
+ 2 f 1 a 1 a 1 a 2 f
+ 2 f 1 a 1 a 2 f 1 a
+ 2 f 1 a 1 a 2 f 2 f
+ 2 f 1 a 2 f 1 a 1 a
+ 2 f 1 a 2 f 1 a 2 f
+ 2 f 1 a 2 f 2 f 1 a
+ 2 f 1 a 2 f 2 f 2 f
+ 2 f 2 f 1 a 1 a 1 a
+ 2 f 2 f 1 a 1 a 2 f
+ 2 f 2 f 1 a 2 f 1 a
+ 2 f 2 f 1 a 2 f 2 f
+ 2 f 2 f 2 f 1 a 1 a
+ 2 f 2 f 2 f 1 a 2 f
+ 2 f 2 f 2 f 2 f 1 a
+ 2 f 2 f 2 f 2 f 2 f
+ a
+ f
+ t
+ u
+ v
+ w
+ X
+ 1 a 1 a 1 a 1 a 1 a
+ 1 a 1 a 1 a 1 a 2 f
+ 1 a 1 a 1 a 2 f 1 a
+ 1 a 1 a 1 a 2 f 2 f
+ 1 a 1 a 2 f 1 a 1 a
+ 1 a 1 a 2 f 1 a 2 f
+ 1 a 1 a 2 f 2 f 1 a
+ 1 a 1 a 2 f 2 f 2 f
+ 1 a 2 f 1 a 1 a 1 a
+ 1 a 2 f 1 a 1 a 2 f
+ 1 a 2 f 1 a 2 f 1 a
+ 1 a 2 f 1 a 2 f 2 f
+ 1 a 2 f 2 f 1 a 1 a
+ 1 a 2 f 2 f 1 a 2 f
+ 1 a 2 f 2 f 2 f 1 a
+ 1 a 2 f 2 f 2 f 2 f
+ 2 f 1 a 1 a 1 a 1 a
+ 2 f 1 a 1 a 1 a 2 f
+ 2 f 1 a 1 a 2 f 1 a
+ 2 f 1 a 1 a 2 f 2 f
+ 2 f 1 a 2 f 1 a 1 a
+ 2 f 1 a 2 f 1 a 2 f
+ 2 f 1 a 2 f 2 f 1 a
+ 2 f 1 a 2 f 2 f 2 f
+ 2 f 2 f 1 a 1 a 1 a
+ 2 f 2 f 1 a 1 a 2 f
+ 2 f 2 f 1 a 2 f 1 a
+ 2 f 2 f 1 a 2 f 2 f
+ 2 f 2 f 2 f 1 a 1 a
+ 2 f 2 f 2 f 1 a 2 f
+ 2 f 2 f 2 f 2 f 1 a
+ 2 f 2 f 2 f 2 f 2 f
+ a
+ f
+ t
+ u
+ v
+ w
+ X
+ 1 a 1 a 1 a 1 a 1 a
+ 1 a 1 a 1 a 1 a 2 f
+ 1 a 1 a 1 a 2 f 1 a
+ 1 a 1 a 1 a 2 f 2 f
+ 1 a 1 a 2 f 1 a 1 a
+ 1 a 1 a 2 f 1 a 2 f
+ 1 a 1 a 2 f 2 f 1 a
+ 1 a 1 a 2 f 2 f 2 f
+ 1 a 2 f 1 a 1 a 1 a
+ 1 a 2 f 1 a 1 a 2 f
+ 1 a 2 f 1 a 2 f 1 a
+ 1 a 2 f 1 a 2 f 2 f
+ 1 a 2 f 2 f 1 a 1 a
+ 1 a 2 f 2 f 1 a 2 f
+ 1 a 2 f 2 f 2 f 1 a
+ 1 a 2 f 2 f 2 f 2 f
+ 2 f 1 a 1 a 1 a 1 a
+ 2 f 1 a 1 a 1 a 2 f
+ 2 f 1 a 1 a 2 f 1 a
+ 2 f 1 a 1 a 2 f 2 f
+ 2 f 1 a 2 f 1 a 1 a
+ 2 f 1 a 2 f 1 a 2 f
+ 2 f 1 a 2 f 2 f 1 a
+ 2 f 1 a 2 f 2 f 2 f
+ 2 f 2 f 1 a 1 a 1 a
+ 2 f 2 f 1 a 1 a 2 f
+ 2 f 2 f 1 a 2 f 1 a
+ 2 f 2 f 1 a 2 f 2 f
+ 2 f 2 f 2 f 1 a 1 a
+ 2 f 2 f 2 f 1 a 2 f
+ 2 f 2 f 2 f 2 f 1 a
+ 2 f 2 f 2 f 2 f 2 f
+ a
+ f
+ t
+ u
+ v
+ w
+ X
+ 1 a 1 a 1 a 1 a 1 a
+ 1 a 1 a 1 a 1 a 2 f
+ 1 a 1 a 1 a 2 f 1 a
+ 1 a 1 a 1 a 2 f 2 f
+ 1 a 1 a 2 f 1 a 1 a
+ 1 a 1 a 2 f 1 a 2 f
+ 1 a 1 a 2 f 2 f 1 a
+ 1 a 1 a 2 f 2 f 2 f
+ 1 a 2 f 1 a 1 a 1 a
+ 1 a 2 f 1 a 1 a 2 f
+ 1 a 2 f 1 a 2 f 1 a
+ 1 a 2 f 1 a 2 f 2 f
+ 1 a 2 f 2 f 1 a 1 a
+ 1 a 2 f 2 f 1 a 2 f
+ 1 a 2 f 2 f 2 f 1 a
+ 1 a 2 f 2 f 2 f 2 f
+ 2 f 1 a 1 a 1 a 1 a
+ 2 f 1 a 1 a 1 a 2 f
+ 2 f 1 a 1 a 2 f 1 a
+ 2 f 1 a 1 a 2 f 2 f
+ 2 f 1 a 2 f 1 a 1 a
+ 2 f 1 a 2 f 1 a 2 f
+ 2 f 1 a 2 f 2 f 1 a
+ 2 f 1 a 2 f 2 f 2 f
+ 2 f 2 f 1 a 1 a 1 a
+ 2 f 2 f 1 a 1 a 2 f
+ 2 f 2 f 1 a 2 f 1 a
+ 2 f 2 f 1 a 2 f 2 f
+ 2 f 2 f 2 f 1 a 1 a
+ 2 f 2 f 2 f 1 a 2 f
+ 2 f 2 f 2 f 2 f 1 a
+ 2 f 2 f 2 f 2 f 2 f
+ a
+ f
+ t
+ u
+ v
+ w
+ X
+ 1 a 1 a 1 a 1 a 1 a
+ 1 a 1 a 1 a 1 a 2 f
+ 1 a 1 a 1 a 2 f 1 a
+ 1 a 1 a 1 a 2 f 2 f
+ 1 a 1 a 2 f 1 a 1 a
+ 1 a 1 a 2 f 1 a 2 f
+ 1 a 1 a 2 f 2 f 1 a
+ 1 a 1 a 2 f 2 f 2 f
+ 1 a 2 f 1 a 1 a 1 a
+ 1 a 2 f 1 a 1 a 2 f
+ 1 a 2 f 1 a 2 f 1 a
+ 1 a 2 f 1 a 2 f 2 f
+ 1 a 2 f 2 f 1 a 1 a
+ 1 a 2 f 2 f 1 a 2 f
+ 1 a 2 f 2 f 2 f 1 a
+ 1 a 2 f 2 f 2 f 2 f
+ 2 f 1 a 1 a 1 a 1 a
+ 2 f 1 a 1 a 1 a 2 f
+ 2 f 1 a 1 a 2 f 1 a
+ 2 f 1 a 1 a 2 f 2 f
+ 2 f 1 a 2 f 1 a 1 a
+ 2 f 1 a 2 f 1 a 2 f
+ 2 f 1 a 2 f 2 f 1 a
+ 2 f 1 a 2 f 2 f 2 f
+ 2 f 2 f 1 a 1 a 1 a
+ 2 f 2 f 1 a 1 a 2 f
+ 2 f 2 f 1 a 2 f 1 a
+ 2 f 2 f 1 a 2 f 2 f
+ 2 f 2 f 2 f 1 a 1 a
+ 2 f 2 f 2 f 1 a 2 f
+ 2 f 2 f 2 f 2 f 1 a
+ 2 f 2 f 2 f 2 f 2 f
+ a
+ f
+ t
+ u
+ v
+ w
+ X
+ 1 a 1 a 1 a 1 a 1 a
+ 1 a 1 a 1 a 1 a 2 f
+ 1 a 1 a 1 a 2 f 1 a
+ 1 a 1 a 1 a 2 f 2 f
+ 1 a 1 a 2 f 1 a 1 a
+ 1 a 1 a 2 f 1 a 2 f
+ 1 a 1 a 2 f 2 f 1 a
+ 1 a 1 a 2 f 2 f 2 f
+ 1 a 2 f 1 a 1 a 1 a
+ 1 a 2 f 1 a 1 a 2 f
+ 1 a 2 f 1 a 2 f 1 a
+ 1 a 2 f 1 a 2 f 2 f
+ 1 a 2 f 2 f 1 a 1 a
+ 1 a 2 f 2 f 1 a 2 f
+ 1 a 2 f 2 f 2 f 1 a
+ 1 a 2 f 2 f 2 f 2 f
+ 2 f 1 a 1 a 1 a 1 a
+ 2 f 1 a 1 a 1 a 2 f
+ 2 f 1 a 1 a 2 f 1 a
+ 2 f 1 a 1 a 2 f 2 f
+ 2 f 1 a 2 f 1 a 1 a
+ 2 f 1 a 2 f 1 a 2 f
+ 2 f 1 a 2 f 2 f 1 a
+ 2 f 1 a 2 f 2 f 2 f
+ 2 f 2 f 1 a 1 a 1 a
+ 2 f 2 f 1 a 1 a 2 f
+ 2 f 2 f 1 a 2 f 1 a
+ 2 f 2 f 1 a 2 f 2 f
+ 2 f 2 f 2 f 1 a 1 a
+ 2 f 2 f 2 f 1 a 2 f
+ 2 f 2 f 2 f 2 f 1 a
+ 2 f 2 f 2 f 2 f 2 f
+ a
+ f
+ t
+ u
+ v
+ w
+ X
+ 1 a 1 a 1 a 1 a 1 a
+ 1 a 1 a 1 a 1 a 2 f
+ 1 a 1 a 1 a 2 f 1 a
+ 1 a 1 a 1 a 2 f 2 f
+ 1 a 1 a 2 f 1 a 1 a
+ 1 a 1 a 2 f 1 a 2 f
+ 1 a 1 a 2 f 2 f 1 a
+ 1 a 1 a 2 f 2 f 2 f
+ 1 a 2 f 1 a 1 a 1 a
+ 1 a 2 f 1 a 1 a 2 f
+ 1 a 2 f 1 a 2 f 1 a
+ 1 a 2 f 1 a 2 f 2 f
+ 1 a 2 f 2 f 1 a 1 a
+ 1 a 2 f 2 f 1 a 2 f
+ 1 a 2 f 2 f 2 f 1 a
+ 1 a 2 f 2 f 2 f 2 f
+ 2 f 1 a 1 a 1 a 1 a
+ 2 f 1 a 1 a 1 a 2 f
+ 2 f 1 a 1 a 2 f 1 a
+ 2 f 1 a 1 a 2 f 2 f
+ 2 f 1 a 2 f 1 a 1 a
+ 2 f 1 a 2 f 1 a 2 f
+ 2 f 1 a 2 f 2 f 1 a
+ 2 f 1 a 2 f 2 f 2 f
+ 2 f 2 f 1 a 1 a 1 a
+ 2 f 2 f 1 a 1 a 2 f
+ 2 f 2 f 1 a 2 f 1 a
+ 2 f 2 f 1 a 2 f 2 f
+ 2 f 2 f 2 f 1 a 1 a
+ 2 f 2 f 2 f 1 a 2 f
+ 2 f 2 f 2 f 2 f 1 a
+ 2 f 2 f 2 f 2 f 2 f
+ a
+ f
+ t
+ u
+ v
+ w
+ X
+ 1 a 1 a 1 a 1 a 1 a
+ 1 a 1 a 1 a 1 a 2 f
+ 1 a 1 a 1 a 2 f 1 a
+ 1 a 1 a 1 a 2 f 2 f
+ 1 a 1 a 2 f 1 a 1 a
+ 1 a 1 a 2 f 1 a 2 f
+ 1 a 1 a 2 f 2 f 1 a
+ 1 a 1 a 2 f 2 f 2 f
+ 1 a 2 f 1 a 1 a 1 a
+ 1 a 2 f 1 a 1 a 2 f
+ 1 a 2 f 1 a 2 f 1 a
+ 1 a 2 f 1 a 2 f 2 f
+ 1 a 2 f 2 f 1 a 1 a
+ 1 a 2 f 2 f 1 a 2 f
+ 1 a 2 f 2 f 2 f 1 a
+ 1 a 2 f 2 f 2 f 2 f
+ 2 f 1 a 1 a 1 a 1 a
+ 2 f 1 a 1 a 1 a 2 f
+ 2 f 1 a 1 a 2 f 1 a
+ 2 f 1 a 1 a 2 f 2 f
+ 2 f 1 a 2 f 1 a 1 a
+ 2 f 1 a 2 f 1 a 2 f
+ 2 f 1 a 2 f 2 f 1 a
+ 2 f 1 a 2 f 2 f 2 f
+ 2 f 2 f 1 a 1 a 1 a
+ 2 f 2 f 1 a 1 a 2 f
+ 2 f 2 f 1 a 2 f 1 a
+ 2 f 2 f 1 a 2 f 2 f
+ 2 f 2 f 2 f 1 a 1 a
+ 2 f 2 f 2 f 1 a 2 f
+ 2 f 2 f 2 f 2 f 1 a
+ 2 f 2 f 2 f 2 f 2 f
+ a
+ f
+ t
+ u
+ v
+ w
+ X
+ 1 a 1 a 1 a 1 a 1 a
+ 1 a 1 a 1 a 1 a 2 f
+ 1 a 1 a 1 a 2 f 1 a
+ 1 a 1 a 1 a 2 f 2 f
+ 1 a 1 a 2 f 1 a 1 a
+ 1 a 1 a 2 f 1 a 2 f
+ 1 a 1 a 2 f 2 f 1 a
+ 1 a 1 a 2 f 2 f 2 f
+ 1 a 2 f 1 a 1 a 1 a
+ 1 a 2 f 1 a 1 a 2 f
+ 1 a 2 f 1 a 2 f 1 a
+ 1 a 2 f 1 a 2 f 2 f
+ 1 a 2 f 2 f 1 a 1 a
+ 1 a 2 f 2 f 1 a 2 f
+ 1 a 2 f 2 f 2 f 1 a
+ 1 a 2 f 2 f 2 f 2 f
+ 2 f 1 a 1 a 1 a 1 a
+ 2 f 1 a 1 a 1 a 2 f
+ 2 f 1 a 1 a 2 f 1 a
+ 2 f 1 a 1 a 2 f 2 f
+ 2 f 1 a 2 f 1 a 1 a
+ 2 f 1 a 2 f 1 a 2 f
+ 2 f 1 a 2 f 2 f 1 a
+ 2 f 1 a 2 f 2 f 2 f
+ 2 f 2 f 1 a 1 a 1 a
+ 2 f 2 f 1 a 1 a 2 f
+ 2 f 2 f 1 a 2 f 1 a
+ 2 f 2 f 1 a 2 f 2 f
+ 2 f 2 f 2 f 1 a 1 a
+ 2 f 2 f 2 f 1 a 2 f
+ 2 f 2 f 2 f 2 f 1 a
+ 2 f 2 f 2 f 2 f 2 f
+ a
+ f
+ t
+ u
+ v
+ w
+ X
+ 1 a 1 a 1 a 1 a 1 a
+ 1 a 1 a 1 a 1 a 2 f
+ 1 a 1 a 1 a 2 f 1 a
+ 1 a 1 a 1 a 2 f 2 f
+ 1 a 1 a 2 f 1 a 1 a
+ 1 a 1 a 2 f 1 a 2 f
+ 1 a 1 a 2 f 2 f 1 a
+ 1 a 1 a 2 f 2 f 2 f
+ 1 a 2 f 1 a 1 a 1 a
+ 1 a 2 f 1 a 1 a 2 f
+ 1 a 2 f 1 a 2 f 1 a
+ 1 a 2 f 1 a 2 f 2 f
+ 1 a 2 f 2 f 1 a 1 a
+ 1 a 2 f 2 f 1 a 2 f
+ 1 a 2 f 2 f 2 f 1 a
+ 1 a 2 f 2 f 2 f 2 f
+ 2 f 1 a 1 a 1 a 1 a
+ 2 f 1 a 1 a 1 a 2 f
+ 2 f 1 a 1 a 2 f 1 a
+ 2 f 1 a 1 a 2 f 2 f
+ 2 f 1 a 2 f 1 a 1 a
+ 2 f 1 a 2 f 1 a 2 f
+ 2 f 1 a 2 f 2 f 1 a
+ 2 f 1 a 2 f 2 f 2 f
+ 2 f 2 f 1 a 1 a 1 a
+ 2 f 2 f 1 a 1 a 2 f
+ 2 f 2 f 1 a 2 f 1 a
+ 2 f 2 f 1 a 2 f 2 f
+ 2 f 2 f 2 f 1 a 1 a
+ 2 f 2 f 2 f 1 a 2 f
+ 2 f 2 f 2 f 2 f 1 a
+ 2 f 2 f 2 f 2 f 2 f
+ a
+ f
+ t
+ u
+ v
+ w
+ X
+ 1 a 1 a 1 a 1 a 1 a
+ 1 a 1 a 1 a 1 a 2 f
+ 1 a 1 a 1 a 2 f 1 a
+ 1 a 1 a 1 a 2 f 2 f
+ 1 a 1 a 2 f 1 a 1 a
+ 1 a 1 a 2 f 1 a 2 f
+ 1 a 1 a 2 f 2 f 1 a
+ 1 a 1 a 2 f 2 f 2 f
+ 1 a 2 f 1 a 1 a 1 a
+ 1 a 2 f 1 a 1 a 2 f
+ 1 a 2 f 1 a 2 f 1 a
+ 1 a 2 f 1 a 2 f 2 f
+ 1 a 2 f 2 f 1 a 1 a
+ 1 a 2 f 2 f 1 a 2 f
+ 1 a 2 f 2 f 2 f 1 a
+ 1 a 2 f 2 f 2 f 2 f
+ 2 f 1 a 1 a 1 a 1 a
+ 2 f 1 a 1 a 1 a 2 f
+ 2 f 1 a 1 a 2 f 1 a
+ 2 f 1 a 1 a 2 f 2 f
+ 2 f 1 a 2 f 1 a 1 a
+ 2 f 1 a 2 f 1 a 2 f
+ 2 f 1 a 2 f 2 f 1 a
+ 2 f 1 a 2 f 2 f 2 f
+ 2 f 2 f 1 a 1 a 1 a
+ 2 f 2 f 1 a 1 a 2 f
+ 2 f 2 f 1 a 2 f 1 a
+ 2 f 2 f 1 a 2 f 2 f
+ 2 f 2 f 2 f 1 a 1 a
+ 2 f 2 f 2 f 1 a 2 f
+ 2 f 2 f 2 f 2 f 1 a
+ 2 f 2 f 2 f 2 f 2 f
+ a
+ f
+ t
+ u
+ v
+ w
+ X
+ 1 a 1 a 1 a 1 a 1 a
+ 1 a 1 a 1 a 1 a 2 f
+ 1 a 1 a 1 a 2 f 1 a
+ 1 a 1 a 1 a 2 f 2 f
+ 1 a 1 a 2 f 1 a 1 a
+ 1 a 1 a 2 f 1 a 2 f
+ 1 a 1 a 2 f 2 f 1 a
+ 1 a 1 a 2 f 2 f 2 f
+ 1 a 2 f 1 a 1 a 1 a
+ 1 a 2 f 1 a 1 a 2 f
+ 1 a 2 f 1 a 2 f 1 a
+ 1 a 2 f 1 a 2 f 2 f
+ 1 a 2 f 2 f 1 a 1 a
+ 1 a 2 f 2 f 1 a 2 f
+ 1 a 2 f 2 f 2 f 1 a
+ 1 a 2 f 2 f 2 f 2 f
+ 2 f 1 a 1 a 1 a 1 a
+ 2 f 1 a 1 a 1 a 2 f
+ 2 f 1 a 1 a 2 f 1 a
+ 2 f 1 a 1 a 2 f 2 f
+ 2 f 1 a 2 f 1 a 1 a
+ 2 f 1 a 2 f 1 a 2 f
+ 2 f 1 a 2 f 2 f 1 a
+ 2 f 1 a 2 f 2 f 2 f
+ 2 f 2 f 1 a 1 a 1 a
+ 2 f 2 f 1 a 1 a 2 f
+ 2 f 2 f 1 a 2 f 1 a
+ 2 f 2 f 1 a 2 f 2 f
+ 2 f 2 f 2 f 1 a 1 a
+ 2 f 2 f 2 f 1 a 2 f
+ 2 f 2 f 2 f 2 f 1 a
+ 2 f 2 f 2 f 2 f 2 f
+ a
+ f
+ t
+ u
+ v
+ w
+ X
+ 1 a 1 a 1 a 1 a 1 a
+ 1 a 1 a 1 a 1 a 2 f
+ 1 a 1 a 1 a 2 f 1 a
+ 1 a 1 a 1 a 2 f 2 f
+ 1 a 1 a 2 f 1 a 1 a
+ 1 a 1 a 2 f 1 a 2 f
+ 1 a 1 a 2 f 2 f 1 a
+ 1 a 1 a 2 f 2 f 2 f
+ 1 a 2 f 1 a 1 a 1 a
+ 1 a 2 f 1 a 1 a 2 f
+ 1 a 2 f 1 a 2 f 1 a
+ 1 a 2 f 1 a 2 f 2 f
+ 1 a 2 f 2 f 1 a 1 a
+ 1 a 2 f 2 f 1 a 2 f
+ 1 a 2 f 2 f 2 f 1 a
+ 1 a 2 f 2 f 2 f 2 f
+ 2 f 1 a 1 a 1 a 1 a
+ 2 f 1 a 1 a 1 a 2 f
+ 2 f 1 a 1 a 2 f 1 a
+ 2 f 1 a 1 a 2 f 2 f
+ 2 f 1 a 2 f 1 a 1 a
+ 2 f 1 a 2 f 1 a 2 f
+ 2 f 1 a 2 f 2 f 1 a
+ 2 f 1 a 2 f 2 f 2 f
+ 2 f 2 f 1 a 1 a 1 a
+ 2 f 2 f 1 a 1 a 2 f
+ 2 f 2 f 1 a 2 f 1 a
+ 2 f 2 f 1 a 2 f 2 f
+ 2 f 2 f 2 f 1 a 1 a
+ 2 f 2 f 2 f 1 a 2 f
+ 2 f 2 f 2 f 2 f 1 a
+ 2 f 2 f 2 f 2 f 2 f
+ a
+ f
+ t
+ u
+ v
+ w
+ X
+ 1 a 1 a 1 a 1 a 1 a
+ 1 a 1 a 1 a 1 a 2 f
+ 1 a 1 a 1 a 2 f 1 a
+ 1 a 1 a 1 a 2 f 2 f
+ 1 a 1 a 2 f 1 a 1 a
+ 1 a 1 a 2 f 1 a 2 f
+ 1 a 1 a 2 f 2 f 1 a
+ 1 a 1 a 2 f 2 f 2 f
+ 1 a 2 f 1 a 1 a 1 a
+ 1 a 2 f 1 a 1 a 2 f
+ 1 a 2 f 1 a 2 f 1 a
+ 1 a 2 f 1 a 2 f 2 f
+ 1 a 2 f 2 f 1 a 1 a
+ 1 a 2 f 2 f 1 a 2 f
+ 1 a 2 f 2 f 2 f 1 a
+ 1 a 2 f 2 f 2 f 2 f
+ 2 f 1 a 1 a 1 a 1 a
+ 2 f 1 a 1 a 1 a 2 f
+ 2 f 1 a 1 a 2 f 1 a
+ 2 f 1 a 1 a 2 f 2 f
+ 2 f 1 a 2 f 1 a 1 a
+ 2 f 1 a 2 f 1 a 2 f
+ 2 f 1 a 2 f 2 f 1 a
+ 2 f 1 a 2 f 2 f 2 f
+ 2 f 2 f 1 a 1 a 1 a
+ 2 f 2 f 1 a 1 a 2 f
+ 2 f 2 f 1 a 2 f 1 a
+ 2 f 2 f 1 a 2 f 2 f
+ 2 f 2 f 2 f 1 a 1 a
+ 2 f 2 f 2 f 1 a 2 f
+ 2 f 2 f 2 f 2 f 1 a
+ 2 f 2 f 2 f 2 f 2 f
+ a
+ f
+ t
+ u
+ v
+ w
+ X
+ 1 a 1 a 1 a 1 a 1 a
+ 1 a 1 a 1 a 1 a 2 f
+ 1 a 1 a 1 a 2 f 1 a
+ 1 a 1 a 1 a 2 f 2 f
+ 1 a 1 a 2 f 1 a 1 a
+ 1 a 1 a 2 f 1 a 2 f
+ 1 a 1 a 2 f 2 f 1 a
+ 1 a 1 a 2 f 2 f 2 f
+ 1 a 2 f 1 a 1 a 1 a
+ 1 a 2 f 1 a 1 a 2 f
+ 1 a 2 f 1 a 2 f 1 a
+ 1 a 2 f 1 a 2 f 2 f
+ 1 a 2 f 2 f 1 a 1 a
+ 1 a 2 f 2 f 1 a 2 f
+ 1 a 2 f 2 f 2 f 1 a
+ 1 a 2 f 2 f 2 f 2 f
+ 2 f 1 a 1 a 1 a 1 a
+ 2 f 1 a 1 a 1 a 2 f
+ 2 f 1 a 1 a 2 f 1 a
+ 2 f 1 a 1 a 2 f 2 f
+ 2 f 1 a 2 f 1 a 1 a
+ 2 f 1 a 2 f 1 a 2 f
+ 2 f 1 a 2 f 2 f 1 a
+ 2 f 1 a 2 f 2 f 2 f
+ 2 f 2 f 1 a 1 a 1 a
+ 2 f 2 f 1 a 1 a 2 f
+ 2 f 2 f 1 a 2 f 1 a
+ 2 f 2 f 1 a 2 f 2 f
+ 2 f 2 f 2 f 1 a 1 a
+ 2 f 2 f 2 f 1 a 2 f
+ 2 f 2 f 2 f 2 f 1 a
+ 2 f 2 f 2 f 2 f 2 f
+ a
+ f
+ t
+ u
+ v
+ w
+ X
+===DONE===
diff --git a/ext/oci8/tests/imp_res_4.phpt b/ext/oci8/tests/imp_res_4.phpt
new file mode 100644
index 0000000000..762ae77224
--- /dev/null
+++ b/ext/oci8/tests/imp_res_4.phpt
@@ -0,0 +1,82 @@
+--TEST--
+Oracle Database 12c Implicit Result Sets: oci_fetch
+--SKIPIF--
+<?php
+if (!extension_loaded('oci8')) die ("skip no oci8 extension");
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
+if (!(isset($matches[0]) && $matches[1] >= 12)) {
+ die("skip expected output only valid when using Oracle Database 12c or greater");
+}
+preg_match('/^[[:digit:]]+/', oci_client_version(), $matches);
+if (!(isset($matches[0]) && $matches[0] >= 12)) {
+ die("skip works only with Oracle 12c or greater version of Oracle client libraries");
+}
+?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+ "create or replace procedure imp_res_4_proc as
+ c1 sys_refcursor;
+ begin
+ open c1 for select 1 from dual union select 2 from dual;
+ dbms_sql.return_result (c1);
+ end;"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+// Run Test
+
+echo "Test 1\n";
+$s = oci_parse($c, "begin imp_res_4_proc(); end;");
+oci_execute($s);
+oci_fetch($s); // This will fail with ORA-24374
+var_dump(oci_result($s, 1));
+
+echo "\nTest 2\n";
+$s = oci_parse($c, "begin imp_res_4_proc(); end;");
+oci_execute($s);
+$r = oci_fetch_row($s);
+var_dump($r);
+oci_fetch($s); // This will fail with ORA-24374
+var_dump(oci_result($s, 1));
+$r = oci_fetch_row($s);
+var_dump($r);
+
+// Clean up
+
+$stmtarray = array(
+ "drop procedure imp_res_4_proc",
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1
+
+Warning: oci_fetch(): ORA-24374: %s in %simp_res_4.php on line %d
+bool(false)
+
+Test 2
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+
+Warning: oci_fetch(): ORA-24374: %s in %simp_res_4.php on line %d
+bool(false)
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+===DONE===
diff --git a/ext/oci8/tests/imp_res_5.phpt b/ext/oci8/tests/imp_res_5.phpt
new file mode 100644
index 0000000000..564a7a3740
--- /dev/null
+++ b/ext/oci8/tests/imp_res_5.phpt
@@ -0,0 +1,84 @@
+--TEST--
+Oracle Database 12c Implicit Result Sets: oci_fetch_all
+--SKIPIF--
+<?php
+if (!extension_loaded('oci8')) die ("skip no oci8 extension");
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
+if (!(isset($matches[0]) && $matches[1] >= 12)) {
+ die("skip expected output only valid when using Oracle Database 12c or greater");
+}
+preg_match('/^[[:digit:]]+/', oci_client_version(), $matches);
+if (!(isset($matches[0]) && $matches[0] >= 12)) {
+ die("skip works only with Oracle 12c or greater version of Oracle client libraries");
+}
+?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+ "create or replace procedure imp_res_5_proc as
+ c1 sys_refcursor;
+ begin
+ open c1 for select 1 from dual union select 2 from dual;
+ dbms_sql.return_result (c1);
+ end;"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+// Run Test
+
+echo "Test 1\n";
+$s = oci_parse($c, "begin imp_res_5_proc(); end;");
+oci_execute($s);
+oci_fetch_all($s,$res); // This will fail with ORA-24374
+var_dump($res);
+
+echo "\nTest 2\n";
+$s = oci_parse($c, "begin imp_res_5_proc(); end;");
+oci_execute($s);
+$r = oci_fetch_row($s);
+var_dump($r);
+oci_fetch_all($s, $res); // This will fail with ORA-24374
+var_dump($res);
+$r = oci_fetch_row($s);
+var_dump($r);
+
+// Clean up
+
+$stmtarray = array(
+ "drop procedure imp_res_5_proc",
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1
+
+Warning: oci_fetch_all(): ORA-24374: %s in %simp_res_5.php on line %d
+array(0) {
+}
+
+Test 2
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+
+Warning: oci_fetch_all(): ORA-24374: %s in %simp_res_5.php on line %d
+array(0) {
+}
+array(1) {
+ [0]=>
+ string(1) "2"
+}
+===DONE===
diff --git a/ext/oci8/tests/imp_res_6.phpt b/ext/oci8/tests/imp_res_6.phpt
new file mode 100644
index 0000000000..f94efe70db
--- /dev/null
+++ b/ext/oci8/tests/imp_res_6.phpt
@@ -0,0 +1,118 @@
+--TEST--
+Oracle Database 12c Implicit Result Sets: alternating oci_fetch_* calls
+--SKIPIF--
+<?php
+if (!extension_loaded('oci8')) die ("skip no oci8 extension");
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
+if (!(isset($matches[0]) && $matches[1] >= 12)) {
+ die("skip expected output only valid when using Oracle Database 12c or greater");
+}
+preg_match('/^[[:digit:]]+/', oci_client_version(), $matches);
+if (!(isset($matches[0]) && $matches[0] >= 12)) {
+ die("skip works only with Oracle 12c or greater version of Oracle client libraries");
+}
+?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+ "drop table imp_res_6_tab",
+ "create table imp_res_6_tab (c1 number, c2 varchar2(10))",
+ "insert into imp_res_6_tab values (1, 'a')",
+ "insert into imp_res_6_tab values (2, 'b')",
+ "insert into imp_res_6_tab values (3, 'c')",
+ "insert into imp_res_6_tab values (4, 'd')",
+ "insert into imp_res_6_tab values (5, 'e')",
+ "insert into imp_res_6_tab values (6, 'f')",
+
+ "create or replace procedure imp_res_6_proc as
+ c1 sys_refcursor;
+ begin
+ open c1 for select * from imp_res_6_tab order by 1;
+ dbms_sql.return_result(c1);
+ end;"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+// Run Test
+
+echo "Test 1\n";
+$s = oci_parse($c, "begin imp_res_6_proc(); end;");
+oci_execute($s);
+
+$row = oci_fetch_assoc($s);
+var_dump($row);
+$row = oci_fetch_row($s);
+var_dump($row);
+$row = oci_fetch_object($s);
+var_dump($row);
+$row = oci_fetch_array($s);
+var_dump($row);
+$row = oci_fetch_array($s, OCI_NUM);
+var_dump($row);
+$row = oci_fetch_array($s, OCI_ASSOC);
+var_dump($row);
+
+
+// Clean up
+
+$stmtarray = array(
+ "drop procedure imp_res_6_proc",
+ "drop table imp_res_6_tab",
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1
+array(2) {
+ ["C1"]=>
+ string(1) "1"
+ ["C2"]=>
+ string(1) "a"
+}
+array(2) {
+ [0]=>
+ string(1) "2"
+ [1]=>
+ string(1) "b"
+}
+object(stdClass)#%d (2) {
+ ["C1"]=>
+ string(1) "3"
+ ["C2"]=>
+ string(1) "c"
+}
+array(4) {
+ [0]=>
+ string(1) "4"
+ ["C1"]=>
+ string(1) "4"
+ [1]=>
+ string(1) "d"
+ ["C2"]=>
+ string(1) "d"
+}
+array(2) {
+ [0]=>
+ string(1) "5"
+ [1]=>
+ string(1) "e"
+}
+array(2) {
+ ["C1"]=>
+ string(1) "6"
+ ["C2"]=>
+ string(1) "f"
+}
+===DONE===
diff --git a/ext/oci8/tests/imp_res_7.phpt b/ext/oci8/tests/imp_res_7.phpt
new file mode 100644
index 0000000000..05ae5e6857
--- /dev/null
+++ b/ext/oci8/tests/imp_res_7.phpt
@@ -0,0 +1,873 @@
+--TEST--
+Oracle Database 12c Implicit Result Sets: bigger data size
+--SKIPIF--
+<?php
+if (!extension_loaded('oci8')) die ("skip no oci8 extension");
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
+if (!(isset($matches[0]) && $matches[1] >= 12)) {
+ die("skip expected output only valid when using Oracle Database 12c or greater");
+}
+preg_match('/^[[:digit:]]+/', oci_client_version(), $matches);
+if (!(isset($matches[0]) && $matches[0] >= 12)) {
+ die("skip works only with Oracle 12c or greater version of Oracle client libraries");
+}
+?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmt =
+ "declare
+ c1 sys_refcursor;
+ begin
+ open c1 for select 1 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 2 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 3 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 4 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 5 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 6 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 7 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 8 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 9 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 10 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 11 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 12 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 13 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 14 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 15 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 16 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 17 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 18 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 19 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 20 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 21 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 22 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 23 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 24 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 25 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 26 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 27 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 28 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 29 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 30 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 31 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 32 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 33 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 34 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 35 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 36 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 37 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 38 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 39 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 40 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 41 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 42 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 43 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 44 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 45 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 46 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 47 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 48 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 49 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 50 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 51 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 52 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 53 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 54 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 55 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 56 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 57 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 58 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 59 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 60 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 61 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 62 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 63 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 64 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 65 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 66 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 67 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 68 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 69 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 70 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 71 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 72 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 73 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 74 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 75 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 76 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 77 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 78 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 79 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 80 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 81 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 82 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 83 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 84 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 85 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 86 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 87 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 88 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 89 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 90 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 91 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 92 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 93 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 94 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 95 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 96 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 97 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 98 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 99 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 100 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 101 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 102 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 103 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 104 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 105 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 106 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 107 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 108 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 109 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 110 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 111 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 112 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 113 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 114 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 115 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 116 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 117 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 118 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 119 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 120 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 121 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 122 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 123 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 124 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 125 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 126 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 127 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 128 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 129 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 130 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 131 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 132 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 133 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 134 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 135 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 136 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 137 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 138 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 139 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 140 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 141 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 142 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 143 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 144 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 145 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 146 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 147 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 148 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 149 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 150 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 151 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 152 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 153 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 154 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 155 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 156 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 157 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 158 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 159 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 160 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 161 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 162 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 163 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 164 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 165 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 166 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 167 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 168 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 169 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 170 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 171 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 172 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 173 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 174 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 175 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 176 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 177 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 178 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 179 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 180 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 181 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 182 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 183 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 184 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 185 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 186 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 187 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 188 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 189 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 190 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 191 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 192 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 193 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 194 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 195 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 196 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 197 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 198 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 199 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 200 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 201 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 202 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 203 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 204 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 205 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 206 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 207 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 208 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 209 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 210 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 211 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 212 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 213 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 214 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 215 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 216 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 217 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 218 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 219 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 220 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 221 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 222 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 223 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 224 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 225 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 226 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 227 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 228 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 229 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 230 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 231 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 232 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 233 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 234 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 235 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 236 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 237 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 238 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 239 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 240 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 241 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 242 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 243 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 244 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 245 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 246 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 247 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 248 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 249 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 250 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 251 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 252 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 253 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 254 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 255 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 256 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 257 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 258 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 259 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 260 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 261 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 262 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 263 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 264 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 265 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 266 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 267 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 268 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 269 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 270 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 271 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 272 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 273 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 274 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 275 from dual;
+ dbms_sql.return_result(c1);
+ end;";
+
+// Run Test
+
+echo "Test 1\n";
+$s = oci_parse($c, $stmt);
+oci_execute($s);
+
+while (($row = oci_fetch_row($s)) != false) {
+ foreach ($row as $item) {
+ echo " ".$item;
+ }
+ echo "\n";
+}
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1
+ 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+ 100
+ 101
+ 102
+ 103
+ 104
+ 105
+ 106
+ 107
+ 108
+ 109
+ 110
+ 111
+ 112
+ 113
+ 114
+ 115
+ 116
+ 117
+ 118
+ 119
+ 120
+ 121
+ 122
+ 123
+ 124
+ 125
+ 126
+ 127
+ 128
+ 129
+ 130
+ 131
+ 132
+ 133
+ 134
+ 135
+ 136
+ 137
+ 138
+ 139
+ 140
+ 141
+ 142
+ 143
+ 144
+ 145
+ 146
+ 147
+ 148
+ 149
+ 150
+ 151
+ 152
+ 153
+ 154
+ 155
+ 156
+ 157
+ 158
+ 159
+ 160
+ 161
+ 162
+ 163
+ 164
+ 165
+ 166
+ 167
+ 168
+ 169
+ 170
+ 171
+ 172
+ 173
+ 174
+ 175
+ 176
+ 177
+ 178
+ 179
+ 180
+ 181
+ 182
+ 183
+ 184
+ 185
+ 186
+ 187
+ 188
+ 189
+ 190
+ 191
+ 192
+ 193
+ 194
+ 195
+ 196
+ 197
+ 198
+ 199
+ 200
+ 201
+ 202
+ 203
+ 204
+ 205
+ 206
+ 207
+ 208
+ 209
+ 210
+ 211
+ 212
+ 213
+ 214
+ 215
+ 216
+ 217
+ 218
+ 219
+ 220
+ 221
+ 222
+ 223
+ 224
+ 225
+ 226
+ 227
+ 228
+ 229
+ 230
+ 231
+ 232
+ 233
+ 234
+ 235
+ 236
+ 237
+ 238
+ 239
+ 240
+ 241
+ 242
+ 243
+ 244
+ 245
+ 246
+ 247
+ 248
+ 249
+ 250
+ 251
+ 252
+ 253
+ 254
+ 255
+ 256
+ 257
+ 258
+ 259
+ 260
+ 261
+ 262
+ 263
+ 264
+ 265
+ 266
+ 267
+ 268
+ 269
+ 270
+ 271
+ 272
+ 273
+ 274
+ 275
+===DONE===
diff --git a/ext/oci8/tests/imp_res_call_error.phpt b/ext/oci8/tests/imp_res_call_error.phpt
new file mode 100644
index 0000000000..8b0fa78db9
--- /dev/null
+++ b/ext/oci8/tests/imp_res_call_error.phpt
@@ -0,0 +1,61 @@
+--TEST--
+Oracle Database 12c Implicit Result Sets: using SQL 'CALL'
+--SKIPIF--
+<?php
+if (!extension_loaded('oci8')) die ("skip no oci8 extension");
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
+if (!(isset($matches[0]) && $matches[1] >= 12)) {
+ die("skip expected output only valid when using Oracle Database 12c or greater");
+}
+preg_match('/^[[:digit:]]+/', oci_client_version(), $matches);
+if (!(isset($matches[0]) && $matches[0] >= 12)) {
+ die("skip works only with Oracle 12c or greater version of Oracle client libraries");
+}
+?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+ "create or replace procedure imp_res_call_err_proc as
+ c1 sys_refcursor;
+ begin
+ open c1 for select * from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select * from dual;
+ dbms_sql.return_result (c1);
+ end;");
+
+oci8_test_sql_execute($c, $stmtarray);
+
+// Run Test
+
+echo "Test 1\n";
+
+$s = oci_parse($c, "call imp_res_call_err_proc()");
+oci_execute($s);
+
+// Clean up
+
+$stmtarray = array(
+ "drop procedure imp_res_call_err_proc"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1
+
+Warning: oci_execute(): ORA-29478: %s
+ORA-06512: at "SYS.DBMS_SQL", line %d
+ORA-06512: at "SYS.DBMS_SQL", line %d
+ORA-06512: at "SYSTEM.IMP_RES_CALL_ERR_PROC", line %d in %simp_res_call_error.php on line %d
+===DONE===
diff --git a/ext/oci8/tests/imp_res_cancel.phpt b/ext/oci8/tests/imp_res_cancel.phpt
new file mode 100644
index 0000000000..663d630dfb
--- /dev/null
+++ b/ext/oci8/tests/imp_res_cancel.phpt
@@ -0,0 +1,68 @@
+--TEST--
+Oracle Database 12c Implicit Result Sets: oci_cancel
+--SKIPIF--
+<?php
+if (!extension_loaded('oci8')) die ("skip no oci8 extension");
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
+if (!(isset($matches[0]) && $matches[1] >= 12)) {
+ die("skip expected output only valid when using Oracle Database 12c or greater");
+}
+preg_match('/^[[:digit:]]+/', oci_client_version(), $matches);
+if (!(isset($matches[0]) && $matches[0] >= 12)) {
+ die("skip works only with Oracle 12c or greater version of Oracle client libraries");
+}
+?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+$stmtarray = array(
+ "create or replace procedure imp_res_cancel_proc as
+ c1 sys_refcursor;
+ c2 sys_refcursor;
+ begin
+ open c1 for select 1 from dual union all select 2 from dual;
+ dbms_sql.return_result(c1);
+ open c2 for select 3 from dual;
+ dbms_sql.return_result (c2);
+ end;"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+// Run Test
+
+echo "Test 1\n";
+$s = oci_parse($c, "begin imp_res_cancel_proc(); end;");
+oci_execute($s);
+while (($row = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS)) != false) {
+ foreach ($row as $item) {
+ echo " ".$item;
+ }
+ echo "\n";
+ var_dump(oci_cancel($s));
+}
+
+// Clean up
+
+$stmtarray = array(
+ "drop procedure imp_res_cancel_proc"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1
+ 1
+bool(true)
+ 2
+bool(true)
+ 3
+bool(true)
+===DONE===
diff --git a/ext/oci8/tests/imp_res_close.phpt b/ext/oci8/tests/imp_res_close.phpt
new file mode 100644
index 0000000000..01ac2c75e0
--- /dev/null
+++ b/ext/oci8/tests/imp_res_close.phpt
@@ -0,0 +1,69 @@
+--TEST--
+Oracle Database 12c Implicit Result Sets: oci_free_statement #1
+--SKIPIF--
+<?php
+if (!extension_loaded('oci8')) die ("skip no oci8 extension");
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
+if (!(isset($matches[0]) && $matches[1] >= 12)) {
+ die("skip expected output only valid when using Oracle Database 12c or greater");
+}
+preg_match('/^[[:digit:]]+/', oci_client_version(), $matches);
+if (!(isset($matches[0]) && $matches[0] >= 12)) {
+ die("skip works only with Oracle 12c or greater version of Oracle client libraries");
+}
+?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+ "create or replace procedure imp_res_close_proc as
+ c1 sys_refcursor;
+ begin
+ open c1 for select 1 from dual union all select 2 from dual order by 1;
+ dbms_sql.return_result(c1);
+ open c1 for select 3 from dual union all select 4 from dual order by 1;
+ dbms_sql.return_result(c1);
+ open c1 for select 5 from dual union all select 6 from dual order by 1;
+ dbms_sql.return_result(c1);
+ end;"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+// Run Test
+
+echo "Test 1\n";
+$s = oci_parse($c, "begin imp_res_close_proc(); end;");
+oci_execute($s);
+while (($row = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS)) != false) {
+ foreach ($row as $item) {
+ echo " ".$item;
+ }
+ echo "\n";
+ oci_free_statement($s); // Free the implicit result handle
+}
+
+// Clean up
+
+$stmtarray = array(
+ "drop procedure imp_res_close_proc"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1
+ 1
+ 2
+
+Warning: oci_fetch_array(): %d is not a valid oci8 statement resource in %simp_res_close.php on line %d
+===DONE===
diff --git a/ext/oci8/tests/imp_res_cursor.phpt b/ext/oci8/tests/imp_res_cursor.phpt
new file mode 100644
index 0000000000..cac0a5d1c0
--- /dev/null
+++ b/ext/oci8/tests/imp_res_cursor.phpt
@@ -0,0 +1,99 @@
+--TEST--
+Oracle Database 12c Implicit Result Sets: nested cursor
+--SKIPIF--
+<?php
+if (!extension_loaded('oci8')) die ("skip no oci8 extension");
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
+if (!(isset($matches[0]) && $matches[1] >= 12)) {
+ die("skip expected output only valid when using Oracle Database 12c or greater");
+}
+preg_match('/^[[:digit:]]+/', oci_client_version(), $matches);
+if (!(isset($matches[0]) && $matches[0] >= 12)) {
+ die("skip works only with Oracle 12c or greater version of Oracle client libraries");
+}
+?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+ "drop table imp_res_cursor_tab_1",
+ "create table imp_res_cursor_tab_1 (c1 number, c2 varchar2(10))",
+ "insert into imp_res_cursor_tab_1 values (1, 'abcde')",
+ "insert into imp_res_cursor_tab_1 values (2, 'fghij')",
+ "insert into imp_res_cursor_tab_1 values (3, 'klmno')",
+
+ "drop table imp_res_cursor_tab_2",
+ "create table imp_res_cursor_tab_2 (c3 varchar2(1))",
+ "insert into imp_res_cursor_tab_2 values ('t')",
+ "insert into imp_res_cursor_tab_2 values ('u')",
+ "insert into imp_res_cursor_tab_2 values ('v')",
+
+ "create or replace procedure imp_res_cursor_proc as
+ c1 sys_refcursor;
+ begin
+ open c1 for select * from dual;
+ dbms_sql.return_result (c1);
+
+ open c1 for select cursor(select c1, c2 from imp_res_cursor_tab_1 order by 1) as curs from dual;
+ dbms_sql.return_result(c1);
+
+ open c1 for select * from imp_res_cursor_tab_2 where rownum < 3 order by 1;
+ dbms_sql.return_result(c1);
+ end;"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+function do_fetch($s)
+{
+ while (($row = oci_fetch_assoc($s)) != false) {
+ foreach ($row as $item) {
+ if (is_resource($item)) { // Nested cursor
+ oci_execute($item);
+ do_fetch($item);
+ } else {
+ echo " ".$item;
+ }
+ }
+ echo "\n";
+ }
+}
+
+// Run Test
+
+echo "Test 1\n";
+
+$s = oci_parse($c, "begin imp_res_cursor_proc(); end;");
+oci_execute($s);
+
+do_fetch($s);
+
+// Clean up
+
+$stmtarray = array(
+ "drop procedure imp_res_cursor_proc",
+ "drop table imp_res_cursor_tab_1",
+ "drop table imp_res_cursor_tab_2"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1
+ X
+ 1 abcde
+ 2 fghij
+ 3 klmno
+
+ t
+ u
+===DONE===
diff --git a/ext/oci8/tests/imp_res_dbmsoutput.phpt b/ext/oci8/tests/imp_res_dbmsoutput.phpt
new file mode 100644
index 0000000000..8c9808d96c
--- /dev/null
+++ b/ext/oci8/tests/imp_res_dbmsoutput.phpt
@@ -0,0 +1,136 @@
+--TEST--
+Oracle Database 12c Implicit Result Sets: interleaved with DBMS_OUTPUT
+--SKIPIF--
+<?php
+if (!extension_loaded('oci8')) die ("skip no oci8 extension");
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
+if (!(isset($matches[0]) && $matches[1] >= 12)) {
+ die("skip expected output only valid when using Oracle Database 12c or greater");
+}
+preg_match('/^[[:digit:]]+/', oci_client_version(), $matches);
+if (!(isset($matches[0]) && $matches[0] >= 12)) {
+ die("skip works only with Oracle 12c or greater version of Oracle client libraries");
+}
+?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+ "drop table imp_res_dbmsoutput_tab_1",
+ "create table imp_res_dbmsoutput_tab_1 (c1 number, c2 varchar2(10))",
+ "insert into imp_res_dbmsoutput_tab_1 values (1, 'abcde')",
+ "insert into imp_res_dbmsoutput_tab_1 values (2, 'fghij')",
+ "insert into imp_res_dbmsoutput_tab_1 values (3, 'klmno')",
+
+ "drop table imp_res_dbmsoutput_tab_2",
+ "create table imp_res_dbmsoutput_tab_2 (c3 varchar2(1))",
+ "insert into imp_res_dbmsoutput_tab_2 values ('t')",
+ "insert into imp_res_dbmsoutput_tab_2 values ('u')",
+ "insert into imp_res_dbmsoutput_tab_2 values ('v')",
+
+ "create or replace procedure imp_res_dbmsoutput_proc as
+ c1 sys_refcursor;
+ begin
+ dbms_output.put_line('dbms_output Line 1');
+ open c1 for select * from imp_res_dbmsoutput_tab_1 order by 1;
+ dbms_sql.return_result(c1);
+ dbms_output.put_line('dbms_output Line 2');
+ open c1 for select * from imp_res_dbmsoutput_tab_2 order by 1;
+ dbms_sql.return_result(c1);
+ end;"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+function setserveroutputon($c)
+{
+ $s = oci_parse($c, "begin dbms_output.enable(null); end;");
+ oci_execute($s);
+}
+
+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;
+}
+
+setserveroutputon($c);
+
+// Run Test
+
+echo "Test 1\n";
+$s = oci_parse($c, "begin imp_res_dbmsoutput_proc(); end;");
+oci_execute($s);
+var_dump(getdbmsoutput_do($c));
+while (($row = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS)) != false) {
+ foreach ($row as $item) {
+ echo " ".$item;
+ }
+ echo "\n";
+}
+
+echo "\nTest 2\n";
+$s = oci_parse($c, "begin imp_res_dbmsoutput_proc(); end;");
+oci_execute($s);
+while (($row = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS)) != false) {
+ foreach ($row as $item) {
+ echo " ".$item;
+ }
+ echo "\n";
+}
+var_dump(getdbmsoutput_do($c));
+
+// Clean up
+
+$stmtarray = array(
+ "drop procedure imp_res_dbmsoutput_proc",
+ "drop table imp_res_dbmsoutput_tab_1",
+ "drop table imp_res_dbmsoutput_tab_2"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1
+array(2) {
+ [0]=>
+ string(18) "dbms_output Line 1"
+ [1]=>
+ string(18) "dbms_output Line 2"
+}
+ 1 abcde
+ 2 fghij
+ 3 klmno
+ t
+ u
+ v
+
+Test 2
+ 1 abcde
+ 2 fghij
+ 3 klmno
+ t
+ u
+ v
+array(2) {
+ [0]=>
+ string(18) "dbms_output Line 1"
+ [1]=>
+ string(18) "dbms_output Line 2"
+}
+===DONE===
diff --git a/ext/oci8/tests/imp_res_field.phpt b/ext/oci8/tests/imp_res_field.phpt
new file mode 100644
index 0000000000..54b8295cf9
--- /dev/null
+++ b/ext/oci8/tests/imp_res_field.phpt
@@ -0,0 +1,227 @@
+--TEST--
+Oracle Database 12c Implicit Result Sets: field tests
+--SKIPIF--
+<?php
+if (!extension_loaded('oci8')) die ("skip no oci8 extension");
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
+if (!(isset($matches[0]) && $matches[1] >= 12)) {
+ die("skip expected output only valid when using Oracle Database 12c or greater");
+}
+preg_match('/^[[:digit:]]+/', oci_client_version(), $matches);
+if (!(isset($matches[0]) && $matches[0] >= 12)) {
+ die("skip works only with Oracle 12c or greater version of Oracle client libraries");
+}
+?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+ "drop table imp_res_field_tab_1",
+ "create table imp_res_field_tab_1 (c1_number number, c2_varchar210 varchar2(10))",
+ "insert into imp_res_field_tab_1 values (1111, 'abcde')",
+
+ "drop table imp_res_field_tab_2",
+ "create table imp_res_field_tab_2 (c3_varchar21 varchar2(4))",
+ "insert into imp_res_field_tab_2 values ('tttt')",
+
+ "drop table imp_res_field_tab_3",
+ "create table imp_res_field_tab_3 (c4_number52 number(5,2))",
+ "insert into imp_res_field_tab_3 values (33)",
+ "insert into imp_res_field_tab_3 values (NULL)",
+
+ "create or replace procedure imp_res_field_proc as
+ c1 sys_refcursor;
+ begin
+ open c1 for select * from imp_res_field_tab_1 order by 1;
+ dbms_sql.return_result(c1);
+
+ open c1 for select * from imp_res_field_tab_2 order by 1;
+ dbms_sql.return_result(c1);
+
+ open c1 for select * from imp_res_field_tab_3 order by 1;
+ dbms_sql.return_result(c1);
+ end;"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+function print_fields($s)
+{
+ echo "num fields : " . oci_num_fields($s) . "\n";
+ for ($i = 1; $i <= oci_num_fields($s); $i++) {
+ $is_null = oci_field_is_null($s, $i) ? "T" : "F";
+ $name = oci_field_name($s, $i);
+ $precision = oci_field_precision($s, $i);
+ $scale = oci_field_scale($s, $i);
+ $size = oci_field_size($s, $i);
+ $typeraw = oci_field_type_raw($s, $i);
+ $type = oci_field_type($s, $i);
+ echo "$name\t: is_null $is_null, precision $precision, scale $scale, size $size, typeraw $typeraw, type $type\n";
+ }
+}
+
+// Run Test
+
+echo "Test 1 - can't get IRS fields from parent\n";
+$s = oci_parse($c, "begin imp_res_field_proc(); end;");
+oci_execute($s);
+print_fields($s);
+
+echo "\nTest 2 - can't get IRS fields from parent when fetching\n";
+$s = oci_parse($c, "begin imp_res_field_proc(); end;");
+oci_execute($s);
+while (($r = oci_fetch_row($s))) {
+ var_dump($r);
+ print_fields($s);
+}
+
+echo "\nTest 3 - get IRS fields\n";
+$s = oci_parse($c, "begin imp_res_field_proc(); end;");
+oci_execute($s);
+while (($s1 = oci_get_implicit_resultset($s))) {
+ print_fields($s1);
+}
+
+echo "\nTest 4 - get IRS fields before fetching rows\n";
+$s = oci_parse($c, "begin imp_res_field_proc(); end;");
+oci_execute($s);
+$i = 0;
+while (($s1 = oci_get_implicit_resultset($s))) {
+ echo "===> Result set ".++$i."\n";
+ print_fields($s1);
+ while (($r = oci_fetch_row($s1)) !== false) {
+ var_dump($r);
+ }
+}
+
+echo "\nTest 5 - get IRS fields when fetching rows\n";
+$s = oci_parse($c, "begin imp_res_field_proc(); end;");
+oci_execute($s);
+$i = 0;
+while (($s1 = oci_get_implicit_resultset($s))) {
+ echo "===> Result set ".++$i."\n";
+ while (($r = oci_fetch_row($s1)) !== false) {
+ var_dump($r);
+ print_fields($s1);
+ }
+}
+
+// Clean up
+
+$stmtarray = array(
+ "drop procedure imp_res_field_proc",
+ "drop table imp_res_field_tab_1",
+ "drop table imp_res_field_tab_2",
+ "drop table imp_res_field_tab_3"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1 - can't get IRS fields from parent
+num fields : 0
+
+Test 2 - can't get IRS fields from parent when fetching
+array(2) {
+ [0]=>
+ string(4) "1111"
+ [1]=>
+ string(5) "abcde"
+}
+num fields : 0
+array(1) {
+ [0]=>
+ string(4) "tttt"
+}
+num fields : 0
+array(1) {
+ [0]=>
+ string(2) "33"
+}
+num fields : 0
+array(1) {
+ [0]=>
+ NULL
+}
+num fields : 0
+
+Test 3 - get IRS fields
+num fields : 2
+C1_NUMBER : is_null F, precision 0, scale -127, size 22, typeraw 2, type NUMBER
+C2_VARCHAR210 : is_null F, precision 0, scale 0, size 10, typeraw 1, type VARCHAR2
+num fields : 1
+C3_VARCHAR21 : is_null F, precision 0, scale 0, size 4, typeraw 1, type VARCHAR2
+num fields : 1
+C4_NUMBER52 : is_null F, precision 5, scale 2, size 22, typeraw 2, type NUMBER
+
+Test 4 - get IRS fields before fetching rows
+===> Result set 1
+num fields : 2
+C1_NUMBER : is_null F, precision 0, scale -127, size 22, typeraw 2, type NUMBER
+C2_VARCHAR210 : is_null F, precision 0, scale 0, size 10, typeraw 1, type VARCHAR2
+array(2) {
+ [0]=>
+ string(4) "1111"
+ [1]=>
+ string(5) "abcde"
+}
+===> Result set 2
+num fields : 1
+C3_VARCHAR21 : is_null F, precision 0, scale 0, size 4, typeraw 1, type VARCHAR2
+array(1) {
+ [0]=>
+ string(4) "tttt"
+}
+===> Result set 3
+num fields : 1
+C4_NUMBER52 : is_null F, precision 5, scale 2, size 22, typeraw 2, type NUMBER
+array(1) {
+ [0]=>
+ string(2) "33"
+}
+array(1) {
+ [0]=>
+ NULL
+}
+
+Test 5 - get IRS fields when fetching rows
+===> Result set 1
+array(2) {
+ [0]=>
+ string(4) "1111"
+ [1]=>
+ string(5) "abcde"
+}
+num fields : 2
+C1_NUMBER : is_null F, precision 0, scale -127, size 22, typeraw 2, type NUMBER
+C2_VARCHAR210 : is_null F, precision 0, scale 0, size 10, typeraw 1, type VARCHAR2
+===> Result set 2
+array(1) {
+ [0]=>
+ string(4) "tttt"
+}
+num fields : 1
+C3_VARCHAR21 : is_null F, precision 0, scale 0, size 4, typeraw 1, type VARCHAR2
+===> Result set 3
+array(1) {
+ [0]=>
+ string(2) "33"
+}
+num fields : 1
+C4_NUMBER52 : is_null F, precision 5, scale 2, size 22, typeraw 2, type NUMBER
+array(1) {
+ [0]=>
+ NULL
+}
+num fields : 1
+C4_NUMBER52 : is_null T, precision 5, scale 2, size 22, typeraw 2, type NUMBER
+===DONE===
diff --git a/ext/oci8/tests/imp_res_func_error.phpt b/ext/oci8/tests/imp_res_func_error.phpt
new file mode 100644
index 0000000000..73c0557930
--- /dev/null
+++ b/ext/oci8/tests/imp_res_func_error.phpt
@@ -0,0 +1,67 @@
+--TEST--
+Oracle Database 12c Implicit Result Sets: test with a PL/SQL function
+--SKIPIF--
+<?php
+if (!extension_loaded('oci8')) die ("skip no oci8 extension");
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
+if (!(isset($matches[0]) && $matches[1] >= 12)) {
+ die("skip expected output only valid when using Oracle Database 12c or greater");
+}
+preg_match('/^[[:digit:]]+/', oci_client_version(), $matches);
+if (!(isset($matches[0]) && $matches[0] >= 12)) {
+ die("skip works only with Oracle 12c or greater version of Oracle client libraries");
+}
+?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+ "create or replace function imp_res_func_error return number as
+ c1 sys_refcursor;
+ begin
+ open c1 for select * from dual;
+ dbms_sql.return_result(c1);
+ return 1234;
+ end;"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+// Run Test
+
+echo "Test 1\n";
+$s = oci_parse($c, "select imp_res_func_error from dual");
+$r = oci_execute($s); // This will fail with ORA-29478 in Oracle 12.1
+if ($r) {
+ while (($row = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS)) != false) {
+ foreach ($row as $item) {
+ echo " ".$item;
+ }
+ echo "\n";
+ }
+}
+// Clean up
+
+$stmtarray = array(
+ "drop function imp_res_func_error",
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1
+
+Warning: oci_execute(): ORA-29478: %s
+ORA-06512: %s
+ORA-06512: %s
+ORA-06512: %s
+===DONE===
diff --git a/ext/oci8/tests/imp_res_get_1.phpt b/ext/oci8/tests/imp_res_get_1.phpt
new file mode 100644
index 0000000000..665f773b57
--- /dev/null
+++ b/ext/oci8/tests/imp_res_get_1.phpt
@@ -0,0 +1,109 @@
+--TEST--
+Oracle Database 12c Implicit Result Sets: oci_get_implicit_resultset: basic test
+--SKIPIF--
+<?php
+if (!extension_loaded('oci8')) die ("skip no oci8 extension");
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
+if (!(isset($matches[0]) && $matches[1] >= 12)) {
+ die("skip expected output only valid when using Oracle Database 12c or greater");
+}
+preg_match('/^[[:digit:]]+/', oci_client_version(), $matches);
+if (!(isset($matches[0]) && $matches[0] >= 12)) {
+ die("skip works only with Oracle 12c or greater version of Oracle client libraries");
+}
+?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+ "drop table imp_res_get_1_tab_1",
+ "create table imp_res_get_1_tab_1 (c1 number, c2 varchar2(10))",
+ "insert into imp_res_get_1_tab_1 values (1, 'abcde')",
+ "insert into imp_res_get_1_tab_1 values (2, 'fghij')",
+ "insert into imp_res_get_1_tab_1 values (3, 'klmno')",
+
+ "drop table imp_res_get_1_tab_2",
+ "create table imp_res_get_1_tab_2 (c3 varchar2(1))",
+ "insert into imp_res_get_1_tab_2 values ('t')",
+ "insert into imp_res_get_1_tab_2 values ('u')",
+ "insert into imp_res_get_1_tab_2 values ('v')",
+
+ "create or replace procedure imp_res_get_1_proc as
+ c1 sys_refcursor;
+ begin
+ open c1 for select * from imp_res_get_1_tab_1 order by 1;
+ dbms_sql.return_result(c1);
+
+ open c1 for select * from imp_res_get_1_tab_2 where rownum < 3 order by 1;
+ dbms_sql.return_result(c1);
+
+ open c1 for select * from dual;
+ dbms_sql.return_result (c1);
+ end;"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+// Run Test
+
+echo "Test 1\n";
+$s = oci_parse($c, "begin imp_res_get_1_proc(); end;");
+oci_execute($s);
+while (($s1 = oci_get_implicit_resultset($s))) {
+ while (($row = oci_fetch_array($s1, OCI_ASSOC+OCI_RETURN_NULLS)) != false) {
+ foreach ($row as $item) {
+ echo " ".$item;
+ }
+ echo "\n";
+ }
+}
+
+echo "\nTest 2 - with execute\n";
+$s = oci_parse($c, "begin imp_res_get_1_proc(); end;");
+oci_execute($s);
+while (($s1 = oci_get_implicit_resultset($s))) {
+ oci_execute($s1); // no op
+ while (($row = oci_fetch_array($s1, OCI_ASSOC+OCI_RETURN_NULLS)) != false) {
+ foreach ($row as $item) {
+ echo " ".$item;
+ }
+ echo "\n";
+ }
+}
+
+// Clean up
+
+$stmtarray = array(
+ "drop procedure imp_res_get_1_proc",
+ "drop table imp_res_get_1_tab_1",
+ "drop table imp_res_get_1_tab_2"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1
+ 1 abcde
+ 2 fghij
+ 3 klmno
+ t
+ u
+ X
+
+Test 2 - with execute
+ 1 abcde
+ 2 fghij
+ 3 klmno
+ t
+ u
+ X
+===DONE===
diff --git a/ext/oci8/tests/imp_res_get_2.phpt b/ext/oci8/tests/imp_res_get_2.phpt
new file mode 100644
index 0000000000..b20b8dd397
--- /dev/null
+++ b/ext/oci8/tests/imp_res_get_2.phpt
@@ -0,0 +1,107 @@
+--TEST--
+Oracle Database 12c Implicit Result Sets: oci_get_implicit_resultset: similar to imp_res_get_1 but with unrolled loop
+--SKIPIF--
+<?php
+if (!extension_loaded('oci8')) die ("skip no oci8 extension");
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
+if (!(isset($matches[0]) && $matches[1] >= 12)) {
+ die("skip expected output only valid when using Oracle Database 12c or greater");
+}
+preg_match('/^[[:digit:]]+/', oci_client_version(), $matches);
+if (!(isset($matches[0]) && $matches[0] >= 12)) {
+ die("skip works only with Oracle 12c or greater version of Oracle client libraries");
+}
+?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+ "drop table imp_res_get_2_tab_1",
+ "create table imp_res_get_2_tab_1 (c1 number, c2 varchar2(10))",
+ "insert into imp_res_get_2_tab_1 values (1, 'abcde')",
+ "insert into imp_res_get_2_tab_1 values (2, 'fghij')",
+ "insert into imp_res_get_2_tab_1 values (3, 'klmno')",
+
+ "drop table imp_res_get_2_tab_2",
+ "create table imp_res_get_2_tab_2 (c3 varchar2(1))",
+ "insert into imp_res_get_2_tab_2 values ('t')",
+ "insert into imp_res_get_2_tab_2 values ('u')",
+ "insert into imp_res_get_2_tab_2 values ('v')",
+
+ "create or replace procedure imp_res_get_2_proc as
+ c1 sys_refcursor;
+ begin
+ open c1 for select * from imp_res_get_2_tab_1 order by 1;
+ dbms_sql.return_result(c1);
+
+ open c1 for select * from imp_res_get_2_tab_2 where rownum < 3 order by 1;
+ dbms_sql.return_result(c1);
+
+ open c1 for select * from dual;
+ dbms_sql.return_result (c1);
+ end;"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+// Run Test
+
+echo "Test 1\n";
+
+$s = oci_parse($c, "begin imp_res_get_2_proc(); end;");
+oci_execute($s);
+
+$s1 = oci_get_implicit_resultset($s);
+while (($row = oci_fetch_array($s1, OCI_ASSOC+OCI_RETURN_NULLS))) {
+ foreach ($row as $item) {
+ echo " ".$item;
+ }
+ echo "\n";
+}
+
+$s2 = oci_get_implicit_resultset($s);
+while (($row = oci_fetch_array($s2, OCI_ASSOC+OCI_RETURN_NULLS))) {
+ foreach ($row as $item) {
+ echo " ".$item;
+ }
+ echo "\n";
+}
+oci_free_statement($s2);
+
+$s3 = oci_get_implicit_resultset($s);
+while (($row = oci_fetch_array($s3, OCI_ASSOC+OCI_RETURN_NULLS))) {
+ foreach ($row as $item) {
+ echo " ".$item;
+ }
+ echo "\n";
+}
+oci_free_statement($s3);
+
+// Clean up
+
+$stmtarray = array(
+ "drop procedure imp_res_get_2_proc",
+ "drop table imp_res_get_2_tab_1",
+ "drop table imp_res_get_2_tab_2"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1
+ 1 abcde
+ 2 fghij
+ 3 klmno
+ t
+ u
+ X
+===DONE===
diff --git a/ext/oci8/tests/imp_res_get_3.phpt b/ext/oci8/tests/imp_res_get_3.phpt
new file mode 100644
index 0000000000..15b2efaef0
--- /dev/null
+++ b/ext/oci8/tests/imp_res_get_3.phpt
@@ -0,0 +1,267 @@
+--TEST--
+Oracle Database 12c Implicit Result Sets: oci_get_implicit_resultset: basic test 3
+--SKIPIF--
+<?php
+if (!extension_loaded('oci8')) die ("skip no oci8 extension");
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
+if (!(isset($matches[0]) && $matches[1] >= 12)) {
+ die("skip expected output only valid when using Oracle Database 12c or greater");
+}
+preg_match('/^[[:digit:]]+/', oci_client_version(), $matches);
+if (!(isset($matches[0]) && $matches[0] >= 12)) {
+ die("skip works only with Oracle 12c or greater version of Oracle client libraries");
+}
+?>
+--INI--
+oci8.statement_cache_size = 0
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+ "drop table imp_res_get_3_tab_1",
+ "create table imp_res_get_3_tab_1 (c1 number, c2 varchar2(10))",
+ "insert into imp_res_get_3_tab_1 values (1, 'abcde')",
+ "insert into imp_res_get_3_tab_1 values (2, 'fghij')",
+ "insert into imp_res_get_3_tab_1 values (3, 'klmno')",
+
+ "drop table imp_res_get_3_tab_2",
+ "create table imp_res_get_3_tab_2 (c3 varchar2(1))",
+ "insert into imp_res_get_3_tab_2 values ('t')",
+ "insert into imp_res_get_3_tab_2 values ('u')",
+ "insert into imp_res_get_3_tab_2 values ('v')",
+
+ "create or replace procedure imp_res_get_3_proc as
+ c1 sys_refcursor;
+ i pls_integer;
+ begin
+ for i in 1..30 loop -- if this value is too big for Oracle's open_cursors, calling imp_res_get_3_proc() can fail with ORA-1000
+ open c1 for select * from imp_res_get_3_tab_1 order by 1;
+ dbms_sql.return_result(c1);
+ open c1 for select * from imp_res_get_3_tab_2 where rownum < 3 order by 1;
+ dbms_sql.return_result(c1);
+ open c1 for select * from dual;
+ dbms_sql.return_result (c1);
+ end loop;
+ end;"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+// Run Test
+
+echo "Test 1\n";
+
+$s = oci_parse($c, "begin imp_res_get_3_proc(); end;");
+oci_execute($s);
+
+while (($s1 = oci_get_implicit_resultset($s))) {
+ while (($row = oci_fetch_array($s1, OCI_ASSOC+OCI_RETURN_NULLS)) != false) {
+ foreach ($row as $item) {
+ echo " ".$item;
+ }
+ echo "\n";
+ }
+}
+
+// Clean up
+
+$stmtarray = array(
+ "drop procedure imp_res_get_3_proc",
+ "drop table imp_res_get_3_tab_1",
+ "drop table imp_res_get_3_tab_2"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1
+ 1 abcde
+ 2 fghij
+ 3 klmno
+ t
+ u
+ X
+ 1 abcde
+ 2 fghij
+ 3 klmno
+ t
+ u
+ X
+ 1 abcde
+ 2 fghij
+ 3 klmno
+ t
+ u
+ X
+ 1 abcde
+ 2 fghij
+ 3 klmno
+ t
+ u
+ X
+ 1 abcde
+ 2 fghij
+ 3 klmno
+ t
+ u
+ X
+ 1 abcde
+ 2 fghij
+ 3 klmno
+ t
+ u
+ X
+ 1 abcde
+ 2 fghij
+ 3 klmno
+ t
+ u
+ X
+ 1 abcde
+ 2 fghij
+ 3 klmno
+ t
+ u
+ X
+ 1 abcde
+ 2 fghij
+ 3 klmno
+ t
+ u
+ X
+ 1 abcde
+ 2 fghij
+ 3 klmno
+ t
+ u
+ X
+ 1 abcde
+ 2 fghij
+ 3 klmno
+ t
+ u
+ X
+ 1 abcde
+ 2 fghij
+ 3 klmno
+ t
+ u
+ X
+ 1 abcde
+ 2 fghij
+ 3 klmno
+ t
+ u
+ X
+ 1 abcde
+ 2 fghij
+ 3 klmno
+ t
+ u
+ X
+ 1 abcde
+ 2 fghij
+ 3 klmno
+ t
+ u
+ X
+ 1 abcde
+ 2 fghij
+ 3 klmno
+ t
+ u
+ X
+ 1 abcde
+ 2 fghij
+ 3 klmno
+ t
+ u
+ X
+ 1 abcde
+ 2 fghij
+ 3 klmno
+ t
+ u
+ X
+ 1 abcde
+ 2 fghij
+ 3 klmno
+ t
+ u
+ X
+ 1 abcde
+ 2 fghij
+ 3 klmno
+ t
+ u
+ X
+ 1 abcde
+ 2 fghij
+ 3 klmno
+ t
+ u
+ X
+ 1 abcde
+ 2 fghij
+ 3 klmno
+ t
+ u
+ X
+ 1 abcde
+ 2 fghij
+ 3 klmno
+ t
+ u
+ X
+ 1 abcde
+ 2 fghij
+ 3 klmno
+ t
+ u
+ X
+ 1 abcde
+ 2 fghij
+ 3 klmno
+ t
+ u
+ X
+ 1 abcde
+ 2 fghij
+ 3 klmno
+ t
+ u
+ X
+ 1 abcde
+ 2 fghij
+ 3 klmno
+ t
+ u
+ X
+ 1 abcde
+ 2 fghij
+ 3 klmno
+ t
+ u
+ X
+ 1 abcde
+ 2 fghij
+ 3 klmno
+ t
+ u
+ X
+ 1 abcde
+ 2 fghij
+ 3 klmno
+ t
+ u
+ X
+===DONE===
diff --git a/ext/oci8/tests/imp_res_get_4.phpt b/ext/oci8/tests/imp_res_get_4.phpt
new file mode 100644
index 0000000000..ea7fb8775a
--- /dev/null
+++ b/ext/oci8/tests/imp_res_get_4.phpt
@@ -0,0 +1,146 @@
+--TEST--
+Oracle Database 12c Implicit Result Sets: oci_get_implicit_resultset: interleaved fetches
+--SKIPIF--
+<?php
+if (!extension_loaded('oci8')) die ("skip no oci8 extension");
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
+if (!(isset($matches[0]) && $matches[1] >= 12)) {
+ die("skip expected output only valid when using Oracle Database 12c or greater");
+}
+preg_match('/^[[:digit:]]+/', oci_client_version(), $matches);
+if (!(isset($matches[0]) && $matches[0] >= 12)) {
+ die("skip works only with Oracle 12c or greater version of Oracle client libraries");
+}
+?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+ "drop table imp_res_get_4_tab_1",
+ "create table imp_res_get_4_tab_1 (c1 number, c2 varchar2(10))",
+ "insert into imp_res_get_4_tab_1 values (1, 'abcde')",
+ "insert into imp_res_get_4_tab_1 values (2, 'fghij')",
+ "insert into imp_res_get_4_tab_1 values (3, 'klmno')",
+
+ "drop table imp_res_get_4_tab_2",
+ "create table imp_res_get_4_tab_2 (c3 varchar2(1))",
+ "insert into imp_res_get_4_tab_2 values ('t')",
+ "insert into imp_res_get_4_tab_2 values ('u')",
+ "insert into imp_res_get_4_tab_2 values ('v')",
+
+ "create or replace procedure imp_res_get_4_proc as
+ c1 sys_refcursor;
+ begin
+ open c1 for select * from imp_res_get_4_tab_1 order by 1;
+ dbms_sql.return_result(c1);
+
+ open c1 for select * from imp_res_get_4_tab_2 order by 1;
+ dbms_sql.return_result(c1);
+ end;"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+function print_row($row)
+{
+ if ($row === false) {
+ print "Return is false\n";
+ return;
+ }
+ foreach ($row as $item) {
+ echo " ".$item;
+ }
+ echo "\n";
+}
+
+// Run Test
+
+echo "Test 1\n";
+
+$s = oci_parse($c, "begin imp_res_get_4_proc(); end;");
+oci_execute($s);
+$s1 = oci_get_implicit_resultset($s);
+$s2 = oci_get_implicit_resultset($s);
+$row = oci_fetch_array($s1, OCI_ASSOC+OCI_RETURN_NULLS);
+print_row($row);
+$row = oci_fetch_array($s2, OCI_ASSOC+OCI_RETURN_NULLS);
+print_row($row);
+$row = oci_fetch_array($s1, OCI_ASSOC+OCI_RETURN_NULLS);
+print_row($row);
+$row = oci_fetch_array($s2, OCI_ASSOC+OCI_RETURN_NULLS);
+print_row($row);
+$row = oci_fetch_array($s1, OCI_ASSOC+OCI_RETURN_NULLS);
+print_row($row);
+$row = oci_fetch_array($s2, OCI_ASSOC+OCI_RETURN_NULLS);
+print_row($row);
+
+echo "Test 2 - too many fetches\n";
+
+$s = oci_parse($c, "begin imp_res_get_4_proc(); end;");
+oci_execute($s);
+$s1 = oci_get_implicit_resultset($s);
+$s2 = oci_get_implicit_resultset($s);
+$row = oci_fetch_array($s1, OCI_ASSOC+OCI_RETURN_NULLS);
+print_row($row);
+$row = oci_fetch_array($s2, OCI_ASSOC+OCI_RETURN_NULLS);
+print_row($row);
+$row = oci_fetch_array($s1, OCI_ASSOC+OCI_RETURN_NULLS);
+print_row($row);
+$row = oci_fetch_array($s2, OCI_ASSOC+OCI_RETURN_NULLS);
+print_row($row);
+$row = oci_fetch_array($s1, OCI_ASSOC+OCI_RETURN_NULLS);
+print_row($row);
+$row = oci_fetch_array($s2, OCI_ASSOC+OCI_RETURN_NULLS);
+print_row($row);
+$row = oci_fetch_array($s1, OCI_ASSOC+OCI_RETURN_NULLS);
+print_row($row);
+$row = oci_fetch_array($s2, OCI_ASSOC+OCI_RETURN_NULLS);
+print_row($row);
+$row = oci_fetch_array($s1, OCI_ASSOC+OCI_RETURN_NULLS);
+print_row($row);
+$row = oci_fetch_array($s2, OCI_ASSOC+OCI_RETURN_NULLS);
+print_row($row);
+
+// Clean up
+
+$stmtarray = array(
+ "drop procedure imp_res_get_4_proc",
+ "drop table imp_res_get_4_tab_1",
+ "drop table imp_res_get_4_tab_2"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1
+ 1 abcde
+ t
+ 2 fghij
+ u
+ 3 klmno
+ v
+Test 2 - too many fetches
+ 1 abcde
+ t
+ 2 fghij
+ u
+ 3 klmno
+ v
+Return is false
+Return is false
+
+Warning: oci_fetch_array(): ORA-01002: %s in %simp_res_get_4.php on line %d
+Return is false
+
+Warning: oci_fetch_array(): ORA-01002: %s in %simp_res_get_4.php on line %d
+Return is false
+===DONE===
diff --git a/ext/oci8/tests/imp_res_get_5.phpt b/ext/oci8/tests/imp_res_get_5.phpt
new file mode 100644
index 0000000000..3cfa0967a2
--- /dev/null
+++ b/ext/oci8/tests/imp_res_get_5.phpt
@@ -0,0 +1,124 @@
+--TEST--
+Oracle Database 12c Implicit Result Sets: oci_get_implicit_resultset: get from wrong statement
+--SKIPIF--
+<?php
+if (!extension_loaded('oci8')) die ("skip no oci8 extension");
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
+if (!(isset($matches[0]) && $matches[1] >= 12)) {
+ die("skip expected output only valid when using Oracle Database 12c or greater");
+}
+preg_match('/^[[:digit:]]+/', oci_client_version(), $matches);
+if (!(isset($matches[0]) && $matches[0] >= 12)) {
+ die("skip works only with Oracle 12c or greater version of Oracle client libraries");
+}
+?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+function print_row($row)
+{
+ foreach ($row as $item) {
+ echo " ".$item;
+ }
+ echo "\n";
+}
+
+$plsql =
+ "declare
+ c1 sys_refcursor;
+ begin
+ open c1 for select 1 from dual union all select 2 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 3 from dual union all select 4 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 5 from dual union all select 6 from dual;
+ dbms_sql.return_result(c1);
+ end;";
+
+// Run Test
+
+echo "Test 1\n";
+// This test effectively discards all the first IRS results
+$s = oci_parse($c, $plsql);
+oci_execute($s);
+while (($s1 = oci_get_implicit_resultset($s))) { // $s1 is never used again so its results are lost
+ while (($row = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS)) != false) { // use parent $s instead of $s1
+ print_row($row);
+ }
+}
+oci_free_statement($s);
+
+echo "\nTest 2 - fetch first IRS explicitly\n";
+$s = oci_parse($c, $plsql);
+oci_execute($s);
+$s1 = oci_get_implicit_resultset($s);
+while (($row = oci_fetch_row($s1)) != false) {
+ print_row($row);
+}
+while (($row = oci_fetch_row($s)) != false) {
+ print_row($row);
+}
+oci_free_statement($s);
+
+echo "\nTest 3 - fetch part of IRS explicitly\n";
+$s = oci_parse($c, $plsql);
+oci_execute($s);
+$s1 = oci_get_implicit_resultset($s);
+while (($row = oci_fetch_row($s1)) != false) {
+ print_row($row);
+}
+$row = oci_fetch_row($s);
+print_row($row);
+$s1 = oci_get_implicit_resultset($s);
+while (($row = oci_fetch_row($s1)) != false) {
+ print_row($row);
+}
+while (($row = oci_fetch_row($s)) != false) {
+ print_row($row);
+}
+oci_free_statement($s);
+
+echo "\nTest 4 - skip IRSs\n";
+$s = oci_parse($c, $plsql);
+oci_execute($s);
+$s1 = oci_get_implicit_resultset($s);
+$s1 = oci_get_implicit_resultset($s);
+while (($row = oci_fetch_row($s)) != false) { // parent
+ print_row($row);
+}
+oci_free_statement($s);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1
+ 3
+ 4
+ 5
+ 6
+
+Test 2 - fetch first IRS explicitly
+ 1
+ 2
+ 3
+ 4
+ 5
+ 6
+
+Test 3 - fetch part of IRS explicitly
+ 1
+ 2
+ 3
+ 5
+ 6
+ 4
+
+Test 4 - skip IRSs
+ 5
+ 6
+===DONE===
diff --git a/ext/oci8/tests/imp_res_get_all.phpt b/ext/oci8/tests/imp_res_get_all.phpt
new file mode 100644
index 0000000000..d2dcbea6c7
--- /dev/null
+++ b/ext/oci8/tests/imp_res_get_all.phpt
@@ -0,0 +1,120 @@
+--TEST--
+Oracle Database 12c Implicit Result Sets: oci_get_implicit_resultset: oci_fetch_all
+--SKIPIF--
+<?php
+if (!extension_loaded('oci8')) die ("skip no oci8 extension");
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
+if (!(isset($matches[0]) && $matches[1] >= 12)) {
+ die("skip expected output only valid when using Oracle Database 12c or greater");
+}
+preg_match('/^[[:digit:]]+/', oci_client_version(), $matches);
+if (!(isset($matches[0]) && $matches[0] >= 12)) {
+ die("skip works only with Oracle 12c or greater version of Oracle client libraries");
+}
+?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+$plsql = "declare
+ c1 sys_refcursor;
+ begin
+ open c1 for select 1 from dual union all select 2 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 3 from dual union all select 4 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 5 from dual union all select 6 from dual;
+ dbms_sql.return_result(c1);
+ end;";
+
+// Run Test
+
+echo "Test 1\n";
+$s = oci_parse($c, $plsql);
+oci_execute($s);
+
+$s1 = oci_get_implicit_resultset($s);
+oci_fetch_all($s1, $res);
+var_dump($res);
+
+$s2 = oci_get_implicit_resultset($s);
+oci_fetch_all($s2, $res);
+var_dump($res);
+
+$s3 = oci_get_implicit_resultset($s);
+oci_fetch_all($s3, $res);
+var_dump($res);
+
+echo "\nTest 2\n";
+$s = oci_parse($c, $plsql);
+oci_execute($s);
+while (($s1 = oci_get_implicit_resultset($s))) {
+ $r = oci_fetch_all($s1, $res);
+ var_dump($res);
+}
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1
+array(1) {
+ [1]=>
+ array(2) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "2"
+ }
+}
+array(1) {
+ [3]=>
+ array(2) {
+ [0]=>
+ string(1) "3"
+ [1]=>
+ string(1) "4"
+ }
+}
+array(1) {
+ [5]=>
+ array(2) {
+ [0]=>
+ string(1) "5"
+ [1]=>
+ string(1) "6"
+ }
+}
+
+Test 2
+array(1) {
+ [1]=>
+ array(2) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "2"
+ }
+}
+array(1) {
+ [3]=>
+ array(2) {
+ [0]=>
+ string(1) "3"
+ [1]=>
+ string(1) "4"
+ }
+}
+array(1) {
+ [5]=>
+ array(2) {
+ [0]=>
+ string(1) "5"
+ [1]=>
+ string(1) "6"
+ }
+}
+===DONE===
diff --git a/ext/oci8/tests/imp_res_get_cancel.phpt b/ext/oci8/tests/imp_res_get_cancel.phpt
new file mode 100644
index 0000000000..7dbcecbfe9
--- /dev/null
+++ b/ext/oci8/tests/imp_res_get_cancel.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Oracle Database 12c Implicit Result Sets: oci_get_implicit_resultset: oci_cancel
+--SKIPIF--
+<?php
+if (!extension_loaded('oci8')) die ("skip no oci8 extension");
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
+if (!(isset($matches[0]) && $matches[1] >= 12)) {
+ die("skip expected output only valid when using Oracle Database 12c or greater");
+}
+preg_match('/^[[:digit:]]+/', oci_client_version(), $matches);
+if (!(isset($matches[0]) && $matches[0] >= 12)) {
+ die("skip works only with Oracle 12c or greater version of Oracle client libraries");
+}
+?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+$plsql =
+ "declare
+ c1 sys_refcursor;
+ c2 sys_refcursor;
+ begin
+ open c1 for select 1 from dual union all select 2 from dual;
+ dbms_sql.return_result(c1);
+ open c2 for select 3 from dual;
+ dbms_sql.return_result (c2);
+ end;";
+
+// Run Test
+
+echo "Test 1\n";
+$s = oci_parse($c, $plsql);
+oci_execute($s);
+while (($s1 = oci_get_implicit_resultset($s))) {
+ while (($row = oci_fetch_array($s1, OCI_ASSOC+OCI_RETURN_NULLS)) != false) {
+ foreach ($row as $item) {
+ echo " ".$item;
+ }
+ echo "\n";
+ oci_cancel($s1);
+ }
+}
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1
+ 1
+ 3
+===DONE===
+
diff --git a/ext/oci8/tests/imp_res_get_close_1.phpt b/ext/oci8/tests/imp_res_get_close_1.phpt
new file mode 100644
index 0000000000..2edc8bf604
--- /dev/null
+++ b/ext/oci8/tests/imp_res_get_close_1.phpt
@@ -0,0 +1,68 @@
+--TEST--
+Oracle Database 12c Implicit Result Sets: oci_get_implicit_resultset: oci_free_statement #1
+--SKIPIF--
+<?php
+if (!extension_loaded('oci8')) die ("skip no oci8 extension");
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
+if (!(isset($matches[0]) && $matches[1] >= 12)) {
+ die("skip expected output only valid when using Oracle Database 12c or greater");
+}
+preg_match('/^[[:digit:]]+/', oci_client_version(), $matches);
+if (!(isset($matches[0]) && $matches[0] >= 12)) {
+ die("skip works only with Oracle 12c or greater version of Oracle client libraries");
+}
+?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$plsql =
+ "declare
+ c1 sys_refcursor;
+ begin
+ open c1 for select 1 from dual union all select 2 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 3 from dual union all select 4 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 5 from dual union all select 6 from dual;
+ dbms_sql.return_result(c1);
+ end;";
+
+// Run Test
+
+echo "Test 1\n";
+
+$s = oci_parse($c, $plsql);
+oci_execute($s);
+
+while (($s1 = oci_get_implicit_resultset($s))) {
+ while (($row = oci_fetch_array($s1, OCI_ASSOC+OCI_RETURN_NULLS)) != false) {
+ foreach ($row as $item) {
+ echo " ".$item;
+ }
+ echo "\n";
+ oci_free_statement($s1); // Free the implicit result handle
+ }
+}
+oci_free_statement($s);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1
+ 1
+
+Warning: oci_fetch_array(): %d is not a valid oci8 statement resource in %s on line %d
+ 3
+
+Warning: oci_fetch_array(): %d is not a valid oci8 statement resource in %s on line %d
+ 5
+
+Warning: oci_fetch_array(): %d is not a valid oci8 statement resource in %s on line %d
+===DONE===
diff --git a/ext/oci8/tests/imp_res_get_close_2.phpt b/ext/oci8/tests/imp_res_get_close_2.phpt
new file mode 100644
index 0000000000..b3153834ba
--- /dev/null
+++ b/ext/oci8/tests/imp_res_get_close_2.phpt
@@ -0,0 +1,64 @@
+--TEST--
+Oracle Database 12c Implicit Result Sets: oci_get_implicit_resultset: oci_free_statement #2
+--SKIPIF--
+<?php
+if (!extension_loaded('oci8')) die ("skip no oci8 extension");
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
+if (!(isset($matches[0]) && $matches[1] >= 12)) {
+ die("skip expected output only valid when using Oracle Database 12c or greater");
+}
+preg_match('/^[[:digit:]]+/', oci_client_version(), $matches);
+if (!(isset($matches[0]) && $matches[0] >= 12)) {
+ die("skip works only with Oracle 12c or greater version of Oracle client libraries");
+}
+?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$plsql =
+ "declare
+ c1 sys_refcursor;
+ begin
+ open c1 for select 1 from dual union all select 2 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 3 from dual union all select 4 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 5 from dual union all select 6 from dual;
+ dbms_sql.return_result(c1);
+ end;";
+
+// Run Test
+
+echo "Test 1\n";
+
+$s = oci_parse($c, $plsql);
+oci_execute($s);
+
+while (($s1 = oci_get_implicit_resultset($s))) {
+ while (($row = oci_fetch_array($s1, OCI_ASSOC+OCI_RETURN_NULLS)) != false) {
+ foreach ($row as $item) {
+ echo " ".$item;
+ }
+ echo "\n";
+ oci_free_statement($s); // close parent
+ }
+}
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1
+ 1
+ 2
+
+Warning: oci_fetch_array(): OCI_INVALID_HANDLE in %s on line %d
+
+Warning: oci_get_implicit_resultset(): %d is not a valid oci8 statement resource in %s on line %d
+===DONE===
diff --git a/ext/oci8/tests/imp_res_get_close_3.phpt b/ext/oci8/tests/imp_res_get_close_3.phpt
new file mode 100644
index 0000000000..4793a6c882
--- /dev/null
+++ b/ext/oci8/tests/imp_res_get_close_3.phpt
@@ -0,0 +1,65 @@
+--TEST--
+Oracle Database 12c Implicit Result Sets: oci_get_implicit_resultset: oci_free_statement #3
+--SKIPIF--
+<?php
+if (!extension_loaded('oci8')) die ("skip no oci8 extension");
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
+if (!(isset($matches[0]) && $matches[1] >= 12)) {
+ die("skip expected output only valid when using Oracle Database 12c or greater");
+}
+preg_match('/^[[:digit:]]+/', oci_client_version(), $matches);
+if (!(isset($matches[0]) && $matches[0] >= 12)) {
+ die("skip works only with Oracle 12c or greater version of Oracle client libraries");
+}
+?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$plsql =
+ "declare
+ c1 sys_refcursor;
+ begin
+ open c1 for select 1 from dual union all select 2 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 3 from dual union all select 4 from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select 5 from dual union all select 6 from dual;
+ dbms_sql.return_result(c1);
+ end;";
+
+// Run Test
+
+echo "Test 1\n";
+
+$s = oci_parse($c, $plsql);
+oci_execute($s);
+
+while (($s1 = oci_get_implicit_resultset($s))) {
+ while (($row = oci_fetch_array($s1, OCI_ASSOC+OCI_RETURN_NULLS)) != false) {
+ foreach ($row as $item) {
+ echo " ".$item;
+ }
+ echo "\n";
+ }
+ oci_free_statement($s1);
+}
+oci_free_statement($s);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1
+ 1
+ 2
+ 3
+ 4
+ 5
+ 6
+===DONE===
diff --git a/ext/oci8/tests/imp_res_get_cursor.phpt b/ext/oci8/tests/imp_res_get_cursor.phpt
new file mode 100644
index 0000000000..ccdb6f5490
--- /dev/null
+++ b/ext/oci8/tests/imp_res_get_cursor.phpt
@@ -0,0 +1,101 @@
+--TEST--
+Oracle Database 12c Implicit Result Sets: oci_get_implicit_resultset: nested cursor
+--SKIPIF--
+<?php
+if (!extension_loaded('oci8')) die ("skip no oci8 extension");
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
+if (!(isset($matches[0]) && $matches[1] >= 12)) {
+ die("skip expected output only valid when using Oracle Database 12c or greater");
+}
+preg_match('/^[[:digit:]]+/', oci_client_version(), $matches);
+if (!(isset($matches[0]) && $matches[0] >= 12)) {
+ die("skip works only with Oracle 12c or greater version of Oracle client libraries");
+}
+?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+ "drop table imp_res_get_cursor_tab_1",
+ "create table imp_res_get_cursor_tab_1 (c1 number, c2 varchar2(10))",
+ "insert into imp_res_get_cursor_tab_1 values (1, 'abcde')",
+ "insert into imp_res_get_cursor_tab_1 values (2, 'fghij')",
+ "insert into imp_res_get_cursor_tab_1 values (3, 'klmno')",
+
+ "drop table imp_res_get_cursor_tab_2",
+ "create table imp_res_get_cursor_tab_2 (c3 varchar2(1))",
+ "insert into imp_res_get_cursor_tab_2 values ('t')",
+ "insert into imp_res_get_cursor_tab_2 values ('u')",
+ "insert into imp_res_get_cursor_tab_2 values ('v')",
+
+ "create or replace procedure imp_res_get_cursor_proc as
+ c1 sys_refcursor;
+ begin
+ open c1 for select cursor(select c1, c2 from imp_res_get_cursor_tab_1 order by 1) as curs from dual;
+ dbms_sql.return_result(c1);
+
+ open c1 for select * from imp_res_get_cursor_tab_2 where rownum < 3 order by 1;
+ dbms_sql.return_result(c1);
+
+ open c1 for select * from dual;
+ dbms_sql.return_result (c1);
+ end;"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+function do_fetch($s)
+{
+ while (($row = oci_fetch_assoc($s)) != false) {
+ foreach ($row as $item) {
+ if (is_resource($item)) { // Nested cursor
+ oci_execute($item);
+ do_fetch($item);
+ } else {
+ echo " ".$item;
+ }
+ }
+ echo "\n";
+ }
+}
+
+// Run Test
+
+echo "Test 1\n";
+
+$s = oci_parse($c, "begin imp_res_get_cursor_proc(); end;");
+oci_execute($s);
+
+while (($s1 = oci_get_implicit_resultset($s))) {
+ do_fetch($s1);
+}
+
+// Clean up
+
+$stmtarray = array(
+ "drop procedure imp_res_get_cursor_proc",
+ "drop table imp_res_get_cursor_tab_1",
+ "drop table imp_res_get_cursor_tab_2"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1
+ 1 abcde
+ 2 fghij
+ 3 klmno
+
+ t
+ u
+ X
+===DONE===
diff --git a/ext/oci8/tests/imp_res_get_dbmsoutput.phpt b/ext/oci8/tests/imp_res_get_dbmsoutput.phpt
new file mode 100644
index 0000000000..cbc2389e46
--- /dev/null
+++ b/ext/oci8/tests/imp_res_get_dbmsoutput.phpt
@@ -0,0 +1,156 @@
+--TEST--
+Oracle Database 12c Implicit Result Sets: oci_get_implicit_resultset: interleaved with DBMS_OUTPUT
+--SKIPIF--
+<?php
+if (!extension_loaded('oci8')) die ("skip no oci8 extension");
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
+if (!(isset($matches[0]) && $matches[1] >= 12)) {
+ die("skip expected output only valid when using Oracle Database 12c or greater");
+}
+preg_match('/^[[:digit:]]+/', oci_client_version(), $matches);
+if (!(isset($matches[0]) && $matches[0] >= 12)) {
+ die("skip works only with Oracle 12c or greater version of Oracle client libraries");
+}
+?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+ "drop table imp_res_get_dbmsoutput_tab_1",
+ "create table imp_res_get_dbmsoutput_tab_1 (c1 number, c2 varchar2(10))",
+ "insert into imp_res_get_dbmsoutput_tab_1 values (1, 'abcde')",
+ "insert into imp_res_get_dbmsoutput_tab_1 values (2, 'fghij')",
+ "insert into imp_res_get_dbmsoutput_tab_1 values (3, 'klmno')",
+
+ "drop table imp_res_get_dbmsoutput_tab_2",
+ "create table imp_res_get_dbmsoutput_tab_2 (c3 varchar2(1))",
+ "insert into imp_res_get_dbmsoutput_tab_2 values ('t')",
+ "insert into imp_res_get_dbmsoutput_tab_2 values ('u')",
+ "insert into imp_res_get_dbmsoutput_tab_2 values ('v')",
+
+ "create or replace procedure imp_res_get_dbmsoutput_proc as
+ c1 sys_refcursor;
+ begin
+ dbms_output.put_line('Line 1');
+ open c1 for select * from imp_res_get_dbmsoutput_tab_1 order by 1;
+ dbms_sql.return_result(c1);
+ dbms_output.put_line('Line 2');
+ open c1 for select * from imp_res_get_dbmsoutput_tab_2 order by 1;
+ dbms_sql.return_result(c1);
+ dbms_output.put_line('Line 3');
+ open c1 for select * from dual;
+ dbms_sql.return_result (c1);
+ end;"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+// Turn DBMS_OUTPUT on
+function setserveroutputon($c)
+{
+ $s = oci_parse($c, "begin dbms_output.enable(null); end;");
+ oci_execute($s);
+}
+
+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;
+}
+
+setserveroutputon($c);
+
+// Run Test
+
+echo "Test 1\n";
+
+$s = oci_parse($c, "begin imp_res_get_dbmsoutput_proc(); end;");
+oci_execute($s);
+
+var_dump(getdbmsoutput_do($c));
+
+while (($s1 = oci_get_implicit_resultset($s))) {
+ while (($row = oci_fetch_array($s1, OCI_ASSOC+OCI_RETURN_NULLS)) != false) {
+ foreach ($row as $item) {
+ echo " ".$item;
+ }
+ echo "\n";
+ }
+}
+
+echo "Test 2\n";
+
+$s = oci_parse($c, "begin imp_res_get_dbmsoutput_proc(); end;");
+oci_execute($s);
+
+while (($s1 = oci_get_implicit_resultset($s))) {
+ while (($row = oci_fetch_array($s1, OCI_ASSOC+OCI_RETURN_NULLS)) != false) {
+ foreach ($row as $item) {
+ echo " ".$item;
+ }
+ echo "\n";
+ }
+}
+
+var_dump(getdbmsoutput_do($c));
+
+// Clean up
+
+$stmtarray = array(
+ "drop procedure imp_res_get_dbmsoutput_proc",
+ "drop table imp_res_get_dbmsoutput_tab_1",
+ "drop table imp_res_get_dbmsoutput_tab_2"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1
+array(3) {
+ [0]=>
+ string(6) "Line 1"
+ [1]=>
+ string(6) "Line 2"
+ [2]=>
+ string(6) "Line 3"
+}
+ 1 abcde
+ 2 fghij
+ 3 klmno
+ t
+ u
+ v
+ X
+Test 2
+ 1 abcde
+ 2 fghij
+ 3 klmno
+ t
+ u
+ v
+ X
+array(3) {
+ [0]=>
+ string(6) "Line 1"
+ [1]=>
+ string(6) "Line 2"
+ [2]=>
+ string(6) "Line 3"
+}
+===DONE===
+
diff --git a/ext/oci8/tests/imp_res_get_exec.phpt b/ext/oci8/tests/imp_res_get_exec.phpt
new file mode 100644
index 0000000000..dbd8f3ef3a
--- /dev/null
+++ b/ext/oci8/tests/imp_res_get_exec.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Oracle Database 12c Implicit Result Sets: oci_get_implicit_resultset: Execute twice
+--SKIPIF--
+<?php
+if (!extension_loaded('oci8')) die ("skip no oci8 extension");
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
+if (!(isset($matches[0]) && $matches[1] >= 12)) {
+ die("skip expected output only valid when using Oracle Database 12c or greater");
+}
+preg_match('/^[[:digit:]]+/', oci_client_version(), $matches);
+if (!(isset($matches[0]) && $matches[0] >= 12)) {
+ die("skip works only with Oracle 12c or greater version of Oracle client libraries");
+}
+?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+$plsql = "declare
+ c1 sys_refcursor;
+ begin
+ open c1 for select 1 from dual union all select 2 from dual;
+ dbms_sql.return_result(c1);
+ end;";
+
+// Run Test
+
+echo "Test 1\n";
+
+$s = oci_parse($c, $plsql);
+oci_execute($s);
+
+$s1 = oci_get_implicit_resultset($s);
+oci_execute($s1);
+oci_execute($s1); // execute twice; should be NOP
+while (($row = oci_fetch_array($s1, OCI_ASSOC+OCI_RETURN_NULLS)) != false) {
+ foreach ($row as $item) {
+ echo " ".$item;
+ }
+ echo "\n";
+}
+oci_free_statement($s);
+
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1
+ 1
+ 2
+===DONE===
diff --git a/ext/oci8/tests/imp_res_get_none.phpt b/ext/oci8/tests/imp_res_get_none.phpt
new file mode 100644
index 0000000000..981f4945e2
--- /dev/null
+++ b/ext/oci8/tests/imp_res_get_none.phpt
@@ -0,0 +1,46 @@
+--TEST--
+Oracle Database 12c Implicit Result Sets: oci_get_implicit_resultset: no implicit results
+--SKIPIF--
+<?php
+if (!extension_loaded('oci8')) die ("skip no oci8 extension");
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
+if (!(isset($matches[0]) && $matches[1] >= 12)) {
+ die("skip expected output only valid when using Oracle Database 12c or greater");
+}
+preg_match('/^[[:digit:]]+/', oci_client_version(), $matches);
+if (!(isset($matches[0]) && $matches[0] >= 12)) {
+ die("skip works only with Oracle 12c or greater version of Oracle client libraries");
+}
+?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Run Test
+
+echo "Test 1\n";
+
+$s = oci_parse($c, "select * from dual");
+oci_execute($s);
+
+while (($s1 = oci_get_implicit_resultset($s))) {
+ while (($row = oci_fetch_array($s1, OCI_ASSOC+OCI_RETURN_NULLS)) != false) {
+ foreach ($row as $item) {
+ echo " ".$item;
+ }
+ echo "\n";
+ }
+}
+
+var_dump($s1);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1
+bool(false)
+===DONE===
diff --git a/ext/oci8/tests/imp_res_insert.phpt b/ext/oci8/tests/imp_res_insert.phpt
new file mode 100644
index 0000000000..d9c0705b55
--- /dev/null
+++ b/ext/oci8/tests/imp_res_insert.phpt
@@ -0,0 +1,152 @@
+--TEST--
+Oracle Database 12c Implicit Result Sets: Commit modes
+--SKIPIF--
+<?php
+if (!extension_loaded('oci8')) die ("skip no oci8 extension");
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
+if (!(isset($matches[0]) && $matches[1] >= 12)) {
+ die("skip expected output only valid when using Oracle Database 12c or greater");
+}
+preg_match('/^[[:digit:]]+/', oci_client_version(), $matches);
+if (!(isset($matches[0]) && $matches[0] >= 12)) {
+ die("skip works only with Oracle 12c or greater version of Oracle client libraries");
+}
+?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$c2 = oci_new_connect($user, $password, $dbase);
+
+$stmtarray = array(
+ "drop table imp_res_insert_tab",
+ "create table imp_res_insert_tab (c1 number)",
+
+ "create or replace procedure imp_res_insert_proc_nc (p1 in number) as
+ c1 sys_refcursor;
+ begin
+ execute immediate 'insert into imp_res_insert_tab values ('||p1||')';
+ open c1 for select * from imp_res_insert_tab order by 1;
+ dbms_sql.return_result(c1);
+ end;",
+
+ "create or replace procedure imp_res_insert_proc_c (p1 in number) as
+ c1 sys_refcursor;
+ begin
+ execute immediate 'insert into imp_res_insert_tab values ('||p1||')';
+ commit;
+ open c1 for select * from imp_res_insert_tab order by 1;
+ dbms_sql.return_result(c1);
+ end;"
+
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+// Run Test
+
+echo "Test 1 - No commit in procedure, OCI_COMMIT_ON_SUCCESS mode\n";
+$s = oci_parse($c, "begin imp_res_insert_proc_nc(111); end;");
+oci_execute($s, OCI_COMMIT_ON_SUCCESS);
+while (($row = oci_fetch_row($s)) !== false)
+ echo $row[0], "\n";
+$s2 = oci_parse($c2, "select * from imp_res_insert_tab order by 1");
+oci_execute($s2, OCI_NO_AUTO_COMMIT);
+oci_fetch_all($s2, $res);
+var_dump($res['C1']);
+
+echo "\nTest 2 - No commit in procedure, OCI_NO_AUTO_COMMIT mode\n";
+$s = oci_parse($c, "begin imp_res_insert_proc_nc(222); end;");
+oci_execute($s, OCI_NO_AUTO_COMMIT);
+while (($row = oci_fetch_row($s)) !== false)
+ echo $row[0], "\n";
+// The 2nd connection won't see the newly inserted data
+$s2 = oci_parse($c2, "select * from imp_res_insert_tab order by 1");
+oci_execute($s2, OCI_NO_AUTO_COMMIT);
+oci_fetch_all($s2, $res);
+var_dump($res['C1']);
+
+echo "\nTest 3 - Commit in procedure, OCI_COMMIT_ON_SUCCESS mode\n";
+$s = oci_parse($c, "begin imp_res_insert_proc_c(333); end;");
+oci_execute($s, OCI_COMMIT_ON_SUCCESS);
+// The 2nd connection will now see the previously uncommitted data inserted in the previous test
+while (($row = oci_fetch_row($s)) !== false)
+ echo $row[0], "\n";
+$s2 = oci_parse($c2, "select * from imp_res_insert_tab order by 1");
+oci_execute($s2, OCI_NO_AUTO_COMMIT);
+oci_fetch_all($s2, $res);
+var_dump($res['C1']);
+
+echo "\nTest 4 - Commit in procedure, OCI_NO_AUTO_COMMIT mode\n";
+$s = oci_parse($c, "begin imp_res_insert_proc_c(444); end;");
+oci_execute($s, OCI_NO_AUTO_COMMIT);
+while (($row = oci_fetch_row($s)) !== false)
+ echo $row[0], "\n";
+$s2 = oci_parse($c2, "select * from imp_res_insert_tab order by 1");
+oci_execute($s2, OCI_NO_AUTO_COMMIT);
+oci_fetch_all($s2, $res);
+var_dump($res['C1']);
+
+// Clean up
+
+$stmtarray = array(
+ "drop procedure imp_res_insert_proc_nc",
+ "drop procedure imp_res_insert_proc_c",
+ "drop table imp_res_insert_tab",
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1 - No commit in procedure, OCI_COMMIT_ON_SUCCESS mode
+111
+array(1) {
+ [0]=>
+ string(3) "111"
+}
+
+Test 2 - No commit in procedure, OCI_NO_AUTO_COMMIT mode
+111
+222
+array(1) {
+ [0]=>
+ string(3) "111"
+}
+
+Test 3 - Commit in procedure, OCI_COMMIT_ON_SUCCESS mode
+111
+222
+333
+array(3) {
+ [0]=>
+ string(3) "111"
+ [1]=>
+ string(3) "222"
+ [2]=>
+ string(3) "333"
+}
+
+Test 4 - Commit in procedure, OCI_NO_AUTO_COMMIT mode
+111
+222
+333
+444
+array(4) {
+ [0]=>
+ string(3) "111"
+ [1]=>
+ string(3) "222"
+ [2]=>
+ string(3) "333"
+ [3]=>
+ string(3) "444"
+}
+===DONE===
diff --git a/ext/oci8/tests/imp_res_lob.phpt b/ext/oci8/tests/imp_res_lob.phpt
new file mode 100644
index 0000000000..247803581d
--- /dev/null
+++ b/ext/oci8/tests/imp_res_lob.phpt
@@ -0,0 +1,101 @@
+--TEST--
+Oracle Database 12c Implicit Result Sets: LOBs
+--SKIPIF--
+<?php
+if (!extension_loaded('oci8')) die ("skip no oci8 extension");
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
+if (!(isset($matches[0]) && $matches[1] >= 12)) {
+ die("skip expected output only valid when using Oracle Database 12c or greater");
+}
+preg_match('/^[[:digit:]]+/', oci_client_version(), $matches);
+if (!(isset($matches[0]) && $matches[0] >= 12)) {
+ die("skip works only with Oracle 12c or greater version of Oracle client libraries");
+}
+?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+ "drop table imp_res_lob_tab",
+ "create table imp_res_lob_tab (c1 number, c2 clob, c3 varchar2(10))",
+ "insert into imp_res_lob_tab values (1, 'aaaaa', 'a')",
+ "insert into imp_res_lob_tab values (2, 'bbbbb', 'b')",
+ "insert into imp_res_lob_tab values (3, 'ccccc', 'c')",
+ "insert into imp_res_lob_tab values (4, 'ddddd', 'd')",
+
+ "create or replace procedure imp_res_lob_proc as
+ c1 sys_refcursor;
+ begin
+ open c1 for select * from imp_res_lob_tab order by 1;
+ dbms_sql.return_result(c1);
+ open c1 for select * from dual;
+ dbms_sql.return_result(c1);
+ open c1 for select c2 from imp_res_lob_tab order by c1;
+ dbms_sql.return_result(c1);
+ end;"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+// Run Test
+
+echo "Test 1\n";
+$s = oci_parse($c, "begin imp_res_lob_proc(); end;");
+oci_execute($s);
+while (($row = oci_fetch_row($s)) != false) {
+ foreach ($row as $item) {
+ if (is_object($item)) {
+ echo " " . $item->load();
+ } else {
+ echo " " . $item;
+ }
+ }
+ echo "\n";
+}
+
+echo "\nTest 2 - don't fetch all rows\n";
+$s = oci_parse($c, "begin imp_res_lob_proc(); end;");
+oci_execute($s);
+$row = oci_fetch_row($s);
+foreach ($row as $item) {
+ if (is_object($item)) {
+ echo " " . $item->load();
+ } else {
+ echo " " . $item;
+ }
+}
+echo "\n";
+
+// Clean up
+
+$stmtarray = array(
+ "drop procedure imp_res_lob_proc",
+ "drop table imp_res_lob_tab",
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1
+ 1 aaaaa a
+ 2 bbbbb b
+ 3 ccccc c
+ 4 ddddd d
+ X
+ aaaaa
+ bbbbb
+ ccccc
+ ddddd
+
+Test 2 - don't fetch all rows
+ 1 aaaaa a
+===DONE===
diff --git a/ext/oci8/tests/imp_res_prefetch.phpt b/ext/oci8/tests/imp_res_prefetch.phpt
new file mode 100644
index 0000000000..5acdd518e5
--- /dev/null
+++ b/ext/oci8/tests/imp_res_prefetch.phpt
@@ -0,0 +1,185 @@
+--TEST--
+Oracle Database 12c Implicit Result Sets: basic test
+--SKIPIF--
+<?php
+if (!extension_loaded('oci8')) die ("skip no oci8 extension");
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
+if (!(isset($matches[0]) && $matches[1] >= 12)) {
+ die("skip expected output only valid when using Oracle Database 12c or greater");
+}
+preg_match('/^[[:digit:]]+/', oci_client_version(), $matches);
+if (!(isset($matches[0]) && $matches[0] >= 12)) {
+ die("skip works only with Oracle 12c or greater version of Oracle client libraries");
+}
+?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+ "drop table imp_res_prefetch_tab_1",
+ "create table imp_res_prefetch_tab_1 (c1 number, c2 varchar2(10))",
+ "insert into imp_res_prefetch_tab_1 values (1, 'abcde')",
+ "insert into imp_res_prefetch_tab_1 values (2, 'fghij')",
+ "insert into imp_res_prefetch_tab_1 values (3, 'klmno')",
+
+ "drop table imp_res_prefetch_tab_2",
+ "create table imp_res_prefetch_tab_2 (c3 varchar2(1))",
+ "insert into imp_res_prefetch_tab_2 values ('t')",
+ "insert into imp_res_prefetch_tab_2 values ('u')",
+ "insert into imp_res_prefetch_tab_2 values ('v')",
+
+ "create or replace procedure imp_res_prefetch_proc as
+ c1 sys_refcursor;
+ begin
+ open c1 for select * from imp_res_prefetch_tab_1 order by 1;
+ dbms_sql.return_result(c1);
+
+ open c1 for select * from imp_res_prefetch_tab_2 order by 1;
+ dbms_sql.return_result(c1);
+ end;"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+// Run Test
+
+echo "Test 1 - prefetch 0\n";
+$s = oci_parse($c, "begin imp_res_prefetch_proc(); end;");
+oci_execute($s);
+var_dump(oci_set_prefetch($s, 0));
+while (($row = oci_fetch_row($s)) != false)
+ var_dump($row);
+
+echo "\nTest 1 - prefetch 1\n";
+$s = oci_parse($c, "begin imp_res_prefetch_proc(); end;");
+oci_execute($s);
+var_dump(oci_set_prefetch($s, 1));
+while (($row = oci_fetch_row($s)) != false)
+ var_dump($row);
+
+echo "\nTest 1 - prefetch 2\n";
+$s = oci_parse($c, "begin imp_res_prefetch_proc(); end;");
+oci_execute($s);
+var_dump(oci_set_prefetch($s, 2));
+while (($row = oci_fetch_row($s)) != false)
+ var_dump($row);
+
+// Clean up
+
+$stmtarray = array(
+ "drop procedure imp_res_prefetch_proc",
+ "drop table imp_res_prefetch_tab_1",
+ "drop table imp_res_prefetch_tab_2"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1 - prefetch 0
+bool(true)
+array(2) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(5) "abcde"
+}
+array(2) {
+ [0]=>
+ string(1) "2"
+ [1]=>
+ string(5) "fghij"
+}
+array(2) {
+ [0]=>
+ string(1) "3"
+ [1]=>
+ string(5) "klmno"
+}
+array(1) {
+ [0]=>
+ string(1) "t"
+}
+array(1) {
+ [0]=>
+ string(1) "u"
+}
+array(1) {
+ [0]=>
+ string(1) "v"
+}
+
+Test 1 - prefetch 1
+bool(true)
+array(2) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(5) "abcde"
+}
+array(2) {
+ [0]=>
+ string(1) "2"
+ [1]=>
+ string(5) "fghij"
+}
+array(2) {
+ [0]=>
+ string(1) "3"
+ [1]=>
+ string(5) "klmno"
+}
+array(1) {
+ [0]=>
+ string(1) "t"
+}
+array(1) {
+ [0]=>
+ string(1) "u"
+}
+array(1) {
+ [0]=>
+ string(1) "v"
+}
+
+Test 1 - prefetch 2
+bool(true)
+array(2) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(5) "abcde"
+}
+array(2) {
+ [0]=>
+ string(1) "2"
+ [1]=>
+ string(5) "fghij"
+}
+array(2) {
+ [0]=>
+ string(1) "3"
+ [1]=>
+ string(5) "klmno"
+}
+array(1) {
+ [0]=>
+ string(1) "t"
+}
+array(1) {
+ [0]=>
+ string(1) "u"
+}
+array(1) {
+ [0]=>
+ string(1) "v"
+}
+===DONE===
diff --git a/ext/oci8/tests/lob_015.phpt b/ext/oci8/tests/lob_015.phpt
index b4a19684a3..59e8fec42a 100644
--- a/ext/oci8/tests/lob_015.phpt
+++ b/ext/oci8/tests/lob_015.phpt
@@ -48,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: %s NUMBER %s BLOB in %s on line %d
+Warning: oci_execute(): ORA-00932: %s on line %d
object(OCI-Lob)#%d (1) {
["descriptor"]=>
resource(%d) of type (oci8 descriptor)
diff --git a/ext/oci8/tests/lob_temp2.phpt b/ext/oci8/tests/lob_temp2.phpt
new file mode 100644
index 0000000000..d774b4d724
--- /dev/null
+++ b/ext/oci8/tests/lob_temp2.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Writing temporary lob before binding
+--SKIPIF--
+<?php
+if (!extension_loaded('oci8')) die ("skip no oci8 extension");
+$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." (clob) VALUES (:v_clob)";
+
+$clob = oci_new_descriptor($c, OCI_D_LOB);
+var_dump($clob->writeTemporary("test"));
+
+$statement = oci_parse($c, $ora_sql);
+oci_bind_by_name($statement, ":v_clob", $clob, -1, OCI_B_CLOB);
+oci_execute($statement, OCI_DEFAULT);
+
+$s = oci_parse($c, "select clob from ". $schema.$table_name);
+oci_execute($s);
+oci_fetch_all($s, $res);
+var_dump($res);
+
+?>
+===DONE===
+--EXPECTF--
+bool(true)
+array(1) {
+ ["CLOB"]=>
+ array(1) {
+ [0]=>
+ string(4) "test"
+ }
+}
+===DONE===
diff --git a/ext/oci8/tests/minfo.phpt b/ext/oci8/tests/minfo.phpt
index f6b95ff296..34a19ca693 100644
--- a/ext/oci8/tests/minfo.phpt
+++ b/ext/oci8/tests/minfo.phpt
@@ -8,12 +8,12 @@ Code coverage for PHP_MINFO_FUNCTION(oci)
ob_start();
phpinfo(INFO_MODULES);
$v = ob_get_clean();
-$r = strpos($v, 'OCI8 Support => enabled');
-var_dump($r);
+$r = preg_match('/OCI8 Support .* enabled/', $v);
+if ($r !== 1)
+ var_dump($r);
echo "Done\n";
?>
--EXPECTF--
-int(%d)
Done
diff --git a/ext/oci8/tests/password.phpt b/ext/oci8/tests/password.phpt
index 1738702cb6..8ea81d3fc0 100644
--- a/ext/oci8/tests/password.phpt
+++ b/ext/oci8/tests/password.phpt
@@ -14,28 +14,28 @@ if ($test_drcp) die("skip password change not supported in DRCP Mode");
require(dirname(__FILE__)."/connect.inc");
$stmtarray = array(
- "drop user testuser cascade",
- "create user testuser identified by testuserpwd",
- "grant connect, create session to testuser"
+ "drop user testuser_pw cascade",
+ "create user testuser_pw identified by testuserpwd",
+ "grant connect, create session to testuser_pw"
);
oci8_test_sql_execute($c, $stmtarray);
// Connect and change the password
-$c1 = oci_connect("testuser", "testuserpwd", $dbase);
+$c1 = oci_connect("testuser_pw", "testuserpwd", $dbase);
var_dump($c1);
$rn1 = (int)$c1;
-oci_password_change($c1, "testuser", "testuserpwd", "testuserpwd2");
+oci_password_change($c1, "testuser_pw", "testuserpwd", "testuserpwd2");
// Second connect should return a new resource because the hash string will be different from $c1
-$c2 = oci_connect("testuser", "testuserpwd2", $dbase);
+$c2 = oci_connect("testuser_pw", "testuserpwd2", $dbase);
var_dump($c2);
$rn2 = (int)$c2;
// Despite using the old password this connect should succeed and return the original resource
-$c3 = oci_connect("testuser", "testuserpwd", $dbase);
+$c3 = oci_connect("testuser_pw", "testuserpwd", $dbase);
var_dump($c3);
$rn3 = (int)$c3;
@@ -67,7 +67,7 @@ echo "Done\n";
require(dirname(__FILE__)."/connect.inc");
$stmtarray = array(
- "drop user testuser cascade"
+ "drop user testuser_pw cascade"
);
oci8_test_sql_execute($c, $stmtarray);
diff --git a/ext/oci8/tests/password_2.phpt b/ext/oci8/tests/password_2.phpt
index ceba0bba80..13da9ff7b2 100644
--- a/ext/oci8/tests/password_2.phpt
+++ b/ext/oci8/tests/password_2.phpt
@@ -14,27 +14,27 @@ if ($test_drcp) die("skip password change not supported in DRCP Mode");
require(dirname(__FILE__)."/connect.inc");
$stmtarray = array(
- "drop user testuser cascade",
- "create user testuser identified by testuserpwd",
- "grant connect, create session to testuser"
+ "drop user testuser_pw2 cascade",
+ "create user testuser_pw2 identified by testuserpwd",
+ "grant connect, create session to testuser_pw2"
);
oci8_test_sql_execute($c, $stmtarray);
// Connect (persistent) and change the password
-$c1 = oci_pconnect("testuser", "testuserpwd", $dbase);
+$c1 = oci_pconnect("testuser_pw2", "testuserpwd", $dbase);
var_dump($c1);
$rn1 = (int)$c1;
-oci_password_change($c1, "testuser", "testuserpwd", "testuserpwd2");
+oci_password_change($c1, "testuser_pw2", "testuserpwd", "testuserpwd2");
// Second connect should return a new resource because the hash string will be different from $c1
-$c2 = oci_pconnect("testuser", "testuserpwd2", $dbase);
+$c2 = oci_pconnect("testuser_pw2", "testuserpwd2", $dbase);
var_dump($c2);
$rn2 = (int)$c2;
// Despite using the old password this connect should succeed and return the original resource
-$c3 = oci_pconnect("testuser", "testuserpwd", $dbase);
+$c3 = oci_pconnect("testuser_pw2", "testuserpwd", $dbase);
var_dump($c3);
$rn3 = (int)$c3;
@@ -66,7 +66,7 @@ echo "Done\n";
require(dirname(__FILE__)."/connect.inc");
$stmtarray = array(
- "drop user testuser cascade"
+ "drop user testuser_pw2 cascade"
);
oci8_test_sql_execute($c, $stmtarray);
diff --git a/ext/oci8/tests/password_new.phpt b/ext/oci8/tests/password_new.phpt
index c218d904fa..2c66dd94ab 100644
--- a/ext/oci8/tests/password_new.phpt
+++ b/ext/oci8/tests/password_new.phpt
@@ -3,15 +3,27 @@ oci_password_change()
--SKIPIF--
<?php
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on thes
-require(dirname(__FILE__).'/skipif.inc');
+require(dirname(__FILE__).'/connect.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)
-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)");
+preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches_sv);
+if (isset($matches_sv[1]) && $matches_sv[1] >= 11) {
+ preg_match('/([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)/', oci_client_version(), $matches);
+ if (isset($matches[0]) && $matches[1] == 10 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] < 5) {
+ die ("skip test known to fail using Oracle 10.2.0.4 client libs connecting to Oracle 11 (6277160)");
+ }
+}
+
+// This test in Oracle 12c needs a non-CDB or the root container
+if (isset($matches_sv[1]) && $matches_sv[1] >= 12) {
+ $s = oci_parse($c, "select nvl(sys_context('userenv', 'con_name'), 'notacdb') as dbtype from dual");
+ $r = @oci_execute($s);
+ if (!$r)
+ die('skip could not identify container type');
+ $r = oci_fetch_array($s);
+ if ($r['DBTYPE'] !== 'CDB$ROOT')
+ die('skip cannot run test using a PDB');
}
?>
--FILE--
diff --git a/ext/oci8/tests/password_old.phpt b/ext/oci8/tests/password_old.phpt
index fdbb1f9e89..2e186528e3 100644
--- a/ext/oci8/tests/password_old.phpt
+++ b/ext/oci8/tests/password_old.phpt
@@ -3,18 +3,28 @@ ocipasswordchange()
--SKIPIF--
<?php
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on thes
-require(dirname(__FILE__).'/skipif.inc');
+require(dirname(__FILE__).'/connect.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)
-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)");
+preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches_sv);
+if (isset($matches_sv[1]) && $matches_sv[1] >= 11) {
+ preg_match('/([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)/', oci_client_version(), $matches);
+ if (isset($matches[0]) && $matches[1] == 10 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] < 5) {
+ die ("skip test known to fail using Oracle 10.2.0.4 client libs connecting to Oracle 11 (6277160)");
+ }
}
-
+// This test in Oracle 12c needs a non-CDB or the root container
+if (isset($matches_sv[1]) && $matches_sv[1] >= 12) {
+ $s = oci_parse($c, "select nvl(sys_context('userenv', 'con_name'), 'notacdb') as dbtype from dual");
+ $r = @oci_execute($s);
+ if (!$r)
+ die('skip could not identify container type');
+ $r = oci_fetch_array($s);
+ if ($r['DBTYPE'] !== 'CDB$ROOT')
+ die('skip cannot run test using a PDB');
+}
?>
--FILE--
<?php
diff --git a/ext/oci8/tests/refcur_prefetch_3.phpt b/ext/oci8/tests/refcur_prefetch_3.phpt
index 8c0414042b..974864cbd9 100644
--- a/ext/oci8/tests/refcur_prefetch_3.phpt
+++ b/ext/oci8/tests/refcur_prefetch_3.phpt
@@ -86,52 +86,52 @@ Test with Nested Cursors
Fetch Row using Nested cursor Query
array(1) {
[0]=>
- %unicode|string%(%d) "test0"
+ string(%d) "test0"
}
Fetch Row using Nested cursor Query
array(1) {
[0]=>
- %unicode|string%(%d) "test1"
+ string(%d) "test1"
}
Fetch Row using Nested cursor Query
array(1) {
[0]=>
- %unicode|string%(%d) "test2"
+ string(%d) "test2"
}
Fetch Row using Nested cursor Query
array(1) {
[0]=>
- %unicode|string%(%d) "test3"
+ string(%d) "test3"
}
Fetch Row using Nested cursor Query
array(1) {
[0]=>
- %unicode|string%(%d) "test4"
+ string(%d) "test4"
}
Fetch Row using Nested cursor Query
array(1) {
[0]=>
- %unicode|string%(%d) "test5"
+ string(%d) "test5"
}
Fetch Row using Nested cursor Query
array(1) {
[0]=>
- %unicode|string%(%d) "test6"
+ string(%d) "test6"
}
Fetch Row using Nested cursor Query
array(1) {
[0]=>
- %unicode|string%(%d) "test7"
+ string(%d) "test7"
}
Fetch Row using Nested cursor Query
array(1) {
[0]=>
- %unicode|string%(%d) "test8"
+ string(%d) "test8"
}
Fetch Row using Nested cursor Query
array(1) {
[0]=>
- %unicode|string%(%d) "test9"
+ string(%d) "test9"
}
Number of roundtrips made with prefetch count 5 for 10 rows is 3
Done
diff --git a/ext/oci8/tests/reflection1.phpt b/ext/oci8/tests/reflection1.phpt
index 5f2e73d80b..f76d7261aa 100644
--- a/ext/oci8/tests/reflection1.phpt
+++ b/ext/oci8/tests/reflection1.phpt
@@ -126,6 +126,7 @@ reflection::export(new reflectionfunction('oci_set_module_name'));
reflection::export(new reflectionfunction('oci_set_action'));
reflection::export(new reflectionfunction('oci_set_client_info'));
reflection::export(new reflectionfunction('oci_set_client_identifier'));
+reflection::export(new reflectionfunction('oci_get_implicit_resultset'));
?>
===DONE===
@@ -1093,4 +1094,11 @@ Function [ <internal%s> function oci_set_client_identifier ] {
}
}
+Function [ <internal%s> function oci_get_implicit_resultset ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> $statement_resource ]
+ }
+}
+
===DONE===