mirror of
https://github.com/php/php-src.git
synced 2024-09-22 18:37:25 +00:00
49 lines
1.3 KiB
PHP
49 lines
1.3 KiB
PHP
--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(__DIR__.'/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(__DIR__.'/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
|
|
|
|
?>
|
|
--EXPECTF--
|
|
Test 1
|
|
Execute error was ORA-%r(03136|03156)%r: %s
|