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