Updates to Tomato RAF including NGINX && PHP
[tomato.git] / release / src / router / php / ext / oci8 / tests / fetch_array.phpt
blobdb5c6c554b9be41ca979f9ebb91d3b6aafd963a9
1 --TEST--
2 oci_fetch_array()
3 --SKIPIF--
4 <?php
5 $target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
6 require(dirname(__FILE__).'/skipif.inc');
7 ?> 
8 --FILE--
9 <?php
11 require dirname(__FILE__)."/connect.inc";
12 require dirname(__FILE__).'/create_table.inc';
14 $insert_sql = "INSERT INTO ".$schema."".$table_name." (id, value) VALUES (1,1)";
16 if (!($s = oci_parse($c, $insert_sql))) {
17         die("oci_parse(insert) failed!\n");
20 for ($i = 0; $i<3; $i++) {
21         if (!oci_execute($s)) {
22                 die("oci_execute(insert) failed!\n");
23         }
26 if (!oci_commit($c)) {
27         die("oci_commit() failed!\n");
30 echo "Test 1\n";
32 $select_sql = "SELECT * FROM ".$schema."".$table_name."";
34 if (!($s = oci_parse($c, $select_sql))) {
35         die("oci_parse(select) failed!\n");
38 if (!oci_execute($s)) {
39         die("oci_execute(select) failed!\n");
41 while ($row = oci_fetch_array($s)) {
42         var_dump($row);
45 echo "Test 2\n";
47 if (!oci_execute($s)) {
48         die("oci_execute(select) failed!\n");
50 while ($row = oci_fetch_array($s, OCI_NUM)) {
51         var_dump($row);
54 echo "Test 3\n";
56 if (!oci_execute($s)) {
57         die("oci_execute(select) failed!\n");
59 while ($row = oci_fetch_array($s, OCI_ASSOC)) {
60         var_dump($row);
63 echo "Test 4\n";
65 if (!oci_execute($s)) {
66         die("oci_execute(select) failed!\n");
68 while ($row = oci_fetch_array($s, OCI_BOTH)) {
69         var_dump($row);
72 echo "Test 5\n";
74 if (!oci_execute($s)) {
75         die("oci_execute(select) failed!\n");
77 while ($row = oci_fetch_array($s, OCI_RETURN_LOBS)) {
78         var_dump($row);
81 echo "Test 6\n";
83 if (!oci_execute($s)) {
84         die("oci_execute(select) failed!\n");
86 while ($row = oci_fetch_array($s, OCI_RETURN_NULLS)) {
87         var_dump($row);
90 echo "Test 7\n";
92 if (!oci_execute($s)) {
93         die("oci_execute(select) failed!\n");
95 while ($row = oci_fetch_array($s, OCI_NUM+OCI_RETURN_NULLS)) {
96         var_dump($row);
99 require dirname(__FILE__).'/drop_table.inc';
100         
101 echo "Done\n";
103 --EXPECT--
104 Test 1
105 array(10) {
106   [0]=>
107   string(1) "1"
108   ["ID"]=>
109   string(1) "1"
110   [1]=>
111   string(1) "1"
112   ["VALUE"]=>
113   string(1) "1"
114   [2]=>
115   NULL
116   ["BLOB"]=>
117   NULL
118   [3]=>
119   NULL
120   ["CLOB"]=>
121   NULL
122   [4]=>
123   NULL
124   ["STRING"]=>
125   NULL
127 array(10) {
128   [0]=>
129   string(1) "1"
130   ["ID"]=>
131   string(1) "1"
132   [1]=>
133   string(1) "1"
134   ["VALUE"]=>
135   string(1) "1"
136   [2]=>
137   NULL
138   ["BLOB"]=>
139   NULL
140   [3]=>
141   NULL
142   ["CLOB"]=>
143   NULL
144   [4]=>
145   NULL
146   ["STRING"]=>
147   NULL
149 array(10) {
150   [0]=>
151   string(1) "1"
152   ["ID"]=>
153   string(1) "1"
154   [1]=>
155   string(1) "1"
156   ["VALUE"]=>
157   string(1) "1"
158   [2]=>
159   NULL
160   ["BLOB"]=>
161   NULL
162   [3]=>
163   NULL
164   ["CLOB"]=>
165   NULL
166   [4]=>
167   NULL
168   ["STRING"]=>
169   NULL
171 Test 2
172 array(2) {
173   [0]=>
174   string(1) "1"
175   [1]=>
176   string(1) "1"
178 array(2) {
179   [0]=>
180   string(1) "1"
181   [1]=>
182   string(1) "1"
184 array(2) {
185   [0]=>
186   string(1) "1"
187   [1]=>
188   string(1) "1"
190 Test 3
191 array(2) {
192   ["ID"]=>
193   string(1) "1"
194   ["VALUE"]=>
195   string(1) "1"
197 array(2) {
198   ["ID"]=>
199   string(1) "1"
200   ["VALUE"]=>
201   string(1) "1"
203 array(2) {
204   ["ID"]=>
205   string(1) "1"
206   ["VALUE"]=>
207   string(1) "1"
209 Test 4
210 array(4) {
211   [0]=>
212   string(1) "1"
213   ["ID"]=>
214   string(1) "1"
215   [1]=>
216   string(1) "1"
217   ["VALUE"]=>
218   string(1) "1"
220 array(4) {
221   [0]=>
222   string(1) "1"
223   ["ID"]=>
224   string(1) "1"
225   [1]=>
226   string(1) "1"
227   ["VALUE"]=>
228   string(1) "1"
230 array(4) {
231   [0]=>
232   string(1) "1"
233   ["ID"]=>
234   string(1) "1"
235   [1]=>
236   string(1) "1"
237   ["VALUE"]=>
238   string(1) "1"
240 Test 5
241 array(4) {
242   [0]=>
243   string(1) "1"
244   ["ID"]=>
245   string(1) "1"
246   [1]=>
247   string(1) "1"
248   ["VALUE"]=>
249   string(1) "1"
251 array(4) {
252   [0]=>
253   string(1) "1"
254   ["ID"]=>
255   string(1) "1"
256   [1]=>
257   string(1) "1"
258   ["VALUE"]=>
259   string(1) "1"
261 array(4) {
262   [0]=>
263   string(1) "1"
264   ["ID"]=>
265   string(1) "1"
266   [1]=>
267   string(1) "1"
268   ["VALUE"]=>
269   string(1) "1"
271 Test 6
272 array(10) {
273   [0]=>
274   string(1) "1"
275   ["ID"]=>
276   string(1) "1"
277   [1]=>
278   string(1) "1"
279   ["VALUE"]=>
280   string(1) "1"
281   [2]=>
282   NULL
283   ["BLOB"]=>
284   NULL
285   [3]=>
286   NULL
287   ["CLOB"]=>
288   NULL
289   [4]=>
290   NULL
291   ["STRING"]=>
292   NULL
294 array(10) {
295   [0]=>
296   string(1) "1"
297   ["ID"]=>
298   string(1) "1"
299   [1]=>
300   string(1) "1"
301   ["VALUE"]=>
302   string(1) "1"
303   [2]=>
304   NULL
305   ["BLOB"]=>
306   NULL
307   [3]=>
308   NULL
309   ["CLOB"]=>
310   NULL
311   [4]=>
312   NULL
313   ["STRING"]=>
314   NULL
316 array(10) {
317   [0]=>
318   string(1) "1"
319   ["ID"]=>
320   string(1) "1"
321   [1]=>
322   string(1) "1"
323   ["VALUE"]=>
324   string(1) "1"
325   [2]=>
326   NULL
327   ["BLOB"]=>
328   NULL
329   [3]=>
330   NULL
331   ["CLOB"]=>
332   NULL
333   [4]=>
334   NULL
335   ["STRING"]=>
336   NULL
338 Test 7
339 array(5) {
340   [0]=>
341   string(1) "1"
342   [1]=>
343   string(1) "1"
344   [2]=>
345   NULL
346   [3]=>
347   NULL
348   [4]=>
349   NULL
351 array(5) {
352   [0]=>
353   string(1) "1"
354   [1]=>
355   string(1) "1"
356   [2]=>
357   NULL
358   [3]=>
359   NULL
360   [4]=>
361   NULL
363 array(5) {
364   [0]=>
365   string(1) "1"
366   [1]=>
367   string(1) "1"
368   [2]=>
369   NULL
370   [3]=>
371   NULL
372   [4]=>
373   NULL
375 Done