1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00
Files
archived-php-src/ext/oci8/tests/bug44206.phpt
Michael Orlitzky 605c60cd5f Skip oci8 tests when no database is available (#11820)
Most oci8 tests fail out-of-the-box because a typical host won't have
an Oracle database instance available. Other database drivers like
mysqli and pgsql address this problem with an include file, inserted
into SKIPIF, that skips the test if no connection at all can be made.

This commits adds such a file (skipifconnectfailure.inc) for oci8, and
adds the corresponding SKIPIF to any tests that connect to a database.

Closes GH-11804

* ext/oci8/tests/lob_aliases.phpt: drop unnecessary SKIPIF.
2023-07-31 15:19:31 +01:00

50 lines
1.1 KiB
PHP

--TEST--
Bug #44206 (Test if selecting ref cursors leads to ORA-1000 maximum open cursors reached)
--EXTENSIONS--
oci8
--SKIPIF--
<?php
require_once('skipifconnectfailure.inc');
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
require(__DIR__.'/skipif.inc');
?>
--FILE--
<?php
require __DIR__.'/connect.inc';
// Run Test
for ($x = 0; $x < 400; $x++)
{
$stmt = "select cursor (select $x from dual) a,
cursor (select $x from dual) b
from dual";
$s = oci_parse($c, $stmt);
$r = oci_execute($s);
if (!$r) {
echo "Exiting $x\n";
exit;
}
$mode = OCI_ASSOC | OCI_RETURN_NULLS;
$result = oci_fetch_array($s, $mode);
oci_execute($result['A']);
oci_execute($result['B']);
oci_fetch_array($result['A'], $mode);
oci_fetch_array($result['B'], $mode);
oci_free_statement($result['A']);
oci_free_statement($result['B']);
oci_free_statement($s);
}
echo "Completed $x\n";
oci_close($c);
echo "Done\n";
?>
--EXPECT--
Completed 400
Done