AC_MSG_ERROR([You need at least PHP 5.4 to be able to use DTrace with PHP OCI8])
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_interface.c ext/oci8/oci8_collection.c ext/oci8/oci8_lob.c ext/oci8/oci8_statement.c])
+ PHP_INIT_DTRACE([ext/oci8/oci8_dtrace.d],[ext/oci8/oci8_dtrace_gen.h],[ext/oci8/oci8.c ext/oci8/oci8_statement.c])
], [
AC_MSG_ERROR(
[Cannot find sys/sdt.h which is required for DTrace support])
}
#ifdef HAVE_DTRACE
- if (DTRACE_OCI8_CONNECT_START_ENABLED()) {
- DTRACE_OCI8_CONNECT_START(username, dbname, charset, session_mode, persistent, exclusive);
+ if (DTRACE_OCI8_CONNECT_ENTRY_ENABLED()) {
+ DTRACE_OCI8_CONNECT_ENTRY(username, dbname, charset, session_mode, persistent, exclusive);
}
#endif /* HAVE_DTRACE */
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
- if (DTRACE_OCI8_CONNECT_DONE_ENABLED()) {
- DTRACE_OCI8_CONNECT_DONE();
+ if (DTRACE_OCI8_CONNECT_RETURN_ENABLED()) {
+ DTRACE_OCI8_CONNECT_RETURN(connection);
}
#endif /* HAVE_DTRACE */
}
/* }}} */
+/* {{{ 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, sword errcode, ub4 serverStatus)
+{
+#ifdef HAVE_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 */
/*
*/
provider php {
- probe oci8__connect__start(char *username, char *dbname, char *charset, long session_mode, int persistent, int exclusive);
- probe oci8__connect__done();
+ 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__check__connection(void *connection, int is_open, int errcode, unsigned long serverstatus);
probe oci8__sqltext(char *sql);
probe oci8__error(int status, long errcode);
probe oci8__execute__mode(unsigned int mode);
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, time_t idle_expiry, time_t timestamp);
- probe oci8__connect__type(int is_persistent, int exclusive, void *connection, long num_persistent, long num_links);
+ 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);
*/
#define PHP_OCI_HANDLE_ERROR(connection, errcode) \
do { \
+ ub4 serverStatus = OCI_SERVER_NORMAL; \
switch (errcode) { \
case 1013: \
zend_bailout(); \
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) { \
} \
break; \
} \
+ php_oci_dtrace_check_connection(connection, errcode, serverStatus); \
} while (0)
#define PHP_OCI_REGISTER_RESOURCE(resource, le_resource) \
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, sword errcode, ub4 serverStatus);
/* }}} */