xref: /PHP-5.3/ext/oci8/tests/fetch_into1.phpt (revision c7a8bd6a)
1--TEST--
2various ocifetchinto() tests
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, string) VALUES (1, 1, NULL)";
15
16if (!($s = oci_parse($c, $insert_sql))) {
17	die("oci_parse(insert) failed!\n");
18}
19
20for ($i = 0; $i<20; $i++) {
21	if (!oci_execute($s)) {
22		die("oci_execute(insert) failed!\n");
23	}
24}
25
26if (!oci_commit($c)) {
27	die("oci_commit() failed!\n");
28}
29
30$select_sql = "SELECT * FROM ".$schema."".$table_name."";
31
32if (!($s = oci_parse($c, $select_sql))) {
33	die("oci_parse(select) failed!\n");
34}
35
36if (!oci_execute($s)) {
37	die("oci_execute(select) failed!\n");
38}
39var_dump(ocifetchinto($s, $all, OCI_NUM));
40var_dump($all);
41var_dump(ocifetchinto($s, $all, OCI_ASSOC));
42var_dump($all);
43var_dump(ocifetchinto($s, $all, OCI_RETURN_NULLS));
44var_dump($all);
45var_dump(ocifetchinto($s, $all, OCI_RETURN_LOBS));
46var_dump($all);
47var_dump(ocifetchinto($s, $all, OCI_NUM+OCI_ASSOC));
48var_dump($all);
49var_dump(ocifetchinto($s, $all, OCI_NUM+OCI_ASSOC+OCI_RETURN_NULLS));
50var_dump($all);
51var_dump(ocifetchinto($s, $all, OCI_NUM+OCI_ASSOC+OCI_RETURN_NULLS+OCI_RETURN_LOBS));
52var_dump($all);
53var_dump(ocifetchinto($s, $all, OCI_RETURN_NULLS+OCI_RETURN_LOBS));
54var_dump($all);
55var_dump(ocifetchinto($s, $all, OCI_ASSOC+OCI_RETURN_NULLS+OCI_RETURN_LOBS));
56var_dump($all);
57var_dump(ocifetchinto($s, $all, OCI_NUM+OCI_RETURN_NULLS+OCI_RETURN_LOBS));
58var_dump($all);
59
60require dirname(__FILE__).'/drop_table.inc';
61
62echo "Done\n";
63?>
64--EXPECT--
65int(5)
66array(2) {
67  [0]=>
68  string(1) "1"
69  [1]=>
70  string(1) "1"
71}
72int(5)
73array(2) {
74  ["ID"]=>
75  string(1) "1"
76  ["VALUE"]=>
77  string(1) "1"
78}
79int(5)
80array(5) {
81  [0]=>
82  string(1) "1"
83  [1]=>
84  string(1) "1"
85  [2]=>
86  NULL
87  [3]=>
88  NULL
89  [4]=>
90  NULL
91}
92int(5)
93array(2) {
94  [0]=>
95  string(1) "1"
96  [1]=>
97  string(1) "1"
98}
99int(5)
100array(4) {
101  [0]=>
102  string(1) "1"
103  ["ID"]=>
104  string(1) "1"
105  [1]=>
106  string(1) "1"
107  ["VALUE"]=>
108  string(1) "1"
109}
110int(5)
111array(10) {
112  [0]=>
113  string(1) "1"
114  ["ID"]=>
115  string(1) "1"
116  [1]=>
117  string(1) "1"
118  ["VALUE"]=>
119  string(1) "1"
120  [2]=>
121  NULL
122  ["BLOB"]=>
123  NULL
124  [3]=>
125  NULL
126  ["CLOB"]=>
127  NULL
128  [4]=>
129  NULL
130  ["STRING"]=>
131  NULL
132}
133int(5)
134array(10) {
135  [0]=>
136  string(1) "1"
137  ["ID"]=>
138  string(1) "1"
139  [1]=>
140  string(1) "1"
141  ["VALUE"]=>
142  string(1) "1"
143  [2]=>
144  NULL
145  ["BLOB"]=>
146  NULL
147  [3]=>
148  NULL
149  ["CLOB"]=>
150  NULL
151  [4]=>
152  NULL
153  ["STRING"]=>
154  NULL
155}
156int(5)
157array(5) {
158  [0]=>
159  string(1) "1"
160  [1]=>
161  string(1) "1"
162  [2]=>
163  NULL
164  [3]=>
165  NULL
166  [4]=>
167  NULL
168}
169int(5)
170array(5) {
171  ["ID"]=>
172  string(1) "1"
173  ["VALUE"]=>
174  string(1) "1"
175  ["BLOB"]=>
176  NULL
177  ["CLOB"]=>
178  NULL
179  ["STRING"]=>
180  NULL
181}
182int(5)
183array(5) {
184  [0]=>
185  string(1) "1"
186  [1]=>
187  string(1) "1"
188  [2]=>
189  NULL
190  [3]=>
191  NULL
192  [4]=>
193  NULL
194}
195Done
196