xref: /PHP-8.2/ext/oci8/tests/fetch_all2.phpt (revision b5a14e6c)
1--TEST--
2oci_fetch_all() - 2
3--EXTENSIONS--
4oci8
5--SKIPIF--
6<?php
7$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
8require(__DIR__.'/skipif.inc');
9?>
10--FILE--
11<?php
12
13require __DIR__."/connect.inc";
14require __DIR__.'/create_table.inc';
15
16$insert_sql = "INSERT INTO ".$schema."".$table_name." (id, value) VALUES (1,1)";
17
18$s = oci_parse($c, $insert_sql);
19
20for ($i = 0; $i<3; $i++) {
21    oci_execute($s);
22}
23
24oci_commit($c);
25
26$select_sql = "SELECT * FROM ".$schema."".$table_name."";
27
28$s = oci_parse($c, $select_sql);
29
30oci_execute($s);
31var_dump(oci_fetch_all($s, $all));
32var_dump($all);
33
34oci_execute($s);
35var_dump(oci_fetch_all($s, $all, 0, 10, OCI_FETCHSTATEMENT_BY_ROW));
36var_dump($all);
37
38oci_execute($s);
39var_dump(oci_fetch_all($s, $all, -1, -1, OCI_FETCHSTATEMENT_BY_ROW));
40var_dump($all);
41
42oci_execute($s);
43var_dump(oci_fetch_all($s, $all, 0, 2, OCI_FETCHSTATEMENT_BY_ROW+OCI_NUM));
44var_dump($all);
45
46oci_execute($s);
47var_dump(oci_fetch_all($s, $all, 0, 2, OCI_NUM));
48var_dump($all);
49
50oci_execute($s);
51var_dump(oci_fetch_all($s, $all, 0, 1, OCI_BOTH));
52var_dump($all);
53
54require __DIR__.'/drop_table.inc';
55
56echo "Done\n";
57?>
58--EXPECT--
59int(3)
60array(5) {
61  ["ID"]=>
62  array(3) {
63    [0]=>
64    string(1) "1"
65    [1]=>
66    string(1) "1"
67    [2]=>
68    string(1) "1"
69  }
70  ["VALUE"]=>
71  array(3) {
72    [0]=>
73    string(1) "1"
74    [1]=>
75    string(1) "1"
76    [2]=>
77    string(1) "1"
78  }
79  ["BLOB"]=>
80  array(3) {
81    [0]=>
82    NULL
83    [1]=>
84    NULL
85    [2]=>
86    NULL
87  }
88  ["CLOB"]=>
89  array(3) {
90    [0]=>
91    NULL
92    [1]=>
93    NULL
94    [2]=>
95    NULL
96  }
97  ["STRING"]=>
98  array(3) {
99    [0]=>
100    NULL
101    [1]=>
102    NULL
103    [2]=>
104    NULL
105  }
106}
107int(3)
108array(3) {
109  [0]=>
110  array(5) {
111    ["ID"]=>
112    string(1) "1"
113    ["VALUE"]=>
114    string(1) "1"
115    ["BLOB"]=>
116    NULL
117    ["CLOB"]=>
118    NULL
119    ["STRING"]=>
120    NULL
121  }
122  [1]=>
123  array(5) {
124    ["ID"]=>
125    string(1) "1"
126    ["VALUE"]=>
127    string(1) "1"
128    ["BLOB"]=>
129    NULL
130    ["CLOB"]=>
131    NULL
132    ["STRING"]=>
133    NULL
134  }
135  [2]=>
136  array(5) {
137    ["ID"]=>
138    string(1) "1"
139    ["VALUE"]=>
140    string(1) "1"
141    ["BLOB"]=>
142    NULL
143    ["CLOB"]=>
144    NULL
145    ["STRING"]=>
146    NULL
147  }
148}
149int(0)
150array(0) {
151}
152int(2)
153array(2) {
154  [0]=>
155  array(5) {
156    [0]=>
157    string(1) "1"
158    [1]=>
159    string(1) "1"
160    [2]=>
161    NULL
162    [3]=>
163    NULL
164    [4]=>
165    NULL
166  }
167  [1]=>
168  array(5) {
169    [0]=>
170    string(1) "1"
171    [1]=>
172    string(1) "1"
173    [2]=>
174    NULL
175    [3]=>
176    NULL
177    [4]=>
178    NULL
179  }
180}
181int(2)
182array(5) {
183  [0]=>
184  array(2) {
185    [0]=>
186    string(1) "1"
187    [1]=>
188    string(1) "1"
189  }
190  [1]=>
191  array(2) {
192    [0]=>
193    string(1) "1"
194    [1]=>
195    string(1) "1"
196  }
197  [2]=>
198  array(2) {
199    [0]=>
200    NULL
201    [1]=>
202    NULL
203  }
204  [3]=>
205  array(2) {
206    [0]=>
207    NULL
208    [1]=>
209    NULL
210  }
211  [4]=>
212  array(2) {
213    [0]=>
214    NULL
215    [1]=>
216    NULL
217  }
218}
219int(1)
220array(5) {
221  [0]=>
222  array(1) {
223    [0]=>
224    string(1) "1"
225  }
226  [1]=>
227  array(1) {
228    [0]=>
229    string(1) "1"
230  }
231  [2]=>
232  array(1) {
233    [0]=>
234    NULL
235  }
236  [3]=>
237  array(1) {
238    [0]=>
239    NULL
240  }
241  [4]=>
242  array(1) {
243    [0]=>
244    NULL
245  }
246}
247Done
248