summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorChristopher Jones <christopher.jones@oracle.com>2018-12-09 20:55:21 +1100
committerChristopher Jones <christopher.jones@oracle.com>2018-12-09 20:55:21 +1100
commit1f84f2a766a2dbfb3f46d424aa04c2fcca7c5774 (patch)
tree0936df388e4476adbd396c20658990c7add33dfe /ext
parent31eeca8a19bbebcb44c39a9c1a9f1848907aace0 (diff)
parent99f1f3dedfdd9c2c10962bf83c0e52fd60366928 (diff)
downloadphp-git-1f84f2a766a2dbfb3f46d424aa04c2fcca7c5774.tar.gz
Merge branch 'PHP-7.2' into PHP-7.3
Diffstat (limited to 'ext')
-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
7 files changed, 106 insertions, 9 deletions
diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c
index 7684d8f78f..d1784e79d5 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 e429017cc1..2e05afa527 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 1adf6903d1..be1cb2a426 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 b1e801ad4c..308f887114 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 577a315817..626cb86aed 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