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