/home/lnzliplg/www/alt-php85-pecl-pdo_oci_1.2.0-1.el8.zip
PK �C�\L�Cr r $ tests/pdo_oci_attr_call_timeout.phptnu �[��� --TEST--
PDO_OCI: Attribute: Setting and using call timeout
--EXTENSIONS--
pdo
pdo_oci
--SKIPIF--
<?php
if (getenv('SKIP_SLOW_TESTS')) die('skip slow tests excluded by request');
require(getenv('PDO_TEST_DIR').'/pdo_test.inc');
PDOTest::skip();
if (strcasecmp(getenv('PDOTEST_USER'), "system") && strcasecmp(getenv('PDOTEST_USER'), "sys")) {
die("skip needs to be run as a user with access to DBMS_LOCK");
}
$dbh = PDOTest::factory();
preg_match('/^[[:digit:]]+/', $dbh->getAttribute(PDO::ATTR_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_once(getenv('PDO_TEST_DIR').'/pdo_test.inc');
function mysleep($dbh, $t)
{
$stmt = $dbh->prepare("begin dbms_lock.sleep(:t); end;");
if (!$stmt) {
$error = $dbh->errorInfo();
echo "Prepare error was ", $error[2], "\n";
return;
}
$stmt->bindParam(":t", $t, PDO::PARAM_INT);
$r = $stmt->execute();
if ($r) {
echo "Execute succeeded\n";
} else {
$error = $dbh->errorInfo();
echo "Execute error was ", $error[2], "\n";
}
}
$dbh = PDOTest::factory();
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT);
echo "Test 1\n";
$dbh->setAttribute(PDO::OCI_ATTR_CALL_TIMEOUT, 4000); // milliseconds
echo "call timeout:\n";
var_dump($dbh->getAttribute(PDO::OCI_ATTR_CALL_TIMEOUT));
$r = mysleep($dbh, 8); // seconds
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
Test 1
call timeout:
int(4000)
Execute error was OCIStmtExecute: ORA-%r(03136|03156)%r: %s
(%s:%d)
===DONE===
PK �C�\��%~" " tests/pecl_bug_6364.phptnu �[��� --TEST--
PECL PDO_OCI Bug #6364 (segmentation fault on stored procedure call with OUT binds)
--EXTENSIONS--
pdo
pdo_oci
--SKIPIF--
<?php
if (getenv('SKIP_ASAN')) die('xleak leaks memory under asan');
require(getenv('PDO_TEST_DIR').'/pdo_test.inc');
PDOTest::skip();
?>
--FILE--
<?php
require_once(getenv('PDO_TEST_DIR').'/pdo_test.inc');
$dbh = PDOTest::factory();
$dbh->exec("begin
execute immediate 'drop table test6364';
exception when others then
if sqlcode <> -942 then
raise;
end if;
end;");
$dbh->exec ("create table test6364 (c1 varchar2(10), c2 varchar2(10), c3 varchar2(10), c4 varchar2(10), c5 varchar2(10))");
$dbh->exec ("create or replace procedure test6364_sp(p1 IN varchar2, p2 IN varchar2, p3 IN varchar2, p4 OUT varchar2, p5 OUT varchar2) as begin insert into test6364 (c1, c2, c3) values (p1, p2, p3); p4 := 'val4'; p5 := 'val5'; end;");
$stmt = $dbh->prepare("call test6364_sp('p1','p2','p3',?,?)");
$out_param1 = "a";
$out_param2 = "a";
$stmt->bindParam(1, $out_param1,PDO::PARAM_STR, 1024);
$stmt->bindParam(2, $out_param2,PDO::PARAM_STR, 1024);
$stmt->execute() or die ("Execution error: " . var_dump($dbh->errorInfo()));
var_dump($out_param1);
var_dump($out_param2);
foreach ($dbh->query("select * from test6364") as $row) {
var_dump($row);
}
print "Done\n";
?>
--CLEAN--
<?php
require_once(getenv('PDO_TEST_DIR').'/pdo_test.inc');
$db = PDOTest::test_factory(getenv('PDO_OCI_TEST_DIR').'/common.phpt');
$db->exec("begin
execute immediate 'drop table test6364';
exception when others then
if sqlcode <> -942 then
raise;
end if;
end;");
$db->exec("DROP PROCEDURE test6364_sp");
?>
--EXPECT--
string(4) "val4"
string(4) "val5"
array(10) {
["c1"]=>
string(2) "p1"
[0]=>
string(2) "p1"
["c2"]=>
string(2) "p2"
[1]=>
string(2) "p2"
["c3"]=>
string(2) "p3"
[2]=>
string(2) "p3"
["c4"]=>
NULL
[3]=>
NULL
["c5"]=>
NULL
[4]=>
NULL
}
Done
PK �C�\)��p tests/pdo_oci_stream_2.phptnu �[��� --TEST--
PDO OCI: Insert and fetch 1K records from a table that contains 1 number and 2 LOB columns (stress test)
--EXTENSIONS--
pdo
pdo_oci
--SKIPIF--
<?php
if (getenv('SKIP_SLOW_TESTS')) die('skip slow tests excluded by request');
require(getenv('PDO_TEST_DIR').'/pdo_test.inc');
PDOTest::skip();
?>
--FILE--
<?php
require_once(getenv('PDO_TEST_DIR').'/pdo_test.inc');
$db = PDOTest::factory();
$db->exec("begin
execute immediate 'drop table test_pdo_oci_stream_2';
exception when others then
if sqlcode <> -942 then
raise;
end if;
end;");
$query = "create table test_pdo_oci_stream_2 (id number, data1 blob, data2 blob)";
$stmt = $db->prepare($query);
$stmt->execute();
function do_insert($db, $id, $data1, $data2)
{
$db->beginTransaction();
$stmt = $db->prepare("insert into test_pdo_oci_stream_2 (id, data1, data2) values (:id, empty_blob(), empty_blob()) returning data1, data2 into :blob1, :blob2");
$stmt->bindParam(':id', $id);
$stmt->bindParam(':blob1', $blob1, PDO::PARAM_LOB);
$stmt->bindParam(':blob2', $blob2, PDO::PARAM_LOB);
$blob1 = null;
$blob2 = null;
$stmt->execute();
fwrite($blob1, $data1);
fclose($blob1);
fwrite($blob2, $data2);
fclose($blob2);
$db->commit();
}
$a1 = str_repeat('a', 4086);
$a2 = str_repeat('b', 4087);
$a3 = str_repeat('c', 4088);
$a4 = str_repeat('d', 4089);
$a5 = str_repeat('e', 4090);
$a6 = str_repeat('f', 4091);
$a7 = str_repeat('g', 4092);
$a8 = str_repeat('h', 4093);
$a9 = str_repeat('i', 4094);
$a10 = str_repeat('j', 4095);
printf("Inserting 1000 Records ... ");
for($i=0; $i<100; $i++) {
do_insert($db, $i * 10 + 1, $a1, $a10);
do_insert($db, $i * 10 + 2, $a2, $a9);
do_insert($db, $i * 10 + 3, $a3, $a8);
do_insert($db, $i * 10 + 4, $a4, $a7);
do_insert($db, $i * 10 + 5, $a5, $a6);
do_insert($db, $i * 10 + 6, $a6, $a5);
do_insert($db, $i * 10 + 7, $a7, $a4);
do_insert($db, $i * 10 + 8, $a8, $a3);
do_insert($db, $i * 10 + 9, $a9, $a2);
do_insert($db, $i * 10 + 10, $a10, $a1);
}
printf("Done\n");
$db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false); // Let's use streams
// Since each column only has one lob descriptor, the last row is
// shown twice because the lob descriptor for each column is reused in
// the stream
$i = 0;
$j = 9;
$a_val = ord('a');
foreach($db->query("select data1 as d4_1, data2 as d4_2 from test_pdo_oci_stream_2 order by id") as $row) {
$a = $row['d4_1'];
$a1 = $row['d4_2'];
$str1 = stream_get_contents($a);
$str2 = stream_get_contents($a1);
$str1len = strlen($str1);
$str2len = strlen($str2);
$b = ord($str1[0]);
$b1 = ord($str2[0]);
if (($b != ($a_val + $i)) && ($str1len != (4086 + $i)) &&
($b1 != ($a_val + $j)) && ($str2len != (4086 + $j))) {
printf("There is a bug!\n");
printf("Col1:\n");
printf("a_val = %d\n", $a_val);
printf("b = %d\n", $b);
printf("i = %d\n", $i);
printf("str1len = %d\n", $str1len);
printf("Col2:\n");
printf("a_val = %d\n", $a_val);
printf("b1 = %d\n", $b1);
printf("j = %d\n", $j);
printf("str2len = %d\n", $str1len);
}
$i++;
if ($i>9)
$i = 0;
$j--;
if ($j<0)
$j = 9;
}
echo "Fetch operation done!\n";
?>
--CLEAN--
<?php
require_once(getenv('PDO_TEST_DIR').'/pdo_test.inc');
$db = PDOTest::test_factory(getenv('PDO_OCI_TEST_DIR').'/common.phpt');
$db->exec("begin
execute immediate 'drop table test_pdo_oci_stream_2';
exception when others then
if sqlcode <> -942 then
raise;
end if;
end;");
?>
--EXPECT--
Inserting 1000 Records ... Done
Fetch operation done!
PK �C�\��|Vg g $ tests/pdo_oci_bind_input_output.phptnu �[��� --TEST--
PDO_OCI: Test input/output parameter binding
--EXTENSIONS--
pdo
pdo_oci
--SKIPIF--
<?php
require(getenv('PDO_TEST_DIR').'/pdo_test.inc');
PDOTest::skip();
?>
--FILE--
<?php
require_once(getenv('PDO_TEST_DIR').'/pdo_test.inc');
$dbh = PDOTest::factory();
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$dbh->setAttribute(PDO::ATTR_AUTOCOMMIT, false);
$sql = <<<SQL
begin
:p := :p + 100;
end;
SQL;
$stmt = $dbh->prepare($sql);
$p = -1;
$stmt->bindParam(':p', $p, PDO::PARAM_INT | PDO::PARAM_INPUT_OUTPUT, 10);
$stmt->execute();
var_dump($p);
?>
--EXPECT--
string(2) "99"
PK �C�\�ci� � tests/pdo_oci_quote1.phptnu �[��� --TEST--
Test PDO->quote() for PDO_OCI
--EXTENSIONS--
pdo
pdo_oci
--SKIPIF--
<?php
require(getenv('PDO_TEST_DIR').'/pdo_test.inc');
PDOTest::skip();
?>
--FILE--
<?php
require_once(getenv('PDO_TEST_DIR').'/pdo_test.inc');
$db = PDOTest::factory();
$db->exec("begin
execute immediate 'drop table test_pdo_oci_quote1';
exception when others then
if sqlcode <> -942 then
raise;
end if;
end;");
$db->query("create table test_pdo_oci_quote1 (t varchar2(100))");
$stmt = $db->prepare('select * from test_pdo_oci_quote1');
// The intent is that the fetched data be identical to the unquoted string.
// Remember!: use bind variables instead of PDO->quote()
$a = array("", "a", "ab", "abc", "ab'cd", "a\b\n", "'", "''", "a'", "'z", "a''b", '"');
foreach ($a as $u) {
$q = $db->quote($u);
echo "Unquoted : ";
var_dump($u);
echo "Quoted : ";
var_dump($q);
$db->exec("delete from test_pdo_oci_quote1");
$db->query("insert into test_pdo_oci_quote1 (t) values($q)");
$stmt->execute();
var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
}
echo "Done\n";
?>
--CLEAN--
<?php
require_once(getenv('PDO_TEST_DIR').'/pdo_test.inc');
$db = PDOTest::test_factory(getenv('PDO_OCI_TEST_DIR').'/common.phpt');
$db->exec("begin
execute immediate 'drop table test_pdo_oci_quote1';
exception when others then
if sqlcode <> -942 then
raise;
end if;
end;");
?>
--EXPECT--
Unquoted : string(0) ""
Quoted : string(2) "''"
array(1) {
[0]=>
array(1) {
["t"]=>
NULL
}
}
Unquoted : string(1) "a"
Quoted : string(3) "'a'"
array(1) {
[0]=>
array(1) {
["t"]=>
string(1) "a"
}
}
Unquoted : string(2) "ab"
Quoted : string(4) "'ab'"
array(1) {
[0]=>
array(1) {
["t"]=>
string(2) "ab"
}
}
Unquoted : string(3) "abc"
Quoted : string(5) "'abc'"
array(1) {
[0]=>
array(1) {
["t"]=>
string(3) "abc"
}
}
Unquoted : string(5) "ab'cd"
Quoted : string(8) "'ab''cd'"
array(1) {
[0]=>
array(1) {
["t"]=>
string(5) "ab'cd"
}
}
Unquoted : string(4) "a\b
"
Quoted : string(6) "'a\b
'"
array(1) {
[0]=>
array(1) {
["t"]=>
string(4) "a\b
"
}
}
Unquoted : string(1) "'"
Quoted : string(4) "''''"
array(1) {
[0]=>
array(1) {
["t"]=>
string(1) "'"
}
}
Unquoted : string(2) "''"
Quoted : string(6) "''''''"
array(1) {
[0]=>
array(1) {
["t"]=>
string(2) "''"
}
}
Unquoted : string(2) "a'"
Quoted : string(5) "'a'''"
array(1) {
[0]=>
array(1) {
["t"]=>
string(2) "a'"
}
}
Unquoted : string(2) "'z"
Quoted : string(5) "'''z'"
array(1) {
[0]=>
array(1) {
["t"]=>
string(2) "'z"
}
}
Unquoted : string(4) "a''b"
Quoted : string(8) "'a''''b'"
array(1) {
[0]=>
array(1) {
["t"]=>
string(4) "a''b"
}
}
Unquoted : string(1) """
Quoted : string(3) "'"'"
array(1) {
[0]=>
array(1) {
["t"]=>
string(1) """
}
}
Done
PK �C�\H�A� � tests/bug60994.phptnu �[��� --TEST--
PDO OCI Bug #60994 (Reading a multibyte CLOB caps at 8192 characters)
--CREDITS--
Chuck Burgess
ashnazg@php.net
--EXTENSIONS--
mbstring
pdo
pdo_oci
--SKIPIF--
<?php
require(getenv('PDO_TEST_DIR').'/pdo_test.inc');
PDOTest::skip();
?>
--FILE--
<?php
require_once(getenv('PDO_TEST_DIR').'/pdo_test.inc');
$dbh = PDOTest::factory();
$dbh->setAttribute(PDO::ATTR_CASE, PDO::CASE_NATURAL);
$dbh->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false);
$dbh->exec("begin
execute immediate 'drop table pdo_oci_bug60994';
exception when others then
if sqlcode <> -942 then
raise;
end if;
end;");
$dbh->exec('CREATE TABLE pdo_oci_bug60994 (id NUMBER, data CLOB, data2 NCLOB)');
$id = null;
$insert = $dbh->prepare('INSERT INTO pdo_oci_bug60994 (id, data, data2) VALUES (:id, :data, :data2)');
$insert->bindParam(':id', $id, \PDO::PARAM_STR);
$select = $dbh->prepare("SELECT data, data2 FROM pdo_oci_bug60994 WHERE id = :id");
echo PHP_EOL, 'Test 1: j', PHP_EOL;
$string1 = 'abc' . str_repeat('j', 8187) . 'xyz'; // 8193 chars total works fine here (even 1 million works fine, subject to memory_limit)
$id = 1;
$insert->bindParam(':data', $string1, \PDO::PARAM_STR, strlen($string1)); // length in bytes
$insert->bindParam(':data2', $string1, \PDO::PARAM_STR, strlen($string1));
$insert->execute();
$select->bindParam(':id', $id, \PDO::PARAM_STR);
$select->execute();
$row = $select->fetch();
$stream1 = stream_get_contents($row['DATA']);
$start1 = mb_substr($stream1, 0, 10);
$ending1 = mb_substr($stream1, -10);
echo 'size of string1 is ', strlen($string1), ' bytes, ', mb_strlen($string1), ' chars.', PHP_EOL;
echo 'size of stream1 is ', strlen($stream1), ' bytes, ', mb_strlen($stream1), ' chars.', PHP_EOL;
echo 'beg of stream1 is ', $start1, PHP_EOL;
echo 'end of stream1 is ', $ending1, PHP_EOL;
if ($string1 != $stream1 || $stream1 != stream_get_contents($row['DATA2'])) {
echo 'Expected nclob value to match clob value for stream1', PHP_EOL;
}
echo PHP_EOL, 'Test 2: £', PHP_EOL;
$string2 = 'abc' . str_repeat('£', 8187) . 'xyz'; // 8193 chars total is when it breaks
$id = 2;
$insert->bindParam(':data', $string2, \PDO::PARAM_STR, strlen($string2)); // length in bytes
$insert->bindParam(':data2', $string2, \PDO::PARAM_STR, strlen($string2));
$insert->execute();
$select->bindParam(':id', $id, \PDO::PARAM_STR);
$select->execute();
$row = $select->fetch();
$stream2 = stream_get_contents($row['DATA']);
$start2 = mb_substr($stream2, 0, 10);
$ending2 = mb_substr($stream2, -10);
echo 'size of string2 is ', strlen($string2), ' bytes, ', mb_strlen($string2), ' chars.', PHP_EOL;
echo 'size of stream2 is ', strlen($stream2), ' bytes, ', mb_strlen($stream2), ' chars.', PHP_EOL;
echo 'beg of stream2 is ', $start2, PHP_EOL;
echo 'end of stream2 is ', $ending2, PHP_EOL;
if ($string2 != $stream2 || $stream2 != stream_get_contents($row['DATA2'])) {
echo 'Expected nclob value to match clob value for stream2', PHP_EOL;
}
echo PHP_EOL, 'Test 3: Җ', PHP_EOL;
$string3 = 'abc' . str_repeat('Җ', 8187) . 'xyz'; // 8193 chars total is when it breaks
$id = 3;
$insert->bindParam(':data', $string3, \PDO::PARAM_STR, strlen($string3)); // length in bytes
$insert->bindParam(':data2', $string3, \PDO::PARAM_STR, strlen($string3));
$insert->execute();
$select->bindParam(':id', $id, \PDO::PARAM_STR);
$select->execute();
$row = $select->fetch();
$stream3 = stream_get_contents($row['DATA']);
$start3 = mb_substr($stream3, 0, 10);
$ending3 = mb_substr($stream3, -10);
echo 'size of string3 is ', strlen($string3), ' bytes, ', mb_strlen($string3), ' chars.', PHP_EOL;
echo 'size of stream3 is ', strlen($stream3), ' bytes, ', mb_strlen($stream3), ' chars.', PHP_EOL;
echo 'beg of stream3 is ', $start3, PHP_EOL;
echo 'end of stream3 is ', $ending3, PHP_EOL;
if ($string3 != $stream3 || $stream3 != stream_get_contents($row['DATA2'])) {
echo 'Expected nclob value to match clob value for stream3', PHP_EOL;
}
echo PHP_EOL, 'Test 4: の', PHP_EOL;
$string4 = 'abc' . str_repeat('の', 8187) . 'xyz'; // 8193 chars total is when it breaks
$id = 4;
$insert->bindParam(':data', $string4, \PDO::PARAM_STR, strlen($string4)); // length in bytes
$insert->bindParam(':data2', $string4, \PDO::PARAM_STR, strlen($string4));
$insert->execute();
$select->bindParam(':id', $id, \PDO::PARAM_STR);
$select->execute();
$row = $select->fetch();
$stream4 = stream_get_contents($row['DATA']);
$start4 = mb_substr($stream4, 0, 10);
$ending4 = mb_substr($stream4, -10);
echo 'size of string4 is ', strlen($string4), ' bytes, ', mb_strlen($string4), ' chars.', PHP_EOL;
echo 'size of stream4 is ', strlen($stream4), ' bytes, ', mb_strlen($stream4), ' chars.', PHP_EOL;
echo 'beg of stream4 is ', $start4, PHP_EOL;
echo 'end of stream4 is ', $ending4, PHP_EOL;
if ($string4 != $stream4 || $stream4 != stream_get_contents($row['DATA2'])) {
echo 'Expected nclob value to match clob value for stream4', PHP_EOL;
}
?>
--CLEAN--
<?php
require_once(getenv('PDO_TEST_DIR').'/pdo_test.inc');
$db = PDOTest::test_factory(getenv('PDO_OCI_TEST_DIR').'/common.phpt');
$db->exec("begin
execute immediate 'drop table pdo_oci_bug60994';
exception when others then
if sqlcode <> -942 then
raise;
end if;
end;");
?>
--EXPECT--
Test 1: j
size of string1 is 8193 bytes, 8193 chars.
size of stream1 is 8193 bytes, 8193 chars.
beg of stream1 is abcjjjjjjj
end of stream1 is jjjjjjjxyz
Test 2: £
size of string2 is 16380 bytes, 8193 chars.
size of stream2 is 16380 bytes, 8193 chars.
beg of stream2 is abc£££££££
end of stream2 is £££££££xyz
Test 3: Җ
size of string3 is 16380 bytes, 8193 chars.
size of stream3 is 16380 bytes, 8193 chars.
beg of stream3 is abcҖҖҖҖҖҖҖ
end of stream3 is ҖҖҖҖҖҖҖxyz
Test 4: の
size of string4 is 24567 bytes, 8193 chars.
size of stream4 is 24567 bytes, 8193 chars.
beg of stream4 is abcののののののの
end of stream4 is のののののののxyz
PK �C�\��9� � tests/pdo_oci_templob_1.phptnu �[��� --TEST--
PDO OCI: Test to verify all implicitly created temporary LOB are cleaned up
--EXTENSIONS--
pdo
pdo_oci
--SKIPIF--
<?php
require(getenv('PDO_TEST_DIR').'/pdo_test.inc');
PDOTest::skip();
?>
--FILE--
<?PHP
require_once(getenv('PDO_TEST_DIR').'/pdo_test.inc');
$db = PDOTest::test_factory(getenv('PDO_OCI_TEST_DIR').'/common.phpt');
$clobquery1 = "select TO_CLOB('Hello World') CLOB_DATA from dual";
$clobquery2 = "select TO_CLOB('Hello World') CLOB_DATA from dual";
$clobquery3 = "select TO_CLOB('Hello World') CLOB_DATA from dual";
$clobquery4 = "select TO_CLOB('Hello World') CLOB_DATA from dual";
$clobquery5 = "select TO_CLOB('Hello World') CLOB_DATA from dual";
$clobquery6 = "select TO_CLOB('Hello World') CLOB_DATA from dual";
$clobquery7 = "select TO_CLOB('Hello World') CLOB_DATA from dual";
$clobquery8 = "select TO_CLOB('Hello World') CLOB_DATA from dual";
$clobquery9 = "select TO_CLOB('Hello World') CLOB_DATA from dual";
$clobquery10 = "select TO_CLOB('Hello World') CLOB_DATA from dual";
$stmt= $db->prepare($clobquery1);
$stmt->execute();
$row = $stmt->fetch();
$stmt= $db->prepare($clobquery2);
$stmt->execute();
$row = $stmt->fetch();
$stmt= $db->prepare($clobquery3);
$stmt->execute();
$row = $stmt->fetch();
$stmt= $db->prepare($clobquery4);
$stmt->execute();
$row = $stmt->fetch();
$stmt= $db->prepare($clobquery5);
$stmt->execute();
$row = $stmt->fetch();
$stmt= $db->prepare($clobquery6);
$stmt->execute();
$row = $stmt->fetch();
$stmt= $db->prepare($clobquery7);
$stmt->execute();
$row = $stmt->fetch();
$stmt= $db->prepare($clobquery8);
$stmt->execute();
$row = $stmt->fetch();
$stmt= $db->prepare($clobquery9);
$stmt->execute();
$row = $stmt->fetch();
$stmt= $db->prepare($clobquery10);
$stmt->execute();
$row = $stmt->fetch();
$query1 = "SELECT SYS_CONTEXT('USERENV', 'SID') SID FROM DUAL";
$stmt1 = $db->prepare($query1);
$stmt1->execute();
$row1 = $stmt1->fetch();
$sid_value = $row1[0];
$query2 = "SELECT (CACHE_LOBS+NOCACHE_LOBS+ABSTRACT_LOBS) FROM V\$TEMPORARY_LOBS WHERE SID = :SID_VALUE";
$stmt2 = $db->prepare($query2);
$stmt2->bindParam(':SID_VALUE', $sid_value);
$stmt2->execute();
$row2 = $stmt2->fetch();
/* 1 temporary LOB still exists in V$TEMPORARY_LOBS since the destructor of $stmt is not yet called by PHP */
if ($row2[0] > 1)
{
echo "TEMP_LOB is not yet cleared!" . $row2[0] . "\n";
}
else
{
echo "Success! All the temporary LOB in previously closed statements are properly cleaned.\n";
}
?>
--EXPECT--
Success! All the temporary LOB in previously closed statements are properly cleaned.
PK �C�\s� � # tests/pdo_oci_attr_client_info.phptnu �[��� --TEST--
PDO_OCI: Attribute: Setting session client info
--EXTENSIONS--
pdo
pdo_oci
--SKIPIF--
<?php
require(getenv('PDO_TEST_DIR').'/pdo_test.inc');
PDOTest::skip();
?>
--FILE--
<?php
require_once(getenv('PDO_TEST_DIR').'/pdo_test.inc');
$query = 'select client_info from v$session where sid = sys_context(\'USERENV\', \'SID\')';
$dbh = PDOTest::factory();
$stmt = $dbh->query($query);
$row = $stmt->fetch();
echo 'CLIENT_INFO NOT SET: ';
var_dump($row['client_info']);
var_dump($dbh->setAttribute(PDO::OCI_ATTR_CLIENT_INFO, "some client info"));
$stmt = $dbh->query($query);
$row = $stmt->fetch();
echo 'CLIENT_INFO SET: ';
var_dump($row['client_info']);
var_dump($dbh->setAttribute(PDO::OCI_ATTR_CLIENT_INFO, "something else!"));
$stmt = $dbh->query($query);
$row = $stmt->fetch();
echo 'CLIENT_INFO RESET: ';
var_dump($row['client_info']);
var_dump($dbh->setAttribute(PDO::OCI_ATTR_CLIENT_INFO, null));
$stmt = $dbh->query($query);
$row = $stmt->fetch();
echo 'CLIENT_INFO NULLED: ';
var_dump($row['client_info']);
echo "Done\n";
?>
--EXPECT--
CLIENT_INFO NOT SET: NULL
bool(true)
CLIENT_INFO SET: string(16) "some client info"
bool(true)
CLIENT_INFO RESET: string(15) "something else!"
bool(true)
CLIENT_INFO NULLED: NULL
Done
PK �C�\2��� � tests/pdo_oci_phpinfo.phptnu �[��� --TEST--
PDO_OCI: phpinfo() output
--EXTENSIONS--
pdo
pdo_oci
--SKIPIF--
<?php
require(getenv('PDO_TEST_DIR').'/pdo_test.inc');
PDOTest::skip();
?>
--FILE--
<?php
require_once(getenv('PDO_TEST_DIR').'/pdo_test.inc');
$db = PDOTest::factory();
ob_start();
phpinfo();
$tmp = ob_get_contents();
ob_end_clean();
$reg = 'PDO Driver for OCI 8 and later => enabled';
if (!preg_match("/$reg/", $tmp)) {
printf("[001] Cannot find OCI PDO driver line in phpinfo() output\n");
}
print "done!";
?>
--EXPECT--
done!
PK �C�\,�� $ tests/pdo_oci_attr_autocommit_2.phptnu �[��� --TEST--
PDO_OCI: Attribute: beginTransaction and native transactions
--EXTENSIONS--
pdo
pdo_oci
--SKIPIF--
<?php
require(getenv('PDO_TEST_DIR').'/pdo_test.inc');
PDOTest::skip();
?>
--FILE--
<?php
require_once(getenv('PDO_TEST_DIR').'/pdo_test.inc');
$dbh = PDOTest::factory();
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$dbh->exec("begin
execute immediate 'drop table test_pdo_oci_attr_autocommit_2';
exception when others then
if sqlcode <> -942 then
raise;
end if;
end;");
$dbh->exec("create table test_pdo_oci_attr_autocommit_2 (col1 varchar2(25))");
echo "Test 1 Check beginTransaction insertion\n";
$dbh->beginTransaction();
try {
$dbh->exec("insert into test_pdo_oci_attr_autocommit_2 (col1) values ('data 1')");
$dbh->exec("insert into test_pdo_oci_attr_autocommit_2 (col1) values ('data 2')");
$dbh->commit();
}
catch (PDOException $e) {
echo "Caught unexpected exception at line " . __LINE__ . "\n";
echo $e->getMessage() . "\n";
$dbh->rollback();
}
echo "Test 2 Cause an exception and test beginTransaction rollback\n";
$dbh->beginTransaction();
try {
$dbh->exec("insert into test_pdo_oci_attr_autocommit_2 (col1) values ('not committed #1')");
$dbh->exec("insert into test_pdo_oci_attr_autocommit_2 (col1) values ('data that is too long to fit and will barf')");
$dbh->commit();
}
catch (PDOException $e) {
echo "Caught expected exception at line " . __LINE__ . "\n";
echo $e->getMessage() . "\n";
$dbh->rollback();
}
echo "Test 3 Setting ATTR_AUTOCOMMIT to true will commit and end the transaction\n";
$dbh->exec("insert into test_pdo_oci_attr_autocommit_2 (col1) values ('data 3')");
$dbh->setAttribute(PDO::ATTR_AUTOCOMMIT, true);
print "PDO::ATTR_AUTOCOMMIT: ";
var_dump($dbh->getAttribute(PDO::ATTR_AUTOCOMMIT));
try {
$dbh->rollback();
}
catch (PDOException $e) {
echo "Caught expected exception at line " . __LINE__ . "\n";
echo $e->getMessage() . "\n";
}
echo "Test 4 Setting ATTR_AUTOCOMMIT to false will commit and end the transaction\n";
$dbh->beginTransaction();
$dbh->exec("insert into test_pdo_oci_attr_autocommit_2 (col1) values ('data 4')");
$dbh->setAttribute(PDO::ATTR_AUTOCOMMIT, false);
print "PDO::ATTR_AUTOCOMMIT: ";
var_dump($dbh->getAttribute(PDO::ATTR_AUTOCOMMIT));
try {
$dbh->rollback();
}
catch (PDOException $e) {
echo "Caught expected exception at line " . __LINE__ . "\n";
echo $e->getMessage() . "\n";
}
echo "Test 5 Handle transactions ourselves\n";
print "PDO::ATTR_AUTOCOMMIT: ";
var_dump($dbh->getAttribute(PDO::ATTR_AUTOCOMMIT));
$dbh->exec("insert into test_pdo_oci_attr_autocommit_2 (col1) values ('not committed #2')");
$dbh->exec("rollback");
$dbh->exec("insert into test_pdo_oci_attr_autocommit_2 (col1) values ('data 5')");
$dbh->exec("insert into test_pdo_oci_attr_autocommit_2 (col1) values ('data 6')");
$dbh->exec("commit");
// Open new connection to really verify what was inserted
$dbh2 = PDOTest::factory();
echo "Query Results are:\n";
$s = $dbh2->prepare("select col1 from test_pdo_oci_attr_autocommit_2");
$s->execute();
while ($r = $s->fetch()) {
echo $r[0] . "\n";
}
echo "Done\n";
?>
--CLEAN--
<?php
require_once(getenv('PDO_TEST_DIR').'/pdo_test.inc');
$db = PDOTest::test_factory(getenv('PDO_OCI_TEST_DIR').'/common.phpt');
$db->exec("begin
execute immediate 'drop table test_pdo_oci_attr_autocommit_2';
exception when others then
if sqlcode <> -942 then
raise;
end if;
end;");
?>
--EXPECTF--
Test 1 Check beginTransaction insertion
Test 2 Cause an exception and test beginTransaction rollback
Caught expected exception at line %d
SQLSTATE[HY000]: General error: 12899 OCIStmtExecute: ORA-12899: %s
%s
Test 3 Setting ATTR_AUTOCOMMIT to true will commit and end the transaction
PDO::ATTR_AUTOCOMMIT: bool(true)
Caught expected exception at line %d
There is no active transaction
Test 4 Setting ATTR_AUTOCOMMIT to false will commit and end the transaction
PDO::ATTR_AUTOCOMMIT: bool(false)
Caught expected exception at line %d
There is no active transaction
Test 5 Handle transactions ourselves
PDO::ATTR_AUTOCOMMIT: bool(false)
Query Results are:
data 1
data 2
data 3
data 4
data 5
data 6
Done
PK �C�\Mۀ� � tests/checkliveness.phptnu �[��� --TEST--
PDO OCI checkliveness (code coverage)
--EXTENSIONS--
pdo
pdo_oci
--SKIPIF--
<?php
require(getenv('PDO_TEST_DIR').'/pdo_test.inc');
PDOTest::skip();
?>
--FILE--
<?php
require_once(getenv('PDO_TEST_DIR').'/pdo_test.inc');
$db = PDOTest::test_factory(getenv('PDO_OCI_TEST_DIR').'/common.phpt');
$dsn = getenv('PDOTEST_DSN');
$user = getenv('PDOTEST_USER');
$pass = getenv('PDOTEST_PASS');
$attr = getenv('PDOTEST_ATTR');
try {
$db = new PDO($dsn, $user, $pass, array(PDO::ATTR_PERSISTENT => true));
}
catch (PDOException $e) {
echo 'Connection failed: ' . $e->getMessage();
exit;
}
// This triggers the call to check liveness
try {
$db = new PDO($dsn, $user, $pass, array(PDO::ATTR_PERSISTENT => true));
}
catch (PDOException $e) {
echo 'Connection failed: ' . $e->getMessage();
exit;
}
$db->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
try {
$stmt = $db->prepare('SELECT * FROM dual');
$stmt->execute();
$row = $stmt->fetch();
var_dump($row);
} catch (PDOException $e) {
print $e->getMessage();
}
$db = null;
?>
--EXPECT--
array(2) {
["DUMMY"]=>
string(1) "X"
[0]=>
string(1) "X"
}
PK �C�\Q�l�/ / tests/pdo_oci_attr_case.phptnu �[��� --TEST--
PDO_OCI: Attribute: Column Case
--EXTENSIONS--
pdo
pdo_oci
--SKIPIF--
<?php
require(getenv('PDO_TEST_DIR').'/pdo_test.inc');
PDOTest::skip();
?>
--FILE--
<?php
require_once(getenv('PDO_TEST_DIR').'/pdo_test.inc');
function do_query1($dbh)
{
var_dump($dbh->getAttribute(PDO::ATTR_CASE));
$s = $dbh->prepare("select dummy from dual");
$s->execute();
while ($r = $s->fetch(PDO::FETCH_ASSOC)) {
var_dump($r);
}
}
function do_query2($dbh, $mode)
{
echo "Mode desired is $mode\n";
$s = $dbh->prepare("select dummy from dual", array(PDO::ATTR_CASE, $mode));
$s->execute();
while ($r = $s->fetch(PDO::FETCH_ASSOC)) {
var_dump($r);
}
}
$dbh = PDOTest::factory();
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
echo "Test 1 - Force column names to lower case\n";
$dbh->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER);
do_query1($dbh);
echo "Test 2 - Leave column names as returned by the database driver\n";
$dbh->setAttribute(PDO::ATTR_CASE, PDO::CASE_NATURAL);
do_query1($dbh);
echo "Test 3 - Force column names to upper case\n";
$dbh->setAttribute(PDO::ATTR_CASE, PDO::CASE_UPPER);
do_query1($dbh);
echo "Test 4 - Setting on statement has no effect. Attempt lower case but get upper\n";
$dbh->setAttribute(PDO::ATTR_CASE, PDO::CASE_NATURAL); // reset
do_query2($dbh, PDO::CASE_LOWER);
echo "Done\n";
?>
--EXPECT--
Test 1 - Force column names to lower case
int(2)
array(1) {
["dummy"]=>
string(1) "X"
}
Test 2 - Leave column names as returned by the database driver
int(0)
array(1) {
["DUMMY"]=>
string(1) "X"
}
Test 3 - Force column names to upper case
int(1)
array(1) {
["DUMMY"]=>
string(1) "X"
}
Test 4 - Setting on statement has no effect. Attempt lower case but get upper
Mode desired is 2
array(1) {
["DUMMY"]=>
string(1) "X"
}
Done
PK �C�\i_� $ tests/pdo_oci_attr_autocommit_3.phptnu �[��� --TEST--
PDO_OCI: Attribute: closing a connection in non-autocommit mode commits data
--EXTENSIONS--
pdo
pdo_oci
--SKIPIF--
<?php
require(getenv('PDO_TEST_DIR').'/pdo_test.inc');
PDOTest::skip();
?>
--FILE--
<?php
require_once(getenv('PDO_TEST_DIR').'/pdo_test.inc');
// Check connection can be created with AUTOCOMMIT off
putenv('PDOTEST_ATTR='.serialize(array(PDO::ATTR_AUTOCOMMIT=>false)));
$dbh = PDOTest::factory();
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
print "PDO::ATTR_AUTOCOMMIT: ";
var_dump($dbh->getAttribute(PDO::ATTR_AUTOCOMMIT));
echo "Insert data\n";
$dbh->exec("begin
execute immediate 'drop table test_pdo_oci_attr_autocommit_3';
exception when others then
if sqlcode <> -942 then
raise;
end if;
end;");
$dbh->exec("create table test_pdo_oci_attr_autocommit_3 (col1 varchar2(20))");
$dbh->exec("insert into test_pdo_oci_attr_autocommit_3 (col1) values ('some data')");
$dbh = null; // close first connection
echo "Second connection should be able to see committed data\n";
$dbh2 = PDOTest::factory();
$s = $dbh2->prepare("select col1 from test_pdo_oci_attr_autocommit_3");
$s->execute();
while ($r = $s->fetch()) {
echo "Data is: " . $r[0] . "\n";
}
echo "Done\n";
?>
--CLEAN--
<?php
require_once(getenv('PDO_TEST_DIR').'/pdo_test.inc');
$db = PDOTest::test_factory(getenv('PDO_OCI_TEST_DIR').'/common.phpt');
$db->exec("begin
execute immediate 'drop table test_pdo_oci_attr_autocommit_3';
exception when others then
if sqlcode <> -942 then
raise;
end if;
end;");
?>
--EXPECT--
PDO::ATTR_AUTOCOMMIT: bool(false)
Insert data
Second connection should be able to see committed data
Done
PK �C�\P���W W tests/bug46274_2.phptnu �[��� --TEST--
Bug #46274 (pdo_pgsql - Segfault when using PDO::ATTR_STRINGIFY_FETCHES and blob)
--EXTENSIONS--
pdo
pdo_oci
--SKIPIF--
<?php
require(getenv('PDO_TEST_DIR').'/pdo_test.inc');
PDOTest::skip();
?>
--FILE--
<?php
require_once(getenv('PDO_TEST_DIR').'/pdo_test.inc');
$db = PDOTest::test_factory(getenv('PDO_OCI_TEST_DIR').'/common.phpt');
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false);
$db->exec("begin
execute immediate 'drop table test46274_2';
exception when others then
if sqlcode <> -942 then
raise;
end if;
end;");
$db->beginTransaction();
$db->query('CREATE TABLE test46274_2 (id INT NOT NULL, blob1 BLOB)');
$stmt = $db->prepare("INSERT INTO test46274_2 (id, blob1) VALUES (:id, EMPTY_BLOB()) RETURNING blob1 INTO :foo");
$data = 'foo';
$blob = fopen('php://memory', 'a');
fwrite($blob, $data);
rewind($blob);
$id = 1;
$stmt->bindparam(':id', $id);
$stmt->bindparam(':foo', $blob, PDO::PARAM_LOB);
$stmt->execute();
$data = '';
$blob = fopen('php://memory', 'a');
fwrite($blob, $data);
rewind($blob);
$id = 1;
$stmt->bindparam(':id', $id);
$stmt->bindparam(':foo', $blob, PDO::PARAM_LOB);
$stmt->execute();
$res = $db->query("SELECT blob1 from test46274_2");
// Resource
var_dump($row = $res->fetch());
var_dump(fread($row[0], 1024));
fclose($row[0]);
// Empty string
var_dump($row = $res->fetch());
var_dump(fread($row[0], 1024));
fclose($row[0]);
?>
--CLEAN--
<?php
require_once(getenv('PDO_TEST_DIR').'/pdo_test.inc');
$db = PDOTest::test_factory(getenv('PDO_OCI_TEST_DIR').'/common.phpt');
$db->exec("begin
execute immediate 'drop table test46274_2';
exception when others then
if sqlcode <> -942 then
raise;
end if;
end;");
?>
--EXPECTF--
array(2) {
["blob1"]=>
resource(%d) of type (stream)
[0]=>
resource(%d) of type (stream)
}
string(3) "foo"
array(2) {
["blob1"]=>
resource(%d) of type (stream)
[0]=>
resource(%d) of type (stream)
}
string(0) ""
PK �C�\ u4)a a tests/bug57702.phptnu �[��� --TEST--
PDO OCI Bug #57702 (Multi-row BLOB fetches)
--EXTENSIONS--
pdo
pdo_oci
--SKIPIF--
<?php
require(getenv('PDO_TEST_DIR').'/pdo_test.inc');
PDOTest::skip();
?>
--FILE--
<?php
require_once(getenv('PDO_TEST_DIR').'/pdo_test.inc');
$db = PDOTest::test_factory(getenv('PDO_OCI_TEST_DIR').'/common.phpt');
// Note the PDO test setup sets PDO::ATTR_STRINGIFY_FETCHES to true
// (and sets PDO::ATTR_CASE to PDO::CASE_LOWER)
$db->exec("begin
execute immediate 'drop table test57702';
exception when others then
if sqlcode <> -942 then
raise;
end if;
end;");
$query = "create table test57702 (id number, data1 blob, data2 blob)";
$stmt = $db->prepare($query);
$stmt->execute();
function do_insert($db, $id, $data1, $data2)
{
$db->beginTransaction();
$stmt = $db->prepare("insert into test57702 (id, data1, data2) values (:id, empty_blob(), empty_blob()) returning data1, data2 into :blob1, :blob2");
$stmt->bindParam(':id', $id);
$stmt->bindParam(':blob1', $blob1, PDO::PARAM_LOB);
$stmt->bindParam(':blob2', $blob2, PDO::PARAM_LOB);
$blob1 = null;
$blob2 = null;
$stmt->execute();
fwrite($blob1, $data1);
fclose($blob1);
fwrite($blob2, $data2);
fclose($blob2);
$db->commit();
}
do_insert($db, 1, "row 1 col 1", "row 1 col 2");
do_insert($db, 2, "row 2 col 1", "row 2 col 2");
////////////////////
echo "First Query\n";
// Fetch it back
$stmt = $db->prepare('select data1, data2 from test57702 order by id');
$stmt->execute();
$row = $stmt->fetch(PDO::FETCH_ASSOC);
var_dump($row['data1']);
var_dump($row['data2']);
$row = $stmt->fetch(PDO::FETCH_ASSOC);
var_dump($row['data1']);
var_dump($row['data2']);
////////////////////
echo "\nSecond Query\n";
foreach($db->query("select data1 as d1, data2 as d2 from test57702 order by id") as $row) {
var_dump($row['d1']);
var_dump($row['d2']);
}
////////////////////
echo "\nThird Query\n";
$stmt = $db->prepare('select data1 as d3_1, data2 as d3_2 from test57702 order by id');
$rs = $stmt->execute();
$stmt->bindColumn('d3_1' , $clob1, PDO::PARAM_LOB);
$stmt->bindColumn('d3_2' , $clob2, PDO::PARAM_LOB);
while ($stmt->fetch(PDO::FETCH_BOUND)) {
var_dump($clob1);
var_dump($clob2);
}
////////////////////
echo "\nFourth Query\n";
$a = array();
$i = 0;
foreach($db->query("select data1 as d4_1, data2 as d4_2 from test57702 order by id") as $row) {
$a[$i][0] = $row['d4_1'];
$a[$i][1] = $row['d4_2'];
$i++;
}
for ($i = 0; $i < count($a); $i++) {
var_dump($a[$i][0]);
var_dump($a[$i][1]);
}
////////////////////
echo "\nFifth Query\n";
$db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false); // Let's use streams
// Since each column only has one lob descriptor, the last row is
// shown twice because the lob descriptor for each column is reused in
// the stream
$a = array();
$i = 0;
foreach($db->query("select data1 as d4_1, data2 as d4_2 from test57702 order by id") as $row) {
$a[$i][0] = $row['d4_1'];
$a[$i][1] = $row['d4_2'];
$i++;
}
for ($i = 0; $i < count($a); $i++) {
var_dump(stream_get_contents($a[$i][0]));
var_dump(stream_get_contents($a[$i][1]));
}
////////////////////
echo "\nSixth Query\n";
$db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false); // Let's use streams
$a = array();
$i = 0;
foreach($db->query("select data1 as d4_1, data2 as d4_2 from test57702 order by id") as $row) {
$a[$i][0] = $row['d4_1'];
$a[$i][1] = $row['d4_2'];
var_dump(stream_get_contents($a[$i][0]));
var_dump(stream_get_contents($a[$i][1]));
$i++;
}
print "done\n";
?>
--CLEAN--
<?php
require(getenv('PDO_TEST_DIR').'/pdo_test.inc');
$db = PDOTest::test_factory(getenv('PDO_OCI_TEST_DIR').'/common.phpt');
$db->exec("begin
execute immediate 'drop table test57702';
exception when others then
if sqlcode <> -942 then
raise;
end if;
end;");
?>
--EXPECT--
First Query
string(11) "row 1 col 1"
string(11) "row 1 col 2"
string(11) "row 2 col 1"
string(11) "row 2 col 2"
Second Query
string(11) "row 1 col 1"
string(11) "row 1 col 2"
string(11) "row 2 col 1"
string(11) "row 2 col 2"
Third Query
string(11) "row 1 col 1"
string(11) "row 1 col 2"
string(11) "row 2 col 1"
string(11) "row 2 col 2"
Fourth Query
string(11) "row 1 col 1"
string(11) "row 1 col 2"
string(11) "row 2 col 1"
string(11) "row 2 col 2"
Fifth Query
string(11) "row 2 col 1"
string(11) "row 2 col 2"
string(11) "row 2 col 1"
string(11) "row 2 col 2"
Sixth Query
string(11) "row 1 col 1"
string(11) "row 1 col 2"
string(11) "row 2 col 1"
string(11) "row 2 col 2"
done
PK �C�\�*�� � tests/bug44301.phptnu �[��� --TEST--
PDO OCI Bug #44301 (Segfault when an exception is thrown on persistent connections)
--EXTENSIONS--
pdo
pdo_oci
--SKIPIF--
<?php
require(getenv('PDO_TEST_DIR').'/pdo_test.inc');
PDOTest::skip();
?>
--FILE--
<?php
putenv("PDO_OCI_TEST_ATTR=" . serialize(array(PDO::ATTR_PERSISTENT => true)));
require(getenv('PDO_TEST_DIR').'/pdo_test.inc');
$db = PDOTest::test_factory(getenv('PDO_OCI_TEST_DIR').'/common.phpt');
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
try {
$stmt = $db->prepare('SELECT * FROM no_table');
$stmt->execute();
} catch (PDOException $e) {
print $e->getMessage();
}
$db = null;
?>
--EXPECTF--
SQLSTATE[HY000]: General error: 942 OCIStmtExecute: ORA-00942: table or view %Sdoes not exist
(%soci_statement.c:%d)
PK �C�\���� � tests/pdo_oci_attr_client.phptnu �[��� --TEST--
PDO_OCI: Attribute: Client version
--EXTENSIONS--
pdo
pdo_oci
--SKIPIF--
<?php
require(getenv('PDO_TEST_DIR').'/pdo_test.inc');
PDOTest::skip();
--FILE--
<?php
require_once(getenv('PDO_TEST_DIR').'/pdo_test.inc');
$dbh = PDOTest::factory();
echo "ATTR_CLIENT_VERSION: ";
$cv = $dbh->getAttribute(PDO::ATTR_CLIENT_VERSION);
var_dump($cv);
$s = explode(".", $cv);
if (count($s) > 1 && (($s[0] == 10 && $s[1] >= 2) || $s[0] >= 11)) {
if (count($s) != 5) {
echo "Wrong number of values in array\nVersion was: ";
var_dump($cv);
} else {
echo "Version OK, so far as can be portably checked\n";
}
} else {
if (count($s) != 2) {
echo "Wrong number of values in array\nVersion was: ";
var_dump($cv);
} else {
echo "Version OK, so far as can be portably checked\n";
}
}
echo "Done\n";
?>
--EXPECTF--
ATTR_CLIENT_VERSION: string(%d) "%d.%s"
Version OK, so far as can be portably checked
Done
PK �C�\0��� � tests/pdo_oci_fread_1.phptnu �[��� --TEST--
PDO_OCI: check fread() EOF
--EXTENSIONS--
pdo
pdo_oci
--SKIPIF--
<?php
require(getenv('PDO_TEST_DIR').'/pdo_test.inc');
if (!strpos(strtolower(getenv('PDOTEST_DSN')), 'charset=we8mswin1252')) die('skip expected output valid for WE8MSWIN1252 character set');
PDOTest::skip();
?>
--FILE--
<?php
require_once(getenv('PDO_TEST_DIR').'/pdo_test.inc');
$dbh = PDOTest::factory();
$dbh->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false);
// Initialization
$stmtarray = array(
"begin
execute immediate 'drop table test_oci_fread_1';
exception when others then
if sqlcode <> -942 then
raise;
end if;
end;",
"create table test_oci_fread_1 (id number, data clob)",
"declare
lob1 clob := 'abc' || lpad('j',4020,'j') || 'xyz';
begin
insert into test_oci_fread_1 (id,data) values (1, lob1);
end;"
);
foreach ($stmtarray as $stmt) {
$dbh->exec($stmt);
}
echo "Test 1\n";
$s = $dbh->query("select data from test_oci_fread_1 where id = 1");
$r = $s->fetch();
$sh = $r['data'];
while (!feof($sh)) {
$buffer = fread($sh,1024);
echo '*'.$buffer.'*';
}
echo "\n";
fclose($sh);
?>
--CLEAN--
<?php
require_once(getenv('PDO_TEST_DIR').'/pdo_test.inc');
$db = PDOTest::test_factory(getenv('PDO_OCI_TEST_DIR').'/common.phpt');
$db->exec("begin
execute immediate 'drop table test_oci_fread_1';
exception when others then
if sqlcode <> -942 then
raise;
end if;
end;");
?>
--EXPECT--
Test 1
*abcjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj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