xref: /PHP-5.4/ext/oci8/tests/field_funcs1.phpt (revision c7a8bd6a)
1--TEST--
2oci_field_*() family: error cases
3--SKIPIF--
4<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
5--FILE--
6<?php
7
8require(dirname(__FILE__)."/connect.inc");
9
10// Initialize
11
12$stmtarray = array(
13    "drop table field_funcs1_tab",
14    "create table field_funcs1_tab (id number, value number)",
15    "insert into field_funcs1_tab (id, value) values (1,1)",
16    "insert into field_funcs1_tab (id, value) values (1,1)",
17    "insert into field_funcs1_tab (id, value) values (1,1)"
18);
19
20oci8_test_sql_execute($c, $stmtarray);
21
22// Run Test
23
24if (!($s = oci_parse($c, "select * from field_funcs1_tab"))) {
25    die("oci_parse(select) failed!\n");
26}
27
28if (!oci_execute($s)) {
29    die("oci_execute(select) failed!\n");
30}
31
32$row = oci_fetch_array($s, OCI_NUM + OCI_RETURN_NULLS + OCI_RETURN_LOBS);
33var_dump($row);
34
35echo "Test 1\n";
36var_dump(oci_field_is_null($s, -1));
37var_dump(oci_field_name($s, -1));
38var_dump(oci_field_type($s, -1));
39var_dump(oci_field_type_raw($s, -1));
40var_dump(oci_field_scale($s, -1));
41var_dump(oci_field_precision($s, -1));
42var_dump(oci_field_size($s, -1));
43
44echo "Test 2\n";
45var_dump(oci_field_is_null($s, "none"));
46var_dump(oci_field_name($s, "none"));
47var_dump(oci_field_type($s, "none"));
48var_dump(oci_field_type_raw($s, "none"));
49var_dump(oci_field_scale($s, "none"));
50var_dump(oci_field_precision($s, "none"));
51var_dump(oci_field_size($s, "none"));
52
53echo "Test 3\n";
54var_dump(oci_field_is_null($c, -1));
55var_dump(oci_field_name($c, -1));
56var_dump(oci_field_type($c, -1));
57var_dump(oci_field_type_raw($c, -1));
58var_dump(oci_field_scale($c, -1));
59var_dump(oci_field_precision($c, -1));
60var_dump(oci_field_size($c, -1));
61
62echo "Test 4\n";
63var_dump(oci_field_is_null($s, array()));
64var_dump(oci_field_name($s, array()));
65var_dump(oci_field_type($s, array()));
66var_dump(oci_field_type_raw($s, array()));
67var_dump(oci_field_scale($s, array()));
68var_dump(oci_field_precision($s, array()));
69var_dump(oci_field_size($s, array()));
70
71var_dump(oci_field_size($s));
72
73
74// Cleanup
75
76$stmtarray = array(
77    "drop table field_funcs1_tab"
78);
79
80oci8_test_sql_execute($c, $stmtarray);
81
82echo "Done\n";
83
84?>
85--EXPECTF--
86array(2) {
87  [0]=>
88  %unicode|string%(1) "1"
89  [1]=>
90  %unicode|string%(1) "1"
91}
92Test 1
93
94Warning: oci_field_is_null(): Invalid column index "-1" in %s on line %d
95bool(false)
96
97Warning: oci_field_name(): Invalid column index "-1" in %s on line %d
98bool(false)
99
100Warning: oci_field_type(): Invalid column index "-1" in %s on line %d
101bool(false)
102
103Warning: oci_field_type_raw(): Invalid column index "-1" in %s on line %d
104bool(false)
105
106Warning: oci_field_scale(): Invalid column index "-1" in %s on line %d
107bool(false)
108
109Warning: oci_field_precision(): Invalid column index "-1" in %s on line %d
110bool(false)
111
112Warning: oci_field_size(): Invalid column index "-1" in %s on line %d
113bool(false)
114Test 2
115
116Warning: oci_field_is_null(): Invalid column name "none" in %s on line %d
117bool(false)
118
119Warning: oci_field_name(): Invalid column name "none" in %s on line %d
120bool(false)
121
122Warning: oci_field_type(): Invalid column name "none" in %s on line %d
123bool(false)
124
125Warning: oci_field_type_raw(): Invalid column name "none" in %s on line %d
126bool(false)
127
128Warning: oci_field_scale(): Invalid column name "none" in %s on line %d
129bool(false)
130
131Warning: oci_field_precision(): Invalid column name "none" in %s on line %d
132bool(false)
133
134Warning: oci_field_size(): Invalid column name "none" in %s on line %d
135bool(false)
136Test 3
137
138Warning: oci_field_is_null(): supplied resource is not a valid oci8 statement resource in %s on line %d
139bool(false)
140
141Warning: oci_field_name(): supplied resource is not a valid oci8 statement resource in %s on line %d
142bool(false)
143
144Warning: oci_field_type(): supplied resource is not a valid oci8 statement resource in %s on line %d
145bool(false)
146
147Warning: oci_field_type_raw(): supplied resource is not a valid oci8 statement resource in %s on line %d
148bool(false)
149
150Warning: oci_field_scale(): supplied resource is not a valid oci8 statement resource in %s on line %d
151bool(false)
152
153Warning: oci_field_precision(): supplied resource is not a valid oci8 statement resource in %s on line %d
154bool(false)
155
156Warning: oci_field_size(): supplied resource is not a valid oci8 statement resource in %s on line %d
157bool(false)
158Test 4
159
160Warning: oci_field_is_null(): Invalid column index "0" in %s on line %d
161bool(false)
162
163Warning: oci_field_name(): Invalid column index "0" in %s on line %d
164bool(false)
165
166Warning: oci_field_type(): Invalid column index "0" in %s on line %d
167bool(false)
168
169Warning: oci_field_type_raw(): Invalid column index "0" in %s on line %d
170bool(false)
171
172Warning: oci_field_scale(): Invalid column index "0" in %s on line %d
173bool(false)
174
175Warning: oci_field_precision(): Invalid column index "0" in %s on line %d
176bool(false)
177
178Warning: oci_field_size(): Invalid column index "0" in %s on line %d
179bool(false)
180
181Warning: oci_field_size() expects exactly 2 parameters, 1 given in %s on line %d
182bool(false)
183Done
184