1
0
mirror of https://github.com/php/php-src.git synced 2026-04-02 13:43:02 +02:00

OCI8 2.0: add oci8-check-connection probe and do some renaming

This commit is contained in:
Christopher Jones
2013-08-27 16:41:02 -07:00
parent 72f80b2997
commit 49cd21e71c
4 changed files with 26 additions and 10 deletions

View File

@@ -154,8 +154,7 @@ if test "$PHP_OCI8" != "no"; then
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])

View File

@@ -1772,8 +1772,8 @@ void php_oci_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent, int exclus
}
#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 */
@@ -1784,8 +1784,8 @@ void php_oci_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent, int exclus
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 */
@@ -3465,6 +3465,20 @@ static sword php_oci_ping_init(php_oci_connection *connection, OCIError *errh TS
}
/* }}} */
/* {{{ 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 */
/*

View File

@@ -17,8 +17,9 @@
*/
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);
@@ -27,7 +28,7 @@ provider php {
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);

View File

@@ -310,6 +310,7 @@ typedef struct {
*/
#define PHP_OCI_HANDLE_ERROR(connection, errcode) \
do { \
ub4 serverStatus = OCI_SERVER_NORMAL; \
switch (errcode) { \
case 1013: \
zend_bailout(); \
@@ -339,7 +340,6 @@ typedef struct {
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) { \
@@ -348,6 +348,7 @@ typedef struct {
} \
break; \
} \
php_oci_dtrace_check_connection(connection, errcode, serverStatus); \
} while (0)
#define PHP_OCI_REGISTER_RESOURCE(resource, le_resource) \
@@ -411,6 +412,7 @@ 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, sword errcode, ub4 serverStatus);
/* }}} */