Annotation of embedaddon/php/ext/oci8/tests/bind_sqltchr_1.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Bind with SQLT_CHR
3: --SKIPIF--
4: <?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
5: --FILE--
6: <?php
7:
8: require(dirname(__FILE__).'/connect.inc');
9:
10: // Initialization
11:
12: $stmtarray = array(
13: "drop table bind_sqltchr_tab",
14:
15: "create table bind_sqltchr_tab (
16: id number,
17: varchar2_t10 varchar2(10),
18: number_t number,
19: number_t92 number(9,2))"
20:
21: );
22:
23: oci8_test_sql_execute($c, $stmtarray);
24:
25: function check_col($c, $colname, $id)
26: {
27: $s = oci_parse($c, "select $colname from bind_sqltchr_tab where id = :id");
28: oci_bind_by_name($s, ":id", $id);
29: oci_execute($s);
30: oci_fetch_all($s, $r);
31: var_dump($r);
32: }
33:
34: // Run Test
35:
36: echo "\nTEST241 bind SQLT_CHR\n";
37:
38: $c2 = "Hood241";
39: $s = oci_parse($c, "INSERT INTO bind_sqltchr_tab (id, varchar2_t10) VALUES (241, :c2)");
40: oci_bind_by_name($s, ":c2", $c2, -1, SQLT_CHR);
41: oci_execute($s);
42:
43: check_col($c, 'varchar2_t10', 241);
44:
45:
46: echo "\nTEST242 insert numbers SQLT_CHR\n";
47:
48: $s = oci_parse($c, "INSERT INTO bind_sqltchr_tab (id, number_t) VALUES (242, :n1)");
49: $n1 = 42;
50: oci_bind_by_name($s, ":n1", $n1, -1, SQLT_CHR);
51: oci_execute($s);
52:
53: check_col($c, 'number_t', 242);
54:
55: echo "\nTEST243 insert numbers, SQLT_CHR\n";
56:
57: $s = oci_parse($c, "INSERT INTO bind_sqltchr_tab (id, number_t) VALUES (243, :n1)");
58: $n1 = 42.69;
59: oci_bind_by_name($s, ":n1", $n1, -1, SQLT_CHR);
60: oci_execute($s);
61:
62: check_col($c, 'number_t', 243);
63:
64: echo "\nTEST244 insert numbers with SQLT_CHR\n";
65:
66: $s = oci_parse($c, "INSERT INTO bind_sqltchr_tab (id, number_t) VALUES (244, :n1)");
67: $n1 = 0;
68: oci_bind_by_name($s, ":n1", $n1, -1, SQLT_CHR);
69: oci_execute($s);
70:
71: check_col($c, 'number_t', 244);
72:
73: echo "\nTEST245 insert numbers with SQLT_CHR\n";
74:
75: $s = oci_parse($c, "INSERT INTO bind_sqltchr_tab (id, number_t) VALUES (245, :n1)");
76: $n1 = -23;
77: oci_bind_by_name($s, ":n1", $n1, -1, SQLT_CHR);
78: oci_execute($s);
79:
80: check_col($c, 'number_t', 245);
81:
82: echo "\nTEST246 insert numbers\n";
83:
84: $s = oci_parse($c, "INSERT INTO bind_sqltchr_tab (id, number_t) VALUES (246, :n1)");
85: $n1 = "-23";
86: oci_bind_by_name($s, ":n1", $n1, -1, SQLT_CHR);
87: oci_execute($s);
88:
89: check_col($c, 'number_t', 246);
90:
91: echo "\nTEST247 insert numbers with SQLT_CHR\n";
92:
93: $s = oci_parse($c, "INSERT INTO bind_sqltchr_tab (id, number_t) VALUES (247, :n1)");
94: $n1 = "23";
95: oci_bind_by_name($s, ":n1", $n1, -1, SQLT_CHR);
96: oci_execute($s);
97:
98: check_col($c, 'number_t', 247);
99:
100: echo "\nTEST248 insert numbers with SQLT_CHR\n";
101:
102: $s = oci_parse($c, "INSERT INTO bind_sqltchr_tab (id, number_t92) VALUES (248, :n1)");
103: $n1 = 123.56;
104: oci_bind_by_name($s, ":n1", $n1, -1, SQLT_CHR);
105: oci_execute($s);
106:
107: check_col($c, 'number_t92', 248);
108:
109: echo "\nTEST249 insert numbers with SQLT_CHR\n";
110:
111: $s = oci_parse($c, "INSERT INTO bind_sqltchr_tab (id, number_t92) VALUES (249, :n1)");
112: $n1 = "123.56";
113: oci_bind_by_name($s, ":n1", $n1, -1, SQLT_CHR);
114: oci_execute($s);
115:
116: check_col($c, 'number_t92', 249);
117:
118: echo "\nTEST250 insert numbers with SQLT_CHR\n";
119:
120: $s = oci_parse($c, "INSERT INTO bind_sqltchr_tab (id, number_t92) VALUES (250, :n1)");
121: $n1 = "";
122: oci_bind_by_name($s, ":n1", $n1, -1, SQLT_CHR);
123: oci_execute($s);
124:
125: check_col($c, 'number_t92', 250);
126:
127: // Clean up
128:
129: $stmtarray = array(
130: "drop table bind_sqltchr_tab"
131: );
132:
133: oci8_test_sql_execute($c, $stmtarray);
134:
135: ?>
136: ===DONE===
137: <?php exit(0); ?>
138: --EXPECTF--
139: TEST241 bind SQLT_CHR
140: array(1) {
141: ["VARCHAR2_T10"]=>
142: array(1) {
143: [0]=>
144: string(7) "Hood241"
145: }
146: }
147:
148: TEST242 insert numbers SQLT_CHR
149: array(1) {
150: ["NUMBER_T"]=>
151: array(1) {
152: [0]=>
153: string(2) "42"
154: }
155: }
156:
157: TEST243 insert numbers, SQLT_CHR
158: array(1) {
159: ["NUMBER_T"]=>
160: array(1) {
161: [0]=>
162: string(5) "42.69"
163: }
164: }
165:
166: TEST244 insert numbers with SQLT_CHR
167: array(1) {
168: ["NUMBER_T"]=>
169: array(1) {
170: [0]=>
171: string(1) "0"
172: }
173: }
174:
175: TEST245 insert numbers with SQLT_CHR
176: array(1) {
177: ["NUMBER_T"]=>
178: array(1) {
179: [0]=>
180: string(3) "-23"
181: }
182: }
183:
184: TEST246 insert numbers
185: array(1) {
186: ["NUMBER_T"]=>
187: array(1) {
188: [0]=>
189: string(3) "-23"
190: }
191: }
192:
193: TEST247 insert numbers with SQLT_CHR
194: array(1) {
195: ["NUMBER_T"]=>
196: array(1) {
197: [0]=>
198: string(2) "23"
199: }
200: }
201:
202: TEST248 insert numbers with SQLT_CHR
203: array(1) {
204: ["NUMBER_T92"]=>
205: array(1) {
206: [0]=>
207: string(6) "123.56"
208: }
209: }
210:
211: TEST249 insert numbers with SQLT_CHR
212: array(1) {
213: ["NUMBER_T92"]=>
214: array(1) {
215: [0]=>
216: string(6) "123.56"
217: }
218: }
219:
220: TEST250 insert numbers with SQLT_CHR
221: array(1) {
222: ["NUMBER_T92"]=>
223: array(1) {
224: [0]=>
225: NULL
226: }
227: }
228: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>