PHP  
 PHP_5_6
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

Test Failure Report for ext/oci8/tests/bind_char_4_11gR1.phpt ('PL/SQL oci_bind_by_name with SQLT_AFC aka CHAR to VARCHAR2 parameter')

Script

1: <?php
2:
3:
// Same test as bind_char_3 but the PL/SQL function uses VARCHAR2 instead of CHAR
4:
5:
require(dirname(__FILE__).'/connect.inc');
6:
7:
// Initialization
8:
9:
$stmtarray = array(
10:     
"create or replace function bind_char_3_fn(p1 varchar2) return varchar2 as begin return p1; end;",
11: );
12:                          
13:
oci8_test_sql_execute($c$stmtarray);
14:
15:
// Run Test
16:
17:
echo "Test 1.1 In Length: default.  In Type: default.  Out Length: default.          Out Type: default\n";
18:
19:
$s oci_parse($c"begin :bv2 := bind_char_3_fn(:bv1); end;");
20:
$bv1 'abc';
21:
$r oci_bind_by_name($s':bv1'$bv1) && oci_bind_by_name($s':bv2'$bv2);
22: if (
$r)
23:     
do_e($s);
24:
var_dump($bv1$bv2);
25:
26: echo 
"Test 1.2 In Length: default.  In Type: default.  Out Length: 10.               Out Type: default\n";
27:
28:
$bv1 'abc';
29:
$r oci_bind_by_name($s':bv1'$bv1) && oci_bind_by_name($s':bv2'$bv210);
30: if (
$r)
31:     
do_e($s);
32:
var_dump($bv1$bv2);
33:
34:
35: echo 
"Test 1.3 In Length: -1.       In Type: AFC.      Out Length: 10.               Out Type: default\n";
36:
37:
$bv1 'abc';
38:
$r oci_bind_by_name($s':bv1'$bv1, -1SQLT_AFC) && oci_bind_by_name($s':bv2'$bv210);
39: if (
$r)
40:     
do_e($s);
41:
var_dump($bv1$bv2);
42:
43:
44:
45: echo 
"Test 1.4 In Length: -1.       In Type: AFC.      Out Length: 10.               Out Type: AFC\n";
46:
47:
$bv1 'abc';
48:
$r oci_bind_by_name($s':bv1'$bv1, -1SQLT_AFC) && oci_bind_by_name($s':bv2'$bv210SQLT_AFC);
49: if (
$r)
50:     
do_e($s);
51:
var_dump($bv1$bv2);
52:
53:
54: echo 
"Test 1.5 In Length: strlen.   In Type: AFC.      Out Length: strlen(input).    Out Type: AFC\n";
55:
56:
$bv1 'abc';
57:
$r oci_bind_by_name($s':bv1'$bv1strlen($bv1), SQLT_AFC) && oci_bind_by_name($s':bv2'$bv2strlen($bv1), SQLT_AFC);
58: if (
$r)
59:     
do_e($s);
60:
var_dump($bv1$bv2);
61:
62:
63: echo 
"Test 1.6 In Length: strlen.   In Type: AFC.      Out Length: strlen(input)-1.  Out Type: AFC\n";
64:
65:
$bv1 'abc';
66:
$r oci_bind_by_name($s':bv1'$bv1strlen($bv1), SQLT_AFC) && oci_bind_by_name($s':bv2'$bv2strlen($bv1)-1SQLT_AFC);
67: if (
$r)
68:     
do_e($s);
69:
var_dump($bv1$bv2);
70:
71:
72: echo 
"Test 1.7 In Length: strlen.   In Type: AFC.      Out Length: strlen(input)+1.  Out Type: AFC\n";
73:
74:
$bv1 'abc';
75:
$r oci_bind_by_name($s':bv1'$bv1strlen($bv1), SQLT_AFC) && oci_bind_by_name($s':bv2'$bv2strlen($bv1)+1SQLT_AFC);
76: if (
$r)
77:     
do_e($s);
78:
var_dump($bv1$bv2);
79:
80:
81: echo 
"\n\nTests with ''\n\n";
82:
83: echo 
"Test 2.1 In Length: -1.       In Type: AFC.      Out Length: 10.               Out Type: AFC\n";
84:
85:
$bv1 '';
86:
$r oci_bind_by_name($s':bv1'$bv1, -1SQLT_AFC) && oci_bind_by_name($s':bv2'$bv210SQLT_AFC);
87: if (
$r)
88:     
do_e($s);
89:
var_dump($bv1$bv2);
90:
91:
92: echo 
"Test 2.2 In Length: default.  In Type: default.  Out Length: 10.               Out Type: default\n";
93:
94:
$r oci_bind_by_name($s':bv1'$bv1) && oci_bind_by_name($s':bv2'$bv210);
95: if (
$r)
96:     
do_e($s);
97:
var_dump($bv1$bv2);
98:
99:
100:
101: echo 
"Test 2.3 In Length: -1.       In Type: AFC.      Out Length: 10.               Out Type: default\n";
102:
103:
$bv1 '';
104:
$r oci_bind_by_name($s':bv1'$bv1, -1SQLT_AFC) && oci_bind_by_name($s':bv2'$bv210);
105: if (
$r)
106:     
do_e($s);
107:
var_dump($bv1$bv2);
108:
109:
110:
111: echo 
"Test 2.4 In Length: -1.       In Type: AFC.      Out Length: 10.               Out Type: AFC\n";
112:
113:
$bv1 '';
114:
$r oci_bind_by_name($s':bv1'$bv1, -1SQLT_AFC) && oci_bind_by_name($s':bv2'$bv210SQLT_AFC);
115: if (
$r)
116:     
do_e($s);
117:
var_dump($bv1$bv2);
118:
119:
120:
121: echo 
"Test 2.5 In Length: -1.       In Type: AFC.      Out Length: 0.                Out Type: AFC\n";
122:
123:
$bv1 '';
124:
$r oci_bind_by_name($s':bv1'$bv1, -1SQLT_AFC) && oci_bind_by_name($s':bv2'$bv20SQLT_AFC);
125: if (
$r)
126:     
do_e($s);
127:
var_dump($bv1$bv2);
128:
129:
130:
131: echo 
"Test 2.6 In Length: 0.        In Type: AFC.      Out Length: 0.                Out Type: AFC\n";
132:
133:
$bv1 '';
134:
$r oci_bind_by_name($s':bv1'$bv10SQLT_AFC) && oci_bind_by_name($s':bv2'$bv20SQLT_AFC);
135: if (
$r)
136:     
do_e($s);
137:
var_dump($bv1$bv2);
138:
139:
140:
141: echo 
"Test 2.7 In Length: 1.        In Type: AFC.      Out Length: 1.                Out Type: AFC\n";
142:
143:
$bv1 '';
144:
$r oci_bind_by_name($s':bv1'$bv11SQLT_AFC) && oci_bind_by_name($s':bv2'$bv21SQLT_AFC);
145: if (
$r)
146:     
do_e($s);
147:
var_dump($bv1$bv2);
148:
149:
150:
151: echo 
"\n\nTests with NULL\n";
152:
153: echo 
"Test 3.1 In Length: -1.       In Type: AFC.      Out Length: 10.               Out Type: AFC\n";
154:
155:
$bv1 null;
156:
$r oci_bind_by_name($s':bv1'$bv1, -1SQLT_AFC) && oci_bind_by_name($s':bv2'$bv210SQLT_AFC);
157: if (
$r)
158:     
do_e($s);
159:
var_dump($bv1$bv2);
160:
161:
162: echo 
"Test 3.2 In Length: default.  In Type: default.  Out Length: 10.               Out Type: default\n";
163:
164:
$bv1 null;
165:
$r oci_bind_by_name($s':bv1'$bv1) && oci_bind_by_name($s':bv2'$bv210);
166: if (
$r)
167:     
do_e($s);
168:
var_dump($bv1$bv2);
169:
170:
171:
172: echo 
"Test 3.3 In Length: -1.       In Type: AFC.      Out Length: 10.               Out Type: default\n";
173:
174:
$bv1 null;
175:
$r oci_bind_by_name($s':bv1'$bv1, -1SQLT_AFC) && oci_bind_by_name($s':bv2'$bv210);
176: if (
$r)
177:     
do_e($s);
178:
var_dump($bv1$bv2);
179:
180:
181:
182: echo 
"Test 3.4 In Length: -1.       In Type: AFC.      Out Length: 10.               Out Type: AFC\n";
183:
184:
$bv1 null;
185:
$r oci_bind_by_name($s':bv1'$bv1, -1SQLT_AFC) && oci_bind_by_name($s':bv2'$bv210SQLT_AFC);
186: if (
$r)
187:     
do_e($s);
188:
var_dump($bv1$bv2);
189:
190:
191: echo 
"Test 3.5 In Length: -1.       In Type: AFC.      Out Length: 0.                Out Type: AFC\n";
192:
193:
$bv1 null;
194:
$r oci_bind_by_name($s':bv1'$bv1, -1SQLT_AFC) && oci_bind_by_name($s':bv2'$bv20SQLT_AFC);
195: if (
$r)
196:     
do_e($s);
197:
var_dump($bv1$bv2);
198:
199:
200:
201: echo 
"Test 3.6 In Length: -1.       In Type: AFC.      Out Length: 1.                Out Type: AFC\n";
202:
203:
$bv1 null;
204:
$r oci_bind_by_name($s':bv1'$bv1, -1SQLT_AFC) && oci_bind_by_name($s':bv2'$bv21SQLT_AFC);
205: if (
$r)
206:     
do_e($s);
207:
var_dump($bv1$bv2);
208:
209:
210: function 
do_e($s)
211: {
212:     echo 
"  Executing:\n";
213:
214:     
$r = @oci_execute($s);
215:     if (!
$r) {
216:         
$m oci_error($s);
217:         echo 
"    Oci_execute error ORA-".$m['code']."\n";
218:         return;
219:     }
220: }
221:
222:
// Cleanup
223:
224:
$stmtarray = array(
225:     
"drop function bind_char_3_fn"
226:
);
227:
228:
oci8_test_sql_execute($c$stmtarray);
229:
230: echo 
"Done\n";
231:
232:
?>
233:

Expected

Test 1.1 In Length: default.  In Type: default.  Out Length: default.          Out Type: default
  Executing:
    Oci_execute error ORA-6502
string(3) "abc"
NULL
Test 1.2 In Length: default.  In Type: default.  Out Length: 10.               Out Type: default
  Executing:
string(3) "abc"
string(3) "abc"
Test 1.3 In Length: -1.       In Type: AFC.      Out Length: 10.               Out Type: default
  Executing:
string(3) "abc"
string(3) "abc"
Test 1.4 In Length: -1.       In Type: AFC.      Out Length: 10.               Out Type: AFC
  Executing:
string(3) "abc"
string(10) "abc       "
Test 1.5 In Length: strlen.   In Type: AFC.      Out Length: strlen(input).    Out Type: AFC
  Executing:
string(3) "abc"
string(3) "abc"
Test 1.6 In Length: strlen.   In Type: AFC.      Out Length: strlen(input)-1.  Out Type: AFC
  Executing:
    Oci_execute error ORA-6502
string(3) "abc"
string(3) "abc"
Test 1.7 In Length: strlen.   In Type: AFC.      Out Length: strlen(input)+1.  Out Type: AFC
  Executing:
string(3) "abc"
string(4) "abc "


Tests with ''

Test 2.1 In Length: -1.       In Type: AFC.      Out Length: 10.               Out Type: AFC
  Executing:
string(0) ""
NULL
Test 2.2 In Length: default.  In Type: default.  Out Length: 10.               Out Type: default
  Executing:
string(0) ""
NULL
Test 2.3 In Length: -1.       In Type: AFC.      Out Length: 10.               Out Type: default
  Executing:
string(0) ""
NULL
Test 2.4 In Length: -1.       In Type: AFC.      Out Length: 10.               Out Type: AFC
  Executing:
string(0) ""
NULL
Test 2.5 In Length: -1.       In Type: AFC.      Out Length: 0.                Out Type: AFC
  Executing:
string(0) ""
NULL
Test 2.6 In Length: 0.        In Type: AFC.      Out Length: 0.                Out Type: AFC
  Executing:
string(0) ""
NULL
Test 2.7 In Length: 1.        In Type: AFC.      Out Length: 1.                Out Type: AFC
  Executing:
string(0) ""
NULL


Tests with NULL
Test 3.1 In Length: -1.       In Type: AFC.      Out Length: 10.               Out Type: AFC
  Executing:
NULL
NULL
Test 3.2 In Length: default.  In Type: default.  Out Length: 10.               Out Type: default
  Executing:
NULL
NULL
Test 3.3 In Length: -1.       In Type: AFC.      Out Length: 10.               Out Type: default
  Executing:
NULL
NULL
Test 3.4 In Length: -1.       In Type: AFC.      Out Length: 10.               Out Type: AFC
  Executing:
NULL
NULL
Test 3.5 In Length: -1.       In Type: AFC.      Out Length: 0.                Out Type: AFC
  Executing:
NULL
NULL
Test 3.6 In Length: -1.       In Type: AFC.      Out Length: 1.                Out Type: AFC
  Executing:
NULL
NULL
Done

Output

Test 1.1 In Length: default.  In Type: default.  Out Length: default.          Out Type: default
  Executing:
string(3) "abc"
string(3) "abc"
Test 1.2 In Length: default.  In Type: default.  Out Length: 10.               Out Type: default
  Executing:
string(3) "abc"
string(3) "abc"
Test 1.3 In Length: -1.       In Type: AFC.      Out Length: 10.               Out Type: default
  Executing:
string(3) "abc"
string(3) "abc"
Test 1.4 In Length: -1.       In Type: AFC.      Out Length: 10.               Out Type: AFC
  Executing:
string(3) "abc"
string(30) "abc                           "
Test 1.5 In Length: strlen.   In Type: AFC.      Out Length: strlen(input).    Out Type: AFC
  Executing:
string(3) "abc"
string(9) "abc      "
Test 1.6 In Length: strlen.   In Type: AFC.      Out Length: strlen(input)-1.  Out Type: AFC
  Executing:
string(3) "abc"
string(6) "abc   "
Test 1.7 In Length: strlen.   In Type: AFC.      Out Length: strlen(input)+1.  Out Type: AFC
  Executing:
string(3) "abc"
string(12) "abc         "


Tests with ''

Test 2.1 In Length: -1.       In Type: AFC.      Out Length: 10.               Out Type: AFC
  Executing:
string(0) ""
NULL
Test 2.2 In Length: default.  In Type: default.  Out Length: 10.               Out Type: default
  Executing:
string(0) ""
NULL
Test 2.3 In Length: -1.       In Type: AFC.      Out Length: 10.               Out Type: default
  Executing:
string(0) ""
NULL
Test 2.4 In Length: -1.       In Type: AFC.      Out Length: 10.               Out Type: AFC
  Executing:
string(0) ""
NULL
Test 2.5 In Length: -1.       In Type: AFC.      Out Length: 0.                Out Type: AFC
  Executing:
string(0) ""
NULL
Test 2.6 In Length: 0.        In Type: AFC.      Out Length: 0.                Out Type: AFC
  Executing:
string(0) ""
NULL
Test 2.7 In Length: 1.        In Type: AFC.      Out Length: 1.                Out Type: AFC
  Executing:
string(0) ""
NULL


Tests with NULL
Test 3.1 In Length: -1.       In Type: AFC.      Out Length: 10.               Out Type: AFC
  Executing:
NULL
NULL
Test 3.2 In Length: default.  In Type: default.  Out Length: 10.               Out Type: default
  Executing:
NULL
NULL
Test 3.3 In Length: -1.       In Type: AFC.      Out Length: 10.               Out Type: default
  Executing:
NULL
NULL
Test 3.4 In Length: -1.       In Type: AFC.      Out Length: 10.               Out Type: AFC
  Executing:
NULL
NULL
Test 3.5 In Length: -1.       In Type: AFC.      Out Length: 0.                Out Type: AFC
  Executing:
NULL
NULL
Test 3.6 In Length: -1.       In Type: AFC.      Out Length: 1.                Out Type: AFC
  Executing:
NULL
NULL
Done

Diff

003+ string(3) "abc"
003-     Oci_execute error ORA-6502
005- NULL
016+ string(30) "abc                           "
017- string(10) "abc       "
020+ string(9) "abc      "
021- string(3) "abc"
024+ string(6) "abc   "
024-     Oci_execute error ORA-6502
026- string(3) "abc"
028+ string(12) "abc         "
030- string(4) "abc "

 

Generated at Thu, 28 Aug 2014 18:52:45 +0000 (4 days ago)

Copyright © 2005-2014 The PHP Group
All rights reserved.