]> granicus.if.org Git - php/commitdiff
OCI8 2.0: Added a new oci_set_db_operation() user space function for the "DB Operatio...
authorChristopher Jones <sixd@php.net>
Mon, 30 Sep 2013 23:51:07 +0000 (16:51 -0700)
committerChristopher Jones <sixd@php.net>
Mon, 30 Sep 2013 23:51:07 +0000 (16:51 -0700)
Currently this code is #ifdef'd out, since I can't consider the feature stable until an Oracle-side fix for Oracle bug 16695981 is available.  Having the code available in PHP OCI8 facilitates testing of any fix.

ext/oci8/oci8.c
ext/oci8/oci8_interface.c

index 6723c22019ccf4aef5404d245813a6b60c325d38..eeb1ade7bb802826174be17369dc17fd6173355b 100644 (file)
@@ -457,6 +457,13 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_set_client_info, 0, 0, 2)
        ZEND_ARG_INFO(0, client_information)
 ZEND_END_ARG_INFO()
 
+#ifdef WAITIING_ORACLE_BUG_16695981_FIX
+ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_set_db_operation, 0, 0, 2)
+ZEND_ARG_INFO(0, connection_resource)
+ZEND_ARG_INFO(0, action)
+ZEND_END_ARG_INFO()
+#endif
+
 ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_password_change, 0, 0, 4)
        ZEND_ARG_INFO(0, connection_resource_or_connection_string)
        ZEND_ARG_INFO(0, username)
@@ -708,6 +715,9 @@ static unsigned char arginfo_oci_bind_array_by_name[] = { 3, BYREF_NONE, BYREF_N
 #define arginfo_oci_set_module_name                                            NULL
 #define arginfo_oci_set_action                                                 NULL
 #define arginfo_oci_set_client_info                                            NULL
+#ifdef WAITIING_ORACLE_BUG_16695981_FIX
+#define arginfo_oci_set_db_operation                                   NULL
+#endif
 #define arginfo_oci_password_change                                            NULL
 #define arginfo_oci_new_cursor                                                 NULL
 #define arginfo_oci_result                                                             NULL
@@ -799,6 +809,9 @@ PHP_FUNCTION(oci_statement_type);
 PHP_FUNCTION(oci_num_rows);
 PHP_FUNCTION(oci_set_prefetch);
 PHP_FUNCTION(oci_set_client_identifier);
+#ifdef WAITIING_ORACLE_BUG_16695981_FIX
+PHP_FUNCTION(oci_set_db_operation);
+#endif
 PHP_FUNCTION(oci_set_edition);
 PHP_FUNCTION(oci_set_module_name);
 PHP_FUNCTION(oci_set_action);
@@ -904,6 +917,9 @@ zend_function_entry php_oci_functions[] = {
        PHP_FE(oci_new_descriptor,                      arginfo_oci_new_descriptor)
        PHP_FE(oci_set_prefetch,                        arginfo_oci_set_prefetch)
        PHP_FE(oci_set_client_identifier,       arginfo_oci_set_client_identifier)
+#ifdef WAITIING_ORACLE_BUG_16695981_FIX
+       PHP_FE(oci_set_db_operation,            arginfo_oci_set_db_operation)
+#endif
        PHP_FE(oci_set_edition,                         arginfo_oci_set_edition)
        PHP_FE(oci_set_module_name,                     arginfo_oci_set_module_name)
        PHP_FE(oci_set_action,                          arginfo_oci_set_action)
index 0f17f935f114b45b475f293e9df1655b5888c66c..a452c1a7e2902e4fa8face1ad1ed1ad21f41eda4 100644 (file)
@@ -1928,6 +1928,38 @@ PHP_FUNCTION(oci_set_client_info)
 }
 /* }}} */
 
+#ifdef WAITIING_ORACLE_BUG_16695981_FIX
+/* {{{ proto bool oci_set_db_operation(resource connection, string value)
+   Sets the "DB operation" on the connection for Oracle end-to-end tracing */
+PHP_FUNCTION(oci_set_db_operation)
+{
+#if (OCI_MAJOR_VERSION > 11)
+       zval *z_connection;
+       php_oci_connection *connection;
+       char *dbop_name;
+       int dbop_name_len;
+
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_connection, &dbop_name, &dbop_name_len) == FAILURE) {
+               return;
+       }
+
+       PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection);
+
+       PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) dbop_name, (ub4) dbop_name_len, (ub4) OCI_ATTR_DBOP, OCI_G(err)));
+
+       if (OCI_G(errcode) != OCI_SUCCESS) {
+               php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC);
+               RETURN_FALSE;
+       }
+       RETURN_TRUE;
+#else
+       php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Unsupported attribute type");
+       RETURN_FALSE;
+#endif
+}
+/* }}} */
+#endif /* WAITIING_ORACLE_BUG_16695981_FIX */
+
 /* {{{ proto bool oci_password_change(resource connection, string username, string old_password, string new_password)
   Changes the password of an account */
 PHP_FUNCTION(oci_password_change)