xref: /PHP-5.5/ext/oci8/tests/bug43492_2.phpt (revision e9a95d78)
1--TEST--
2Bug #43492 (Nested cursor leaks after related bug #44206 fixed)
3--SKIPIF--
4<?php
5$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
6require(dirname(__FILE__).'/skipif.inc');
7?>
8--FILE--
9<?php
10
11// This test is similar to bug43492.phpt without the explicit free.
12// Now that bug 44206 is fixed an automatic clean up will occur -
13// though it is still recommended in practice.
14
15require dirname(__FILE__).'/connect.inc';
16
17$stmtarray = array(
18    "DROP table bug43492_tab",
19    "CREATE TABLE bug43492_tab(col1 VARCHAR2(1))",
20    "INSERT INTO bug43492_tab VALUES ('A')",
21    "INSERT INTO bug43492_tab VALUES ('B')",
22    "INSERT INTO bug43492_tab VALUES ('C')",
23    "INSERT INTO bug43492_tab VALUES ('D')",
24    "INSERT INTO bug43492_tab VALUES ('E')",
25    "INSERT INTO bug43492_tab VALUES ('F')",
26    "INSERT INTO bug43492_tab VALUES ('G')",
27    "INSERT INTO bug43492_tab VALUES ('H')",
28    "INSERT INTO bug43492_tab VALUES ('I')",
29    "INSERT INTO bug43492_tab VALUES ('J')"
30);
31
32oci8_test_sql_execute($c, $stmtarray);
33
34function fetch($c, $i) {
35    $s = ociparse($c, 'select cursor(select * from bug43492_tab) c from bug43492_tab');
36    ociexecute($s, OCI_DEFAULT);
37    ocifetchinto($s, $result, OCI_ASSOC);
38    ociexecute($result['C'], OCI_DEFAULT);
39    return $result['C'];
40}
41
42for($i = 0; $i < 300; $i++) {
43    $cur = fetch($c, $i);
44    for($j = 0; $j < 10; $j++) {
45        ocifetchinto($cur, $row, OCI_NUM);
46        echo "$row[0] ";
47    }
48    echo "\n";
49    ocifreestatement($cur);
50}
51
52echo "Done\n";
53
54// Cleanup
55
56$stmtarray = array(
57    "DROP table bug43492_tab"
58);
59
60oci8_test_sql_execute($c, $stmtarray);
61
62?>
63--EXPECT--
64A B C D E F G H I J
65A B C D E F G H I J
66A B C D E F G H I J
67A B C D E F G H I J
68A B C D E F G H I J
69A B C D E F G H I J
70A B C D E F G H I J
71A B C D E F G H I J
72A B C D E F G H I J
73A B C D E F G H I J
74A B C D E F G H I J
75A B C D E F G H I J
76A B C D E F G H I J
77A B C D E F G H I J
78A B C D E F G H I J
79A B C D E F G H I J
80A B C D E F G H I J
81A B C D E F G H I J
82A B C D E F G H I J
83A B C D E F G H I J
84A B C D E F G H I J
85A B C D E F G H I J
86A B C D E F G H I J
87A B C D E F G H I J
88A B C D E F G H I J
89A B C D E F G H I J
90A B C D E F G H I J
91A B C D E F G H I J
92A B C D E F G H I J
93A B C D E F G H I J
94A B C D E F G H I J
95A B C D E F G H I J
96A B C D E F G H I J
97A B C D E F G H I J
98A B C D E F G H I J
99A B C D E F G H I J
100A B C D E F G H I J
101A B C D E F G H I J
102A B C D E F G H I J
103A B C D E F G H I J
104A B C D E F G H I J
105A B C D E F G H I J
106A B C D E F G H I J
107A B C D E F G H I J
108A B C D E F G H I J
109A B C D E F G H I J
110A B C D E F G H I J
111A B C D E F G H I J
112A B C D E F G H I J
113A B C D E F G H I J
114A B C D E F G H I J
115A B C D E F G H I J
116A B C D E F G H I J
117A B C D E F G H I J
118A B C D E F G H I J
119A B C D E F G H I J
120A B C D E F G H I J
121A B C D E F G H I J
122A B C D E F G H I J
123A B C D E F G H I J
124A B C D E F G H I J
125A B C D E F G H I J
126A B C D E F G H I J
127A B C D E F G H I J
128A B C D E F G H I J
129A B C D E F G H I J
130A B C D E F G H I J
131A B C D E F G H I J
132A B C D E F G H I J
133A B C D E F G H I J
134A B C D E F G H I J
135A B C D E F G H I J
136A B C D E F G H I J
137A B C D E F G H I J
138A B C D E F G H I J
139A B C D E F G H I J
140A B C D E F G H I J
141A B C D E F G H I J
142A B C D E F G H I J
143A B C D E F G H I J
144A B C D E F G H I J
145A B C D E F G H I J
146A B C D E F G H I J
147A B C D E F G H I J
148A B C D E F G H I J
149A B C D E F G H I J
150A B C D E F G H I J
151A B C D E F G H I J
152A B C D E F G H I J
153A B C D E F G H I J
154A B C D E F G H I J
155A B C D E F G H I J
156A B C D E F G H I J
157A B C D E F G H I J
158A B C D E F G H I J
159A B C D E F G H I J
160A B C D E F G H I J
161A B C D E F G H I J
162A B C D E F G H I J
163A B C D E F G H I J
164A B C D E F G H I J
165A B C D E F G H I J
166A B C D E F G H I J
167A B C D E F G H I J
168A B C D E F G H I J
169A B C D E F G H I J
170A B C D E F G H I J
171A B C D E F G H I J
172A B C D E F G H I J
173A B C D E F G H I J
174A B C D E F G H I J
175A B C D E F G H I J
176A B C D E F G H I J
177A B C D E F G H I J
178A B C D E F G H I J
179A B C D E F G H I J
180A B C D E F G H I J
181A B C D E F G H I J
182A B C D E F G H I J
183A B C D E F G H I J
184A B C D E F G H I J
185A B C D E F G H I J
186A B C D E F G H I J
187A B C D E F G H I J
188A B C D E F G H I J
189A B C D E F G H I J
190A B C D E F G H I J
191A B C D E F G H I J
192A B C D E F G H I J
193A B C D E F G H I J
194A B C D E F G H I J
195A B C D E F G H I J
196A B C D E F G H I J
197A B C D E F G H I J
198A B C D E F G H I J
199A B C D E F G H I J
200A B C D E F G H I J
201A B C D E F G H I J
202A B C D E F G H I J
203A B C D E F G H I J
204A B C D E F G H I J
205A B C D E F G H I J
206A B C D E F G H I J
207A B C D E F G H I J
208A B C D E F G H I J
209A B C D E F G H I J
210A B C D E F G H I J
211A B C D E F G H I J
212A B C D E F G H I J
213A B C D E F G H I J
214A B C D E F G H I J
215A B C D E F G H I J
216A B C D E F G H I J
217A B C D E F G H I J
218A B C D E F G H I J
219A B C D E F G H I J
220A B C D E F G H I J
221A B C D E F G H I J
222A B C D E F G H I J
223A B C D E F G H I J
224A B C D E F G H I J
225A B C D E F G H I J
226A B C D E F G H I J
227A B C D E F G H I J
228A B C D E F G H I J
229A B C D E F G H I J
230A B C D E F G H I J
231A B C D E F G H I J
232A B C D E F G H I J
233A B C D E F G H I J
234A B C D E F G H I J
235A B C D E F G H I J
236A B C D E F G H I J
237A B C D E F G H I J
238A B C D E F G H I J
239A B C D E F G H I J
240A B C D E F G H I J
241A B C D E F G H I J
242A B C D E F G H I J
243A B C D E F G H I J
244A B C D E F G H I J
245A B C D E F G H I J
246A B C D E F G H I J
247A B C D E F G H I J
248A B C D E F G H I J
249A B C D E F G H I J
250A B C D E F G H I J
251A B C D E F G H I J
252A B C D E F G H I J
253A B C D E F G H I J
254A B C D E F G H I J
255A B C D E F G H I J
256A B C D E F G H I J
257A B C D E F G H I J
258A B C D E F G H I J
259A B C D E F G H I J
260A B C D E F G H I J
261A B C D E F G H I J
262A B C D E F G H I J
263A B C D E F G H I J
264A B C D E F G H I J
265A B C D E F G H I J
266A B C D E F G H I J
267A B C D E F G H I J
268A B C D E F G H I J
269A B C D E F G H I J
270A B C D E F G H I J
271A B C D E F G H I J
272A B C D E F G H I J
273A B C D E F G H I J
274A B C D E F G H I J
275A B C D E F G H I J
276A B C D E F G H I J
277A B C D E F G H I J
278A B C D E F G H I J
279A B C D E F G H I J
280A B C D E F G H I J
281A B C D E F G H I J
282A B C D E F G H I J
283A B C D E F G H I J
284A B C D E F G H I J
285A B C D E F G H I J
286A B C D E F G H I J
287A B C D E F G H I J
288A B C D E F G H I J
289A B C D E F G H I J
290A B C D E F G H I J
291A B C D E F G H I J
292A B C D E F G H I J
293A B C D E F G H I J
294A B C D E F G H I J
295A B C D E F G H I J
296A B C D E F G H I J
297A B C D E F G H I J
298A B C D E F G H I J
299A B C D E F G H I J
300A B C D E F G H I J
301A B C D E F G H I J
302A B C D E F G H I J
303A B C D E F G H I J
304A B C D E F G H I J
305A B C D E F G H I J
306A B C D E F G H I J
307A B C D E F G H I J
308A B C D E F G H I J
309A B C D E F G H I J
310A B C D E F G H I J
311A B C D E F G H I J
312A B C D E F G H I J
313A B C D E F G H I J
314A B C D E F G H I J
315A B C D E F G H I J
316A B C D E F G H I J
317A B C D E F G H I J
318A B C D E F G H I J
319A B C D E F G H I J
320A B C D E F G H I J
321A B C D E F G H I J
322A B C D E F G H I J
323A B C D E F G H I J
324A B C D E F G H I J
325A B C D E F G H I J
326A B C D E F G H I J
327A B C D E F G H I J
328A B C D E F G H I J
329A B C D E F G H I J
330A B C D E F G H I J
331A B C D E F G H I J
332A B C D E F G H I J
333A B C D E F G H I J
334A B C D E F G H I J
335A B C D E F G H I J
336A B C D E F G H I J
337A B C D E F G H I J
338A B C D E F G H I J
339A B C D E F G H I J
340A B C D E F G H I J
341A B C D E F G H I J
342A B C D E F G H I J
343A B C D E F G H I J
344A B C D E F G H I J
345A B C D E F G H I J
346A B C D E F G H I J
347A B C D E F G H I J
348A B C D E F G H I J
349A B C D E F G H I J
350A B C D E F G H I J
351A B C D E F G H I J
352A B C D E F G H I J
353A B C D E F G H I J
354A B C D E F G H I J
355A B C D E F G H I J
356A B C D E F G H I J
357A B C D E F G H I J
358A B C D E F G H I J
359A B C D E F G H I J
360A B C D E F G H I J
361A B C D E F G H I J
362A B C D E F G H I J
363A B C D E F G H I J
364Done
365