|
1 | 1 | --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) |
3 | 3 | --SKIPIF--
|
4 | 4 | <?php
|
5 | 5 | if (!extension_loaded('pdo') || !extension_loaded('pdo_oci')) die('skip not loaded');
|
@@ -69,6 +69,57 @@ printf("Done\n");
|
69 | 69 | /* Cleanup is done in pdo_oci_stream_2b.phpt */
|
70 | 70 | //$db->exec("drop table pdo_oci_stream_2");
|
71 | 71 |
|
| 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 | + |
72 | 122 | ?>
|
73 | 123 | --EXPECT--
|
74 | 124 | Inserting 1000 Records ... Done
|
| 125 | +Fetch operation done! |
0 commit comments