Skip to content

Commit 02513f1

Browse files
committed
Merge branch 'PHP-7.3'
2 parents b2a1c14 + 8c37d5f commit 02513f1

File tree

7 files changed

+106
-9
lines changed

7 files changed

+106
-9
lines changed

ext/oci8/oci8.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -424,8 +424,13 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_set_client_info, 0, 0, 2)
424424
ZEND_END_ARG_INFO()
425425

426426
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_set_db_operation, 0, 0, 2)
427-
ZEND_ARG_INFO(0, connection_resource)
428-
ZEND_ARG_INFO(0, action)
427+
ZEND_ARG_INFO(0, connection_resource)
428+
ZEND_ARG_INFO(0, action)
429+
ZEND_END_ARG_INFO()
430+
431+
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_set_call_timeout, 0, 0, 2)
432+
ZEND_ARG_INFO(0, connection_resource)
433+
ZEND_ARG_INFO(0, call_timeout)
429434
ZEND_END_ARG_INFO()
430435

431436
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_password_change, 0, 0, 4)
@@ -671,6 +676,7 @@ PHP_FUNCTION(oci_num_rows);
671676
PHP_FUNCTION(oci_set_prefetch);
672677
PHP_FUNCTION(oci_set_client_identifier);
673678
PHP_FUNCTION(oci_set_db_operation);
679+
PHP_FUNCTION(oci_set_call_timeout);
674680
PHP_FUNCTION(oci_set_edition);
675681
PHP_FUNCTION(oci_set_module_name);
676682
PHP_FUNCTION(oci_set_action);
@@ -774,6 +780,7 @@ static const zend_function_entry php_oci_functions[] = {
774780
PHP_FE(oci_set_prefetch, arginfo_oci_set_prefetch)
775781
PHP_FE(oci_set_client_identifier, arginfo_oci_set_client_identifier)
776782
PHP_FE(oci_set_db_operation, arginfo_oci_set_db_operation)
783+
PHP_FE(oci_set_call_timeout, arginfo_oci_set_call_timeout)
777784
PHP_FE(oci_set_edition, arginfo_oci_set_edition)
778785
PHP_FE(oci_set_module_name, arginfo_oci_set_module_name)
779786
PHP_FE(oci_set_action, arginfo_oci_set_action)

ext/oci8/oci8_interface.c

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2059,6 +2059,36 @@ PHP_FUNCTION(oci_set_db_operation)
20592059
}
20602060
/* }}} */
20612061

2062+
/* {{{ proto bool oci_set_call_timeout(resource connection, int call_timeout)
2063+
*/
2064+
PHP_FUNCTION(oci_set_call_timeout)
2065+
{
2066+
#if (OCI_MAJOR_VERSION >= 18)
2067+
zval *z_connection;
2068+
php_oci_connection *connection;
2069+
zend_long call_timeout; // milliseconds
2070+
2071+
ZEND_PARSE_PARAMETERS_START(2, 2)
2072+
Z_PARAM_RESOURCE(z_connection)
2073+
Z_PARAM_LONG(call_timeout)
2074+
ZEND_PARSE_PARAMETERS_END();
2075+
2076+
PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection);
2077+
2078+
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)));
2079+
2080+
if (OCI_G(errcode) != OCI_SUCCESS) {
2081+
php_oci_error(OCI_G(err), OCI_G(errcode));
2082+
RETURN_FALSE;
2083+
}
2084+
RETURN_TRUE;
2085+
#else
2086+
php_error_docref(NULL, E_NOTICE, "Unsupported with this version of Oracle Client");
2087+
RETURN_FALSE;
2088+
#endif
2089+
}
2090+
/* }}} */
2091+
20622092
/* {{{ proto bool oci_password_change(resource connection, string username, string old_password, string new_password)
20632093
Changes the password of an account */
20642094
PHP_FUNCTION(oci_password_change)

ext/oci8/package.xml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ Interoperability Support" (ID 207303.1) for details.
5656
<time>12:00:00</time>
5757

5858
<version>
59-
<release>2.1.9</release>
60-
<api>2.1.9</api>
59+
<release>2.10.0</release>
60+
<api>2.10.0</api>
6161
</version>
6262
<stability>
6363
<release>stable</release>
@@ -66,8 +66,9 @@ Interoperability Support" (ID 207303.1) for details.
6666
<license uri="http://www.php.net/license">PHP</license>
6767
<notes>
6868
This version is for PHP 7 only.
69+
Added oci_set_call_timeout() for call timeouts. (Requires Oracle client libraries 18c or later)
70+
Added oci_set_db_operation() for the Oracle Database 'DBOP' end-to-end-tracing attribute. (Requires Oracle 12.2 or later)
6971
Fixed bug #76804 (oci_pconnect with OCI_CRED_EXT not working). (KoenigsKind)
70-
Support setting Oracle Database 'DBOP' end-to-end-tracing attribute. (Requires Oracle 12.2 or later)
7172
Fixed installation on 7.3.
7273
Internal change: Convert some parameter parsing to the Fast Parameter Parsing API.
7374
</notes>

ext/oci8/php_oci8.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
*/
4444
#undef PHP_OCI8_VERSION
4545
#endif
46-
#define PHP_OCI8_VERSION "2.1.9"
46+
#define PHP_OCI8_VERSION "2.10.0"
4747

4848
extern zend_module_entry oci8_module_entry;
4949
#define phpext_oci8_ptr &oci8_module_entry

ext/oci8/php_oci8_int.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,9 @@ typedef struct {
344344
case 3114: \
345345
case 3122: \
346346
case 3135: \
347+
case 3136: \
347348
case 12153: \
349+
case 12161: \
348350
case 27146: \
349351
case 28511: \
350352
(connection)->is_open = 0; \

ext/oci8/tests/calltimeout1.phpt

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
--TEST--
2+
oci_set_call_timeout: test timing out
3+
--SKIPIF--
4+
<?php
5+
if (getenv('SKIP_SLOW_TESTS')) die('skip slow tests excluded by request');
6+
if (!extension_loaded('oci8')) die ("skip no oci8 extension");
7+
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
8+
require(dirname(__FILE__).'/skipif.inc');
9+
if (strcasecmp($user, "system") && strcasecmp($user, "sys")) {
10+
die("skip needs to be run as a user with access to DBMS_LOCK");
11+
}
12+
preg_match('/^[[:digit:]]+/', oci_client_version(), $matches);
13+
if (!(isset($matches[0]) && $matches[0] >= 18)) {
14+
die("skip works only with Oracle 18c or greater version of Oracle client libraries");
15+
}
16+
17+
?>
18+
--FILE--
19+
<?php
20+
21+
require(dirname(__FILE__).'/connect.inc');
22+
23+
function mysleep($c, $t)
24+
{
25+
$s = @oci_parse($c, "begin dbms_lock.sleep(:t); end;");
26+
if (!$s) {
27+
$m = oci_error($c);
28+
echo "Execute error was ", $m['message'], "\n";
29+
return;
30+
}
31+
@oci_bind_by_name($s, ":t", $t);
32+
$r = @oci_execute($s);
33+
if ($r) {
34+
echo "Execute succeeded\n";
35+
} else {
36+
$m = oci_error($s);
37+
echo "Execute error was ", $m['message'], "\n";
38+
}
39+
}
40+
41+
echo "Test 1\n";
42+
oci_set_call_timeout($c, 4000); // milliseconds
43+
$r = mysleep($c, 8); // seconds
44+
45+
echo "Test 2\n";
46+
oci_set_call_timeout($c, 0);
47+
$r = mysleep($c, 5);
48+
49+
?>
50+
===DONE===
51+
<?php exit(0); ?>
52+
--EXPECTF--
53+
Test 1
54+
Execute error was ORA-03136: %s
55+
Test 2
56+
Execute error was ORA-03114: %s
57+
===DONE===

ext/oci8/tests/driver_name.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,11 @@ function get_attr($conn)
5757
?>
5858
--EXPECT--
5959
**Test 1.1 - Default values for the attribute **************
60-
The value of DRIVER_NAME is PHP OCI8 : 2.1.9
60+
The value of DRIVER_NAME is PHP OCI8 : 2.10.0
6161

6262
***Test 1.2 - Get the values from different connections **************
6363
Testing with oci_pconnect()
64-
The value of DRIVER_NAME is PHP OCI8 : 2.1.9
64+
The value of DRIVER_NAME is PHP OCI8 : 2.10.0
6565
Testing with oci_new_connect()
66-
The value of DRIVER_NAME is PHP OCI8 : 2.1.9
66+
The value of DRIVER_NAME is PHP OCI8 : 2.10.0
6767
Done

0 commit comments

Comments
 (0)