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
AC_MSG_RESULT([$php_version, ok])
fi
- dnl conditionally define PHP_INIT_DTRACE.
- dnl This prevents 'configure' failing for PECL installs on older PHP versions.
- dnl Note DTrace support can't be enabled on older PHP versions.
- AC_PROVIDE_IFELSE([PHP_INIT_DTRACE], [], [AC_DEFUN([PHP_INIT_DTRACE], )])
-
- if test "$PHP_DTRACE" = "yes"; then
- if test "$oci8_php_version" -lt "5004000"; then
- AC_MSG_ERROR([You need at least PHP 5.4 to be able to use DTrace with PHP OCI8])
+ 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], [
- PHP_INIT_DTRACE([ext/oci8/oci8_dtrace.d],[ext/oci8/oci8_dtrace_gen.h],[ext/oci8/oci8.c ext/oci8/oci8_statement.c])
+ 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_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)
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)
php_info_print_table_start();
php_info_print_table_row(2, "OCI8 Support", "enabled");
+#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$");
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);
#endif
#endif
+
php_info_print_table_end();
DISPLAY_INI_ENTRIES();
OCI_G(num_persistent)--;
}
-#ifdef HAVE_DTRACE
+#ifdef HAVE_OCI8_DTRACE
if (DTRACE_OCI8_CONNECT_P_DTOR_CLOSE_ENABLED()) {
DTRACE_OCI8_CONNECT_P_DTOR_CLOSE(connection);
}
-#endif /* HAVE_DTRACE */
+#endif /* HAVE_OCI8_DTRACE */
} else {
/*
* Release the connection to underlying pool. We do this unconditionally so that
*/
php_oci_connection_release(connection TSRMLS_CC);
-#ifdef HAVE_DTRACE
+#ifdef HAVE_OCI8_DTRACE
if (DTRACE_OCI8_CONNECT_P_DTOR_RELEASE_ENABLED()) {
DTRACE_OCI8_CONNECT_P_DTOR_RELEASE(connection);
}
-#endif /* HAVE_DTRACE */
+#endif /* HAVE_OCI8_DTRACE */
}
}
/* }}} */
break;
}
-#ifdef HAVE_DTRACE
+#ifdef HAVE_OCI8_DTRACE
if (DTRACE_OCI8_ERROR_ENABLED()) {
DTRACE_OCI8_ERROR(status, errcode);
}
-#endif /* HAVE_DTRACE */
+#endif /* HAVE_OCI8_DTRACE */
return errcode;
}
return;
}
-#ifdef HAVE_DTRACE
+#ifdef HAVE_OCI8_DTRACE
if (DTRACE_OCI8_CONNECT_ENTRY_ENABLED()) {
DTRACE_OCI8_CONNECT_ENTRY(username, dbname, charset, session_mode, persistent, exclusive);
}
-#endif /* HAVE_DTRACE */
+#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_DTRACE
+#ifdef HAVE_OCI8_DTRACE
if (DTRACE_OCI8_CONNECT_RETURN_ENABLED()) {
DTRACE_OCI8_CONNECT_RETURN(connection);
}
-#endif /* HAVE_DTRACE */
+#endif /* HAVE_OCI8_DTRACE */
if (!connection) {
}
}
-#ifdef HAVE_DTRACE
+#ifdef HAVE_OCI8_DTRACE
if (DTRACE_OCI8_CONNECT_LOOKUP_ENABLED()) {
DTRACE_OCI8_CONNECT_LOOKUP(connection, connection && connection->is_stub ? 1 : 0);
}
-#endif /* HAVE_DTRACE */
+#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
OCI_G(num_links)++;
}
-#ifdef HAVE_DTRACE
+#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_DTRACE */
+#endif /* HAVE_OCI8_DTRACE */
return connection;
}
connection = (php_oci_connection *)le->ptr;
if (!connection->used_this_request && OCI_G(persistent_timeout) != -1) {
-#ifdef HAVE_DTRACE
+#ifdef HAVE_OCI8_DTRACE
if (DTRACE_OCI8_CONNECT_EXPIRY_ENABLED()) {
DTRACE_OCI8_CONNECT_EXPIRY(connection, connection->is_stub ? 1 : 0, connection->idle_expiry, timestamp);
}
-#endif /* HAVE_DTRACE */
+#endif /* HAVE_OCI8_DTRACE */
if (connection->idle_expiry < timestamp) {
/* connection has timed out */
return ZEND_HASH_APPLY_REMOVE;
PHP_OCI_CALL(OCIHandleFree, ((dvoid *) spoolAuth, (ub4) OCI_HTYPE_AUTHINFO));
}
-#ifdef HAVE_DTRACE
+#ifdef HAVE_OCI8_DTRACE
if (DTRACE_OCI8_SESSPOOL_CREATE_ENABLED()) {
DTRACE_OCI8_SESSPOOL_CREATE(session_pool);
}
-#endif /* HAVE_DTRACE */
+#endif /* HAVE_OCI8_DTRACE */
return session_pool;
}
connection->using_spool = 1;
}
-#ifdef HAVE_DTRACE
+#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_DTRACE */
+#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
/* }}} */
/* {{{ Debug statements */
-#ifdef HAVE_DTRACE
+#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)));
numfree = numopen - numbusy; /* number of free connections in the pool */
DTRACE_OCI8_SESSPOOL_STATS(numfree, numbusy, numopen);
}
-#endif /* HAVE_DTRACE */
+#endif /* HAVE_OCI8_DTRACE */
/* }}} */
/* Ping loop: Ping and loop till we get a good connection. When a database instance goes
*/
void php_oci_dtrace_check_connection(php_oci_connection *connection, sword errcode, ub4 serverStatus)
{
-#ifdef HAVE_DTRACE
+#ifdef HAVE_OCI8_DTRACE
if (DTRACE_OCI8_CHECK_CONNECTION_ENABLED()) {
DTRACE_OCI8_CHECK_CONNECTION(connection, connection && connection->is_open ? 1 : 0, (int)errcode, (unsigned long)serverStatus);
}
-#endif /* HAVE_DTRACE */
+#endif /* HAVE_OCI8_DTRACE */
}
/* }}} */
/* 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_DTRACE
+#ifdef HAVE_OCI8_DTRACE
if (DTRACE_OCI8_SQLTEXT_ENABLED()) {
DTRACE_OCI8_SQLTEXT(query);
}
-#endif /* HAVE_DTRACE */
+#endif /* HAVE_OCI8_DTRACE */
}
PHP_OCI_CALL(OCIHandleAlloc, (connection->env, (dvoid **)&(statement->err), OCI_HTYPE_ERROR, 0, NULL));
case OCI_DESCRIBE_ONLY:
case OCI_DEFAULT:
/* only these are allowed */
-#ifdef HAVE_DTRACE
+#ifdef HAVE_OCI8_DTRACE
if (DTRACE_OCI8_EXECUTE_MODE_ENABLED()) {
DTRACE_OCI8_EXECUTE_MODE(mode);
}
-#endif /* HAVE_DTRACE */
+#endif /* HAVE_OCI8_DTRACE */
break;
default:
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid execute mode given: %d", mode);
<active>no</active>
</lead>
- <date>2013-07-24</date>
+ <date>2013-08-30</date>
<time>12:00:00</time>
<version>
</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
+ 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>
<contents>
<dir name="/">
- 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.
+ 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.
+ 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:
# endif
# endif /* osf alpha */
-#ifdef HAVE_DTRACE
+#ifdef HAVE_OCI8_DTRACE
#include "oci8_dtrace_gen.h"
#endif