summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Jones <christopher.jones@oracle.com>2018-12-09 20:55:04 +1100
committerChristopher Jones <christopher.jones@oracle.com>2018-12-09 20:55:04 +1100
commit99f1f3dedfdd9c2c10962bf83c0e52fd60366928 (patch)
tree62b82f5a7c9631c9cb9601fb133a3ecd9998f11f
parente2ecd60f2f080d10d38337912b793a7a6b5609e0 (diff)
downloadphp-git-99f1f3dedfdd9c2c10962bf83c0e52fd60366928.tar.gz
Add oci_set_call_timeout() and bump version to 2.10.0
-rw-r--r--NEWS2
-rw-r--r--ext/oci8/oci8.c11
-rw-r--r--ext/oci8/oci8_interface.c30
-rw-r--r--ext/oci8/package.xml7
-rw-r--r--ext/oci8/php_oci8.h2
-rw-r--r--ext/oci8/php_oci8_int.h2
-rwxr-xr-xext/oci8/tests/calltimeout1.phpt57
-rw-r--r--ext/oci8/tests/driver_name.phpt6
8 files changed, 108 insertions, 9 deletions
diff --git a/NEWS b/NEWS
index 2d0aa66fdf..84ee19425f 100644
--- a/NEWS
+++ b/NEWS
@@ -27,6 +27,8 @@ PHP NEWS
- OCI8:
. Fixed bug #76804 (oci_pconnect with OCI_CRED_EXT not working). (KoenigsKind)
+ . Added oci_set_call_timeout() for call timeouts.
+ . Added oci_set_db_operation() for the DBOP end-to-end-tracing attribute.
- Opcache:
. Fixed bug #77215 (CFG assertion failure on multiple finalizing switch
diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c
index 8f3ce207fc..bc68fd5355 100644
--- a/ext/oci8/oci8.c
+++ b/ext/oci8/oci8.c
@@ -424,8 +424,13 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_set_client_info, 0, 0, 2)
ZEND_END_ARG_INFO()
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_ARG_INFO(0, connection_resource)
+ ZEND_ARG_INFO(0, action)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_set_call_timeout, 0, 0, 2)
+ ZEND_ARG_INFO(0, connection_resource)
+ ZEND_ARG_INFO(0, call_timeout)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_password_change, 0, 0, 4)
@@ -671,6 +676,7 @@ PHP_FUNCTION(oci_num_rows);
PHP_FUNCTION(oci_set_prefetch);
PHP_FUNCTION(oci_set_client_identifier);
PHP_FUNCTION(oci_set_db_operation);
+PHP_FUNCTION(oci_set_call_timeout);
PHP_FUNCTION(oci_set_edition);
PHP_FUNCTION(oci_set_module_name);
PHP_FUNCTION(oci_set_action);
@@ -774,6 +780,7 @@ static const zend_function_entry php_oci_functions[] = {
PHP_FE(oci_set_prefetch, arginfo_oci_set_prefetch)
PHP_FE(oci_set_client_identifier, arginfo_oci_set_client_identifier)
PHP_FE(oci_set_db_operation, arginfo_oci_set_db_operation)
+ PHP_FE(oci_set_call_timeout, arginfo_oci_set_call_timeout)
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)
diff --git a/ext/oci8/oci8_interface.c b/ext/oci8/oci8_interface.c
index 77e264d996..66bc0b9a44 100644
--- a/ext/oci8/oci8_interface.c
+++ b/ext/oci8/oci8_interface.c
@@ -2059,6 +2059,36 @@ PHP_FUNCTION(oci_set_db_operation)
}
/* }}} */
+/* {{{ proto bool oci_set_call_timeout(resource connection, int call_timeout)
+ */
+PHP_FUNCTION(oci_set_call_timeout)
+{
+#if (OCI_MAJOR_VERSION >= 18)
+ zval *z_connection;
+ php_oci_connection *connection;
+ zend_long call_timeout; // milliseconds
+
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_RESOURCE(z_connection)
+ Z_PARAM_LONG(call_timeout)
+ ZEND_PARSE_PARAMETERS_END();
+
+ PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection);
+
+ PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->svc, (ub4) OCI_HTYPE_SVCCTX, (ub4 *) &call_timeout, 0, OCI_ATTR_CALL_TIMEOUT, OCI_G(err)));
+
+ if (OCI_G(errcode) != OCI_SUCCESS) {
+ php_oci_error(OCI_G(err), OCI_G(errcode));
+ RETURN_FALSE;
+ }
+ RETURN_TRUE;
+#else
+ php_error_docref(NULL, E_NOTICE, "Unsupported with this version of Oracle Client");
+ RETURN_FALSE;
+#endif
+}
+/* }}} */
+
/* {{{ 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)
diff --git a/ext/oci8/package.xml b/ext/oci8/package.xml
index 2541c264ec..35ea980904 100644
--- a/ext/oci8/package.xml
+++ b/ext/oci8/package.xml
@@ -56,8 +56,8 @@ Interoperability Support" (ID 207303.1) for details.
<time>12:00:00</time>
<version>
- <release>2.1.9</release>
- <api>2.1.9</api>
+ <release>2.10.0</release>
+ <api>2.10.0</api>
</version>
<stability>
<release>stable</release>
@@ -66,8 +66,9 @@ Interoperability Support" (ID 207303.1) for details.
<license uri="http://www.php.net/license">PHP</license>
<notes>
This version is for PHP 7 only.
+Added oci_set_call_timeout() for call timeouts. (Requires Oracle client libraries 18c or later)
+Added oci_set_db_operation() for the Oracle Database 'DBOP' end-to-end-tracing attribute. (Requires Oracle 12.2 or later)
Fixed bug #76804 (oci_pconnect with OCI_CRED_EXT not working). (KoenigsKind)
-Support setting Oracle Database 'DBOP' end-to-end-tracing attribute. (Requires Oracle 12.2 or later)
Fixed installation on 7.3.
Internal change: Convert some parameter parsing to the Fast Parameter Parsing API.
</notes>
diff --git a/ext/oci8/php_oci8.h b/ext/oci8/php_oci8.h
index a1e09ddec5..8802de0b46 100644
--- a/ext/oci8/php_oci8.h
+++ b/ext/oci8/php_oci8.h
@@ -43,7 +43,7 @@
*/
#undef PHP_OCI8_VERSION
#endif
-#define PHP_OCI8_VERSION "2.1.9"
+#define PHP_OCI8_VERSION "2.10.0"
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 8455277e59..e73ef3f18d 100644
--- a/ext/oci8/php_oci8_int.h
+++ b/ext/oci8/php_oci8_int.h
@@ -344,7 +344,9 @@ typedef struct {
case 3114: \
case 3122: \
case 3135: \
+ case 3136: \
case 12153: \
+ case 12161: \
case 27146: \
case 28511: \
(connection)->is_open = 0; \
diff --git a/ext/oci8/tests/calltimeout1.phpt b/ext/oci8/tests/calltimeout1.phpt
new file mode 100755
index 0000000000..acc25c224a
--- /dev/null
+++ b/ext/oci8/tests/calltimeout1.phpt
@@ -0,0 +1,57 @@
+--TEST--
+oci_set_call_timeout: test timing out
+--SKIPIF--
+<?php
+if (getenv('SKIP_SLOW_TESTS')) die('skip slow tests excluded by request');
+if (!extension_loaded('oci8')) die ("skip no oci8 extension");
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+if (strcasecmp($user, "system") && strcasecmp($user, "sys")) {
+ die("skip needs to be run as a user with access to DBMS_LOCK");
+}
+preg_match('/^[[:digit:]]+/', oci_client_version(), $matches);
+if (!(isset($matches[0]) && $matches[0] >= 18)) {
+ die("skip works only with Oracle 18c or greater version of Oracle client libraries");
+}
+
+?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+function mysleep($c, $t)
+{
+ $s = @oci_parse($c, "begin dbms_lock.sleep(:t); end;");
+ if (!$s) {
+ $m = oci_error($c);
+ echo "Execute error was ", $m['message'], "\n";
+ return;
+ }
+ @oci_bind_by_name($s, ":t", $t);
+ $r = @oci_execute($s);
+ if ($r) {
+ echo "Execute succeeded\n";
+ } else {
+ $m = oci_error($s);
+ echo "Execute error was ", $m['message'], "\n";
+ }
+}
+
+echo "Test 1\n";
+oci_set_call_timeout($c, 4000); // milliseconds
+$r = mysleep($c, 8); // seconds
+
+echo "Test 2\n";
+oci_set_call_timeout($c, 0);
+$r = mysleep($c, 5);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1
+Execute error was ORA-03136: %s
+Test 2
+Execute error was ORA-03114: %s
+===DONE===
diff --git a/ext/oci8/tests/driver_name.phpt b/ext/oci8/tests/driver_name.phpt
index 509e5f471c..5d05c9d046 100644
--- a/ext/oci8/tests/driver_name.phpt
+++ b/ext/oci8/tests/driver_name.phpt
@@ -57,11 +57,11 @@ function get_attr($conn)
?>
--EXPECT--
**Test 1.1 - Default values for the attribute **************
-The value of DRIVER_NAME is PHP OCI8 : 2.1.9
+The value of DRIVER_NAME is PHP OCI8 : 2.10.0
***Test 1.2 - Get the values from different connections **************
Testing with oci_pconnect()
-The value of DRIVER_NAME is PHP OCI8 : 2.1.9
+The value of DRIVER_NAME is PHP OCI8 : 2.10.0
Testing with oci_new_connect()
-The value of DRIVER_NAME is PHP OCI8 : 2.1.9
+The value of DRIVER_NAME is PHP OCI8 : 2.10.0
Done