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_1_11gR1.phpt ('SELECT oci_bind_by_name with SQLT_AFC aka CHAR')

Script

1: <?php
2:
3:
// Output is for 32 bit client to 64bit 11.1.0.6
4:
5:
require(dirname(__FILE__).'/connect.inc');
6:
7:
// Initialization
8:
9:
$stmtarray = array(
10:     
"drop table bind_char_tab",
11:     
"create table bind_char_tab (id number, c1 char(10), c2 varchar2(10))",
12:     
"insert into bind_char_tab values (1, 'abc', NULL)",
13:     
"insert into bind_char_tab values (2, NULL, 'abc')",
14:     
"insert into bind_char_tab values (3, NULL, 'abc       ')"
15:
);
16:                          
17:
oci8_test_sql_execute($c$stmtarray);
18:
19:
// Run Test
20:
21:
echo "*** Non-null Data Tests against CHAR***\n";
22:
23:
$bv1 'abc';
24:
25: echo 
"Test 1.1: Type: default.  Length: default\n";
26:
$s oci_parse($c"select * from bind_char_tab where c1 = :bv");
27:
$r oci_bind_by_name($s":bv"$bv1);
28: if (
$r)
29:     
do_e_q($s);
30:
31: echo 
"Test 1.2: Type: AFC.  Length: default\n";
32:
$r oci_bind_by_name($s":bv"$bv1, -1SQLT_AFC);
33: if (
$r)
34:     
do_e_q($s);
35:
36: echo 
"Test 1.3: Type: AFC:  Length: 0\n";
37:
$r oci_bind_by_name($s":bv"$bv10SQLT_AFC);
38: if (
$r)
39:     
do_e_q($s);
40:
41: echo 
"Test 1.4: Type: AFC:  Length: strlen\n";
42:
$r oci_bind_by_name($s":bv"$bv1strlen($bv1), SQLT_AFC);
43: if (
$r)
44:     
do_e_q($s);
45:
46: echo 
"Test 1.5: Type: AFC.  Length: strlen-1\n";
47:
$r oci_bind_by_name($s":bv"$bv1strlen($bv1)-1SQLT_AFC);
48: if (
$r)
49:     
do_e_q($s);
50:
51: echo 
"Test 1.6: Type: AFC.  Length: strlen+1\n";
52:
$r oci_bind_by_name($s":bv"$bv1strlen($bv1)+1SQLT_AFC);
53: if (
$r)
54:     
do_e_q($s);
55:
56: echo 
"\n\n*** NULL data tests against CHAR ***\n";
57:
58:
$bv1 null;
59:
60: echo 
"Test 2.1: Type: default.  Length: default\n";
61:
$s oci_parse($c"select * from bind_char_tab where c1 = :bv");
62:
$r oci_bind_by_name($s":bv"$bv1);
63: if (
$r)
64:     
do_e_q($s);
65:
66: echo 
"Test 2.2: Type: AFC.  Length: default\n";
67:
$r oci_bind_by_name($s":bv"$bv1, -1SQLT_AFC);
68: if (
$r)
69:     
do_e_q($s);
70:
71: echo 
"Test 2.3: Type: AFC:  Length: 0\n";
72:
$r oci_bind_by_name($s":bv"$bv10SQLT_AFC);
73: if (
$r)
74:     
do_e_q($s);
75:
76: echo 
"Test 2.4: Type: AFC:  Length: strlen\n";
77:
$r oci_bind_by_name($s":bv"$bv1strlen($bv1), SQLT_AFC);
78: if (
$r)
79:     
do_e_q($s);
80:
81: echo 
"Test 2.5: Type: AFC.  Length: strlen-1\n";
82:
$r oci_bind_by_name($s":bv"$bv1strlen($bv1)-1SQLT_AFC);
83: if (
$r)
84:     
do_e_q($s);
85:
86: echo 
"Test 2.6: Type: AFC.  Length: strlen+1\n";
87:
$r oci_bind_by_name($s":bv"$bv1strlen($bv1)+1SQLT_AFC);
88: if (
$r)
89:     
do_e_q($s);
90:
91:
92: echo 
"\n\n*** Non-null Data Tests against VARCHAR2***\n";
93:
94:
$bv1 'abc';
95:
96: echo 
"Test 3.1: Type: default.  Length: default\n";
97:
$s oci_parse($c"select * from bind_char_tab where c2 = :bv");
98:
$r oci_bind_by_name($s":bv"$bv1);
99: if (
$r)
100:     
do_e_q($s);
101:
102: echo 
"Test 3.2: Type: AFC.  Length: default\n";
103:
$r oci_bind_by_name($s":bv"$bv1, -1SQLT_AFC);
104: if (
$r)
105:     
do_e_q($s);
106:
107: echo 
"Test 3.3: Type: AFC:  Length: 0\n";
108:
$r oci_bind_by_name($s":bv"$bv10SQLT_AFC);
109: if (
$r)
110:     
do_e_q($s);
111:
112: echo 
"Test 3.4: Type: AFC:  Length: strlen\n";
113:
$r oci_bind_by_name($s":bv"$bv1strlen($bv1), SQLT_AFC);
114: if (
$r)
115:     
do_e_q($s);
116:
117: echo 
"Test 3.5: Type: AFC.  Length: strlen-1\n";
118:
$r oci_bind_by_name($s":bv"$bv1strlen($bv1)-1SQLT_AFC);
119: if (
$r)
120:     
do_e_q($s);
121:
122: echo 
"Test 3.6: Type: AFC.  Length: strlen+1\n";
123:
$r oci_bind_by_name($s":bv"$bv1strlen($bv1)+1SQLT_AFC);
124: if (
$r)
125:     
do_e_q($s);
126:
127:
128: echo 
"\n\n*** NULL data tests against VARCHAR2 ***\n";
129:
130:
$bv1 null;
131:
132: echo 
"Test 4.1: Type: default.  Length: default\n";
133:
$s oci_parse($c"select * from bind_char_tab where c2 = :bv");
134:
$r oci_bind_by_name($s":bv"$bv1);
135: if (
$r)
136:     
do_e_q($s);
137:
138: echo 
"Test 4.2: Type: AFC.  Length: default\n";
139:
$r oci_bind_by_name($s":bv"$bv1, -1SQLT_AFC);
140: if (
$r)
141:     
do_e_q($s);
142:
143: echo 
"Test 4.3: Type: AFC:  Length: 0\n";
144:
$r oci_bind_by_name($s":bv"$bv10SQLT_AFC);
145: if (
$r)
146:     
do_e_q($s);
147:
148: echo 
"Test 4.4: Type: AFC:  Length: strlen\n";
149:
$r oci_bind_by_name($s":bv"$bv1strlen($bv1), SQLT_AFC);
150: if (
$r)
151:     
do_e_q($s);
152:
153: echo 
"Test 4.5: Type: AFC.  Length: strlen-1\n";
154:
$r oci_bind_by_name($s":bv"$bv1strlen($bv1)-1SQLT_AFC);
155: if (
$r)
156:     
do_e_q($s);
157:
158: echo 
"Test 4.6: Type: AFC.  Length: strlen+1\n";
159:
$r oci_bind_by_name($s":bv"$bv1strlen($bv1)+1SQLT_AFC);
160: if (
$r)
161:     
do_e_q($s);
162:
163:
164:
165: function 
do_e_q($s)
166: {
167:     echo 
"  Querying:\n";
168:
169:     
$r = @oci_execute($s);
170:     if (!
$r) {
171:         
$m oci_error($s);
172:         echo 
"    Oci_execute error ORA-".$m['code']." Exiting Query\n";
173:         return;
174:     }
175:     while (
$row oci_fetch_array($sOCI_ASSOC+OCI_RETURN_NULLS)) {
176:         foreach (
$row as $item) {
177:             echo 
"    :" $item ":\n";
178:         }
179:     }
180: }
181:
182:
// Cleanup
183:
$stmtarray = array(
184:     
"drop table bind_char_tab"
185:
);
186:                          
187:
oci8_test_sql_execute($c$stmtarray);
188:
189: echo 
"Done\n";
190:
191:
?>
192:

Expected

*** Non-null Data Tests against CHAR***
Test 1.1: Type: default.  Length: default
  Querying:
Test 1.2: Type: AFC.  Length: default
  Querying:
    :1:
    :abc       :
    ::
Test 1.3: Type: AFC:  Length: 0
  Querying:
    Oci_execute error ORA-1460 Exiting Query
Test 1.4: Type: AFC:  Length: strlen
  Querying:
    :1:
    :abc       :
    ::
Test 1.5: Type: AFC.  Length: strlen-1
  Querying:
    Oci_execute error ORA-1460 Exiting Query
Test 1.6: Type: AFC.  Length: strlen+1
  Querying:
    :1:
    :abc       :
    ::


*** NULL data tests against CHAR ***
Test 2.1: Type: default.  Length: default
  Querying:
Test 2.2: Type: AFC.  Length: default
  Querying:
Test 2.3: Type: AFC:  Length: 0
  Querying:
Test 2.4: Type: AFC:  Length: strlen
  Querying:
Test 2.5: Type: AFC.  Length: strlen-1
  Querying:
Test 2.6: Type: AFC.  Length: strlen+1
  Querying:


*** Non-null Data Tests against VARCHAR2***
Test 3.1: Type: default.  Length: default
  Querying:
    :2:
    ::
    :abc:
Test 3.2: Type: AFC.  Length: default
  Querying:
    :2:
    ::
    :abc:
Test 3.3: Type: AFC:  Length: 0
  Querying:
    Oci_execute error ORA-1460 Exiting Query
Test 3.4: Type: AFC:  Length: strlen
  Querying:
    :2:
    ::
    :abc:
Test 3.5: Type: AFC.  Length: strlen-1
  Querying:
    Oci_execute error ORA-1460 Exiting Query
Test 3.6: Type: AFC.  Length: strlen+1
  Querying:
    :2:
    ::
    :abc:


*** NULL data tests against VARCHAR2 ***
Test 4.1: Type: default.  Length: default
  Querying:
Test 4.2: Type: AFC.  Length: default
  Querying:
Test 4.3: Type: AFC:  Length: 0
  Querying:
Test 4.4: Type: AFC:  Length: strlen
  Querying:
Test 4.5: Type: AFC.  Length: strlen-1
  Querying:
Test 4.6: Type: AFC.  Length: strlen+1
  Querying:
Done

Output

*** Non-null Data Tests against CHAR***
Test 1.1: Type: default.  Length: default
  Querying:
Test 1.2: Type: AFC.  Length: default
  Querying:
    :1:
    :abc       :
    ::
Test 1.3: Type: AFC:  Length: 0
  Querying:
    :1:
    :abc       :
    ::
Test 1.4: Type: AFC:  Length: strlen
  Querying:
    :1:
    :abc       :
    ::
Test 1.5: Type: AFC.  Length: strlen-1
  Querying:
    :1:
    :abc       :
    ::
Test 1.6: Type: AFC.  Length: strlen+1
  Querying:
    :1:
    :abc       :
    ::


*** NULL data tests against CHAR ***
Test 2.1: Type: default.  Length: default
  Querying:
Test 2.2: Type: AFC.  Length: default
  Querying:
Test 2.3: Type: AFC:  Length: 0
  Querying:
Test 2.4: Type: AFC:  Length: strlen
  Querying:
Test 2.5: Type: AFC.  Length: strlen-1
  Querying:
Test 2.6: Type: AFC.  Length: strlen+1
  Querying:


*** Non-null Data Tests against VARCHAR2***
Test 3.1: Type: default.  Length: default
  Querying:
    :2:
    ::
    :abc:
Test 3.2: Type: AFC.  Length: default
  Querying:
    :2:
    ::
    :abc:
Test 3.3: Type: AFC:  Length: 0
  Querying:
    :2:
    ::
    :abc:
Test 3.4: Type: AFC:  Length: strlen
  Querying:
    :2:
    ::
    :abc:
Test 3.5: Type: AFC.  Length: strlen-1
  Querying:
    :2:
    ::
    :abc:
Test 3.6: Type: AFC.  Length: strlen+1
  Querying:
    :2:
    ::
    :abc:


*** NULL data tests against VARCHAR2 ***
Test 4.1: Type: default.  Length: default
  Querying:
Test 4.2: Type: AFC.  Length: default
  Querying:
Test 4.3: Type: AFC:  Length: 0
  Querying:
Test 4.4: Type: AFC:  Length: strlen
  Querying:
Test 4.5: Type: AFC.  Length: strlen-1
  Querying:
Test 4.6: Type: AFC.  Length: strlen+1
  Querying:
Done

Diff

011+     :1:
012+     :abc       :
013+     ::
011-     Oci_execute error ORA-1460 Exiting Query
019-     Oci_execute error ORA-1460 Exiting Query
021+     :1:
022+     :abc       :
023+     ::
055-     Oci_execute error ORA-1460 Exiting Query
059+     :2:
060+     ::
061+     :abc:
063-     Oci_execute error ORA-1460 Exiting Query
069+     :2:
070+     ::
071+     :abc:

 

Generated at Mon, 20 Oct 2014 09:57:58 +0000 (5 days ago)

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