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/bug46994.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

84 lines
2.0 KiB
PHP

--TEST--
Bug #46994 (CLOB size does not update when using CLOB IN OUT param in stored procedure)
--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');
// Initialization
$stmtarray = array(
"create or replace procedure bug46994_proc1(p1 in out nocopy clob) is
begin
dbms_lob.trim(p1, 0);
dbms_lob.writeappend(p1, 26, 'This should be the output.');
end bug46994_proc1;",
"create or replace procedure bug46994_proc2(p1 in out nocopy clob) is
begin
dbms_lob.trim(p1, 0);
dbms_lob.writeappend(p1, 37, 'The output should be even longer now.');
end bug46994_proc2;"
);
oci8_test_sql_execute($c, $stmtarray);
// Run Test
$myclob = oci_new_descriptor($c, OCI_D_LOB);
$myclob->writeTemporary("some data", OCI_TEMP_CLOB);
echo "Test 1\n";
$s = oci_parse($c, "begin bug46994_proc1(:myclob); end;");
oci_bind_by_name($s, ":myclob", $myclob, -1, SQLT_CLOB);
oci_execute($s, OCI_DEFAULT);
var_dump($myclob->load());
echo "Test 2\n";
$s = oci_parse($c, "begin bug46994_proc2(:myclob); end;");
oci_bind_by_name($s, ":myclob", $myclob, -1, SQLT_CLOB);
oci_execute($s, OCI_DEFAULT);
var_dump($myclob->load());
echo "Test 3\n";
$s = oci_parse($c, "begin bug46994_proc1(:myclob); end;");
oci_bind_by_name($s, ":myclob", $myclob, -1, SQLT_CLOB);
oci_execute($s, OCI_DEFAULT);
var_dump($myclob->load());
echo "Test 4\n";
var_dump($myclob->load()); // Use cached size code path
// Cleanup
$stmtarray = array(
"drop procedure bug46994_proc1",
"drop procedure bug46994_proc2"
);
oci8_test_sql_execute($c, $stmtarray);
oci_close($c);
?>
--EXPECT--
Test 1
string(26) "This should be the output."
Test 2
string(37) "The output should be even longer now."
Test 3
string(26) "This should be the output."
Test 4
string(26) "This should be the output."