Skip to content

Commit 6f30896

Browse files
committed
Merge two dependent tests into one
1 parent 945451a commit 6f30896

File tree

2 files changed

+52
-71
lines changed

2 files changed

+52
-71
lines changed

ext/pdo_oci/tests/pdo_oci_stream_2a.phpt renamed to ext/pdo_oci/tests/pdo_oci_stream_2.phpt

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
--TEST--
2-
PDO OCI: Inserts 1K with 1 number and 2 LOB columns (stress test)
2+
PDO OCI: Insert and fetch 1K records from a table that contains 1 number and 2 LOB columns (stress test)
33
--SKIPIF--
44
<?php
55
if (!extension_loaded('pdo') || !extension_loaded('pdo_oci')) die('skip not loaded');
@@ -69,6 +69,57 @@ printf("Done\n");
6969
/* Cleanup is done in pdo_oci_stream_2b.phpt */
7070
//$db->exec("drop table pdo_oci_stream_2");
7171

72+
$db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false); // Let's use streams
73+
74+
// Since each column only has one lob descriptor, the last row is
75+
// shown twice because the lob descriptor for each column is reused in
76+
// the stream
77+
78+
$i = 0;
79+
$j = 9;
80+
$a_val = ord('a');
81+
foreach($db->query("select data1 as d4_1, data2 as d4_2 from pdo_oci_stream_2 order by id") as $row) {
82+
$a = $row['d4_1'];
83+
$a1 = $row['d4_2'];
84+
85+
$str1 = stream_get_contents($a);
86+
$str2 = stream_get_contents($a1);
87+
88+
$str1len = strlen($str1);
89+
$str2len = strlen($str2);
90+
91+
$b = ord($str1[0]);
92+
$b1 = ord($str2[0]);
93+
94+
if (($b != ($a_val + $i)) && ($str1len != (4086 + $i)) &&
95+
($b1 != ($a_val + $j)) && ($str2len != (4086 + $j))) {
96+
printf("There is a bug!\n");
97+
printf("Col1:\n");
98+
printf("a_val = %d\n", $a_val);
99+
printf("b = %d\n", $b);
100+
printf("i = %d\n", $i);
101+
printf("str1len = %d\n", $str1len);
102+
103+
printf("Col2:\n");
104+
printf("a_val = %d\n", $a_val);
105+
printf("b1 = %d\n", $b1);
106+
printf("j = %d\n", $j);
107+
printf("str2len = %d\n", $str1len);
108+
109+
}
110+
$i++;
111+
if ($i>9)
112+
$i = 0;
113+
$j--;
114+
if ($j<0)
115+
$j = 9;
116+
}
117+
echo "Fetch operation done!\n";
118+
119+
/* Cleanup */
120+
$db->exec("drop table pdo_oci_stream_2");
121+
72122
?>
73123
--EXPECT--
74124
Inserting 1000 Records ... Done
125+
Fetch operation done!

ext/pdo_oci/tests/pdo_oci_stream_2b.phpt

Lines changed: 0 additions & 70 deletions
This file was deleted.

0 commit comments

Comments
 (0)