Commit:    49cd21e71cc6d18bbe601e5e2ae07f7c0ae143ec
Author:    Christopher Jones <s...@php.net>         Tue, 27 Aug 2013 16:41:02 
-0700
Parents:   72f80b2997920bf6fadc83ddcb3908252a9064eb
Branches:  master

Link:       
http://git.php.net/?p=php-src.git;a=commitdiff;h=49cd21e71cc6d18bbe601e5e2ae07f7c0ae143ec

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

Changed paths:
  M  ext/oci8/config.m4
  M  ext/oci8/oci8.c
  M  ext/oci8/oci8_dtrace.d
  M  ext/oci8/php_oci8_int.h


Diff:
diff --git a/ext/oci8/config.m4 b/ext/oci8/config.m4
index b76db64..2af75a2 100644
--- a/ext/oci8/config.m4
+++ b/ext/oci8/config.m4
@@ -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])
diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c
index f717caa..b30fb4b 100644
--- a/ext/oci8/oci8.c
+++ b/ext/oci8/oci8.c
@@ -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 */
 
 /*
diff --git a/ext/oci8/oci8_dtrace.d b/ext/oci8/oci8_dtrace.d
index 2773f78..15d210c 100644
--- a/ext/oci8/oci8_dtrace.d
+++ b/ext/oci8/oci8_dtrace.d
@@ -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);
diff --git a/ext/oci8/php_oci8_int.h b/ext/oci8/php_oci8_int.h
index daf649b..ac58145 100644
--- a/ext/oci8/php_oci8_int.h
+++ b/ext/oci8/php_oci8_int.h
@@ -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);
 
 /* }}} */


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to