summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/oci8/config.m42
-rw-r--r--ext/oci8/oci8.c37
-rw-r--r--ext/oci8/oci8_dtrace.d8
-rw-r--r--ext/oci8/oci8_interface.c29
-rw-r--r--ext/oci8/oci8_statement.c16
-rw-r--r--ext/oci8/package.xml31
-rw-r--r--ext/oci8/php_oci8.h2
-rw-r--r--ext/oci8/php_oci8_int.h3
-rw-r--r--php.ini-development3
-rw-r--r--php.ini-production3
10 files changed, 95 insertions, 39 deletions
diff --git a/ext/oci8/config.m4 b/ext/oci8/config.m4
index 49998d18f0..3873a2205a 100644
--- a/ext/oci8/config.m4
+++ b/ext/oci8/config.m4
@@ -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
diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c
index bccaa529b0..f04114d4d6 100644
--- a/ext/oci8/oci8.c
+++ b/ext/oci8/oci8.c
@@ -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 S�ther 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 */
}
diff --git a/ext/oci8/oci8_dtrace.d b/ext/oci8/oci8_dtrace.d
index 8ac94105c1..30c98de912 100644
--- a/ext/oci8/oci8_dtrace.d
+++ b/ext/oci8/oci8_dtrace.d
@@ -16,14 +16,14 @@
+----------------------------------------------------------------------+
*/
-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);
diff --git a/ext/oci8/oci8_interface.c b/ext/oci8/oci8_interface.c
index 8d70aff9c2..3fad90d9c7 100644
--- a/ext/oci8/oci8_interface.c
+++ b/ext/oci8/oci8_interface.c
@@ -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;
diff --git a/ext/oci8/oci8_statement.c b/ext/oci8/oci8_statement.c
index 274c4e9e33..1e66308e53 100644
--- a/ext/oci8/oci8_statement.c
+++ b/ext/oci8/oci8_statement.c
@@ -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;
diff --git a/ext/oci8/package.xml b/ext/oci8/package.xml
index fcab20cc45..24ba635fef 100644
--- a/ext/oci8/package.xml
+++ b/ext/oci8/package.xml
@@ -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="/">
@@ -457,6 +456,24 @@ Add the connection handle to several DTrace probes.
<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>
<api>2.0.1</api>
</version>
diff --git a/ext/oci8/php_oci8.h b/ext/oci8/php_oci8.h
index 8c5fba9ab0..6d02eff6b2 100644
--- a/ext/oci8/php_oci8.h
+++ b/ext/oci8/php_oci8.h
@@ -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
diff --git a/ext/oci8/php_oci8_int.h b/ext/oci8/php_oci8_int.h
index 6155a883b0..2d4ff26947 100644
--- a/ext/oci8/php_oci8_int.h
+++ b/ext/oci8/php_oci8_int.h
@@ -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;
/* }}} */
diff --git a/php.ini-development b/php.ini-development
index beebabbd24..cc1cae2986 100644
--- a/php.ini-development
+++ b/php.ini-development
@@ -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
diff --git a/php.ini-production b/php.ini-production
index 5a95344cb4..8ed89c799c 100644
--- a/php.ini-production
+++ b/php.ini-production
@@ -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