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_3_11gR1.phpt ('PL/SQL oci_bind_by_name with SQLT_AFC aka CHAR to CHAR parameter')

Script

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

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, 20 Nov 2014 12:38:44 +0000 (3 days ago)

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