]> granicus.if.org Git - php/commitdiff
More OCI8 DTrace probe updates.
authorChristopher Jones <sixd@php.net>
Fri, 27 Sep 2013 04:12:11 +0000 (21:12 -0700)
committerChristopher Jones <sixd@php.net>
Fri, 27 Sep 2013 04:12:11 +0000 (21:12 -0700)
Change php.ini-* doc to match an earlier change to config.w32

ext/oci8/config.m4
ext/oci8/oci8.c
ext/oci8/oci8_dtrace.d
ext/oci8/oci8_interface.c
ext/oci8/oci8_statement.c
ext/oci8/package.xml
ext/oci8/php_oci8.h
ext/oci8/php_oci8_int.h
php.ini-development
php.ini-production

index 49998d18f08ba885e723dc1366a1ca868f6fe3fc..3873a2205aa3644a16764c97cca641f501e8e2e4 100644 (file)
@@ -124,7 +124,7 @@ dnl in GNU Make which causes the .d file to be overwritten (Bug 61268)
 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 > \$[]@
+       CFLAGS="\$(CFLAGS_CLEAN)" dtrace -h -C -s $ac_srcdir[$]ac_provsrc -o \$[]@.bak && \$(SED) -e 's,PHPOCI_,DTRACE_,g' \$[]@.bak > \$[]@
 
 \$(OCI8_DTRACE_OBJS): $ac_bdir[$]ac_hdrobj
 
index bccaa529b0c93011c25f0d6f26a8f5c85e9a304d..f04114d4d67cffea4cdc2ed3b7f0229c2caa5016 100644 (file)
@@ -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 Sther Bakken <ssb@php.net>                            |
+   | Authors: Stig Sæther Bakken <ssb@php.net>                            |
    |          Thies C. Arntzen <thies@thieso.net>                         |
    |          Maxim Maletsky <maxim@maxim.cx>                             |
    |                                                                      |
@@ -2097,6 +2097,9 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char
                        connection = (php_oci_connection *) ecalloc(1, sizeof(php_oci_connection));
                        connection->hash_key = estrndup(hashed_details.c, hashed_details.len);
                        connection->is_persistent = 0;
+#ifdef HAVE_OCI8_DTRACE
+                       connection->client_id = NULL;
+#endif
                } else {
                        connection = (php_oci_connection *) calloc(1, sizeof(php_oci_connection));
                        if (connection == NULL) {
@@ -2108,11 +2111,17 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char
                                return NULL;
                        }
                        connection->is_persistent = 1;
+#ifdef HAVE_OCI8_DTRACE
+                       connection->client_id = NULL;
+#endif
                }
        } else {
                connection = (php_oci_connection *) ecalloc(1, sizeof(php_oci_connection));
                connection->hash_key = estrndup(hashed_details.c, hashed_details.len);
                connection->is_persistent = 0;
+#ifdef HAVE_OCI8_DTRACE
+               connection->client_id = NULL;
+#endif
        }
 
        /* {{{ Get the session pool that suits this connection request from the persistent list. This
@@ -2366,17 +2375,15 @@ static int php_oci_connection_close(php_oci_connection *connection TSRMLS_DC)
                php_oci_spool_close(connection->private_spool TSRMLS_CC);
        }
 
-       if (connection->is_persistent) {
-               if (connection->hash_key) {
-                       free(connection->hash_key);
-               }
-               free(connection);
-       } else {
-               if (connection->hash_key) {
-                       efree(connection->hash_key);
-               }
-               efree(connection);
+       if (connection->hash_key) {
+               pefree(connection->hash_key, connection->is_persistent);
+       }
+#ifdef HAVE_OCI8_DTRACE
+       if (connection->client_id) {
+               pefree(connection->client_id, connection->is_persistent);
        }
+#endif /* HAVE_OCI8_DTRACE */
+       pefree(connection, connection->is_persistent);
        connection = NULL;
        OCI_G(in_call) = in_call_save;
        return result;
@@ -2463,6 +2470,12 @@ int php_oci_connection_release(php_oci_connection *connection TSRMLS_DC)
                 * the OCI session
                 */
                connection->next_pingp = NULL;
+#ifdef HAVE_OCI8_DTRACE
+               if (connection->client_id) {
+                       pefree(connection->client_id, connection->is_persistent);
+                       connection->client_id = NULL;
+               }
+#endif /* HAVE_OCI8_DTRACE */
        }
 
        OCI_G(in_call) = in_call_save;
@@ -3500,7 +3513,7 @@ void php_oci_dtrace_check_connection(php_oci_connection *connection, sb4 errcode
 {
 #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);
+               DTRACE_OCI8_CHECK_CONNECTION(connection, connection->client_id, connection->is_open ? 1 : 0, (long)errcode, (unsigned long)serverStatus);
        }
 #endif /* HAVE_OCI8_DTRACE */
 }
index 8ac94105c13cdc5b2f12cba1ee141ac44e0af890..30c98de91282816016596c2a5b9fa854cc21155b 100644 (file)
    +----------------------------------------------------------------------+
 */
 
-provider php {
-       probe oci8__check__connection(void *connection, int is_open, long errcode, unsigned long server_status);
+provider phpoci {
+       probe oci8__check__connection(void *connection, char *client_id, 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__execute__mode(void *connection, char *client_id, void *statement, unsigned int mode);
+       probe oci8__sqltext(void *connection, char *client_id, void *statement, char *sql);
 
        probe oci8__connect__p__dtor__close(void *connection);
        probe oci8__connect__p__dtor__release(void *connection);
index 8d70aff9c2b42907408137fda63c8ce314903187..3fad90d9c7c84da3139b014042247af16fc865f4 100644 (file)
@@ -1772,6 +1772,30 @@ PHP_FUNCTION(oci_set_client_identifier)
                RETURN_FALSE;
        }
 
+#ifdef HAVE_OCI8_DTRACE
+       /* The alternatives to storing client_id like done below are
+          i) display it in a probe here in oci_set_client_identifier and
+          let the user D script correlate the connection address probe
+          argument and the client_id. This would likely require user D
+          script variables, which would use kernel memory.
+          ii) call OCIAttrGet for each probe definition that uses
+          client_id. This would be slower than storing it.
+       */
+
+       if (connection->client_id) {
+               pefree(connection->client_id, connection->is_persistent);
+       }
+
+       if (client_id) {
+               /* this long winded copy allows compatibility with older PHP versions */
+               connection->client_id = (char *)safe_emalloc(client_id_len+1, sizeof(char), connection->is_persistent);
+               memcpy(connection->client_id, client_id, client_id_len);
+               connection->client_id[client_id_len] = '\0';
+       } else {
+               connection->client_id = NULL;
+       }
+#endif /* HAVE_OCI8_DTRACE */
+
        RETURN_TRUE;
 }
 /* }}} */
@@ -1790,13 +1814,14 @@ PHP_FUNCTION(oci_set_edition)
 
        if (OCI_G(edition)) {
                efree(OCI_G(edition));
-               OCI_G(edition) = NULL;
        }
 
        if (edition) {
-               OCI_G(edition) = (char *)safe_emalloc(edition_len+1, sizeof(text), 0);
+               OCI_G(edition) = (char *)safe_emalloc(edition_len+1, sizeof(char), 0);
                memcpy(OCI_G(edition), edition, edition_len);
                OCI_G(edition)[edition_len] = '\0';
+       } else {
+               OCI_G(edition) = NULL;
        }
 
        RETURN_TRUE;
index 274c4e9e33b40b4e2227a20d7b2c52ced88cd5d5..1e66308e53ca47c46cf76eba009fa6bd83353647 100644 (file)
@@ -55,14 +55,8 @@ php_oci_statement *php_oci_statement_create(php_oci_connection *connection, char
        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) {
@@ -79,6 +73,12 @@ php_oci_statement *php_oci_statement_create(php_oci_connection *connection, char
                                 OCI_DEFAULT
                                )
                );
+#ifdef HAVE_OCI8_DTRACE
+               if (DTRACE_OCI8_SQLTEXT_ENABLED()) {
+                       DTRACE_OCI8_SQLTEXT(connection, connection->client_id, statement, query);
+               }
+#endif /* HAVE_OCI8_DTRACE */
+
                if (errstatus != OCI_SUCCESS) {
                        connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC);
 
@@ -498,7 +498,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
                        /* only these are allowed */
 #ifdef HAVE_OCI8_DTRACE
                        if (DTRACE_OCI8_EXECUTE_MODE_ENABLED()) {
-                               DTRACE_OCI8_EXECUTE_MODE(statement->connection, mode);
+                               DTRACE_OCI8_EXECUTE_MODE(statement->connection, statement->connection->client_id, statement, mode);
                        }
 #endif /* HAVE_OCI8_DTRACE */
                        break;
index fcab20cc4544bef63c1a8cb6a73fa7535dd32148..24ba635fef6dccafa3997bba83d409bba313a4cd 100644 (file)
@@ -40,12 +40,12 @@ http://pear.php.net/dtd/package-2.0.xsd">
   <active>no</active>
  </lead>
 
- <date>2013-09-06</date>
+ <date>2013-09-27</date>
  <time>12:00:00</time>
 
   <version>
-   <release>2.0.2</release>
-   <api>2.0.2</api>
+   <release>2.0.3</release>
+   <api>2.0.3</api>
   </version>
   <stability>
    <release>devel</release>
@@ -53,10 +53,9 @@ http://pear.php.net/dtd/package-2.0.xsd">
   </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.
+Add the oci_set_client_identifier() value and statement structure pointer to several DTrace probes.
+Use 'phpoci' as the DTrace provider name since uniqueness is required by the Linux fasttrap module.
+Update Windows builds to create only php_oci8_12c.dll.
   </notes>
  <contents>
   <dir name="/">
@@ -455,6 +454,24 @@ Add the connection handle to several DTrace probes.
  </extsrcrelease>
  <changelog>
 
+<release>
+  <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>
+</release>
+
 <release>
   <version>
    <release>2.0.1</release>
index 8c5fba9ab087391bc056886677329eed255344d8..6d02eff6b27af6b74f2ac478460b02183daeba07 100644 (file)
@@ -46,7 +46,7 @@
  */
 #undef PHP_OCI8_VERSION
 #endif
-#define PHP_OCI8_VERSION "2.0.2-dev"
+#define PHP_OCI8_VERSION "2.0.3-dev"
 
 extern zend_module_entry oci8_module_entry;
 #define phpext_oci8_ptr &oci8_module_entry
index 6155a883b02e1e8d2d1ce6277674537655103698..2d4ff26947e99c353c6449d6869e6c3ee870caf9 100644 (file)
@@ -156,6 +156,9 @@ typedef struct {
        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 */
+#ifdef HAVE_OCI8_DTRACE
+       char               *client_id;                                  /* The oci_set_client_identifier() value */
+#endif
 } php_oci_connection;
 /* }}} */
 
index beebabbd24f078575f6c213e2f8167bf073c7daf..cc1cae298683405a97c1221fd64149926d8b14b1 100644 (file)
@@ -884,8 +884,7 @@ default_socket_timeout = 60
 ;extension=php_exif.dll      ; Must be after mbstring as it depends on it
 ;extension=php_mysql.dll
 ;extension=php_mysqli.dll
-;extension=php_oci8.dll      ; Use with Oracle 10gR2 Instant Client
-;extension=php_oci8_11g.dll  ; Use with Oracle 11gR2 Instant Client
+;extension=php_oci8_12c.dll  ; Use with Oracle Database 12c Instant Client
 ;extension=php_openssl.dll
 ;extension=php_pdo_firebird.dll
 ;extension=php_pdo_mysql.dll
index 5a95344cb451e76d55cf0785b234450bc7b58f91..8ed89c799cce70acc43d47094bb509e4548014de 100644 (file)
@@ -884,8 +884,7 @@ default_socket_timeout = 60
 ;extension=php_exif.dll      ; Must be after mbstring as it depends on it
 ;extension=php_mysql.dll
 ;extension=php_mysqli.dll
-;extension=php_oci8.dll      ; Use with Oracle 10gR2 Instant Client
-;extension=php_oci8_11g.dll  ; Use with Oracle 11gR2 Instant Client
+;extension=php_oci8_12c.dll  ; Use with Oracle Database 12c Instant Client
 ;extension=php_openssl.dll
 ;extension=php_pdo_firebird.dll
 ;extension=php_pdo_mysql.dll