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

Test Failure Report for ext/oci8/tests/lob_null.phpt ('Test null data for CLOBs')

Script

1: <?php
2:
3:
require dirname(__FILE__).'/connect.inc';
4:
5:
// Initialization
6:
7:
$s oci_parse($c'drop table lob_null_tab');
8: @
oci_execute($s);
9:
10:
$s oci_parse($c'create table lob_null_tab (id number, data clob)');
11:
oci_execute($s);
12:
13:
$s oci_parse($c
14:
'create or replace procedure lob_null_proc_in (pid in number, pdata in CLOB)
15:  as begin
16:    insert into lob_null_tab (id, data) values (pid, pdata);
17:  end;'
);
18:
oci_execute($s);
19:
20:
$s oci_parse($c
21:
'create or replace procedure lob_null_proc_out (pid in number, pdata out clob)
22:    as begin
23:      select data into pdata from lob_null_tab where id = pid;
24:  end;'
);
25:
oci_execute($s);
26:
27:
// TEMPORARY CLOB
28:
29:
echo "Temporary CLOB: NULL\n";
30:
$s oci_parse($c"insert into lob_null_tab values (1, :b)");
31:
$lob oci_new_descriptor($cOCI_D_LOB);
32:
oci_bind_by_name($s':b'$lob, -1OCI_B_CLOB);
33:
$lob->writeTemporary(null);
34:
$r = @oci_execute($s);
35: if (!
$r) {
36:     
$m oci_error($s);
37:     echo 
$m['message'], "\n";
38: }   
39: else {
40:     
$lob->close();
41: }
42:
43: echo 
"Temporary CLOB: ''\n";
44:
$s oci_parse($c"insert into lob_null_tab values (2, :b)");
45:
$lob oci_new_descriptor($cOCI_D_LOB);
46:
oci_bind_by_name($s':b'$lob, -1OCI_B_CLOB);
47:
$lob->writeTemporary('');
48:
$r = @oci_execute($s);
49: if (!
$r) {
50:     
$m oci_error($s);
51:     echo 
$m['message'], "\n";
52: }   
53: else {
54:     
$lob->close();
55: }
56:
57: echo 
"Temporary CLOB: text\n";
58:
$s oci_parse($c"insert into lob_null_tab values (3, :b)");
59:
$lob oci_new_descriptor($cOCI_D_LOB);
60:
oci_bind_by_name($s':b'$lob, -1OCI_B_CLOB);
61:
$lob->writeTemporary('Inserted via SQL statement');
62:
$r = @oci_execute($s);
63: if (!
$r) {
64:     
$m oci_error($s);
65:     echo 
$m['message'], "\n";
66: }   
67: else {
68:     
$lob->close();
69: }
70:
71:
// PROCEDURE PARAMETER
72:
73:
echo "Procedure parameter: NULL\n";
74:
$s oci_parse($c"call lob_null_proc_in(4, :b)");
75:
$lob oci_new_descriptor($cOCI_D_LOB);
76:
oci_bind_by_name($s':b'$lob, -1OCI_B_CLOB);
77:
$lob->writeTemporary(null);
78:
$r = @oci_execute($s);
79: if (!
$r) {
80:     
$m oci_error($s);
81:     echo 
$m['message'], "\n";
82: }   
83: else {
84:     
$lob->close();
85: }
86:
87: echo 
"Procedure parameter: ''\n";
88:
$s oci_parse($c"call lob_null_proc_in(5, :b)");
89:
$lob oci_new_descriptor($cOCI_D_LOB);
90:
oci_bind_by_name($s':b'$lob, -1OCI_B_CLOB);
91:
$lob->writeTemporary('');
92:
$r = @oci_execute($s);
93: if (!
$r) {
94:     
$m oci_error($s);
95:     echo 
$m['message'], "\n";
96: }   
97: else {
98:     
$lob->close();
99: }
100:
101: echo 
"Procedure parameter: text\n";
102:
$s oci_parse($c"call lob_null_proc_in(6, :b)");
103:
$lob oci_new_descriptor($cOCI_D_LOB);
104:
oci_bind_by_name($s':b'$lob, -1OCI_B_CLOB);
105:
$lob->writeTemporary('Inserted via procedure parameter');
106:
$r = @oci_execute($s);
107: if (!
$r) {
108:     
$m oci_error($s);
109:     echo 
$m['message'], "\n";
110: }   
111: else {
112:     
$lob->close();
113: }
114:
115:
// RETURNING INTO
116:
117:
echo "RETURNING INTO: null\n";
118:
$s oci_parse($c"insert into lob_null_tab values (7, empty_clob()) returning data into :b");
119:
$lob oci_new_descriptor($cOCI_D_LOB);
120:
oci_bind_by_name($s':b'$lob, -1OCI_B_CLOB);
121:
oci_execute($sOCI_DEFAULT);  // Must have OCI_DEFAULT here so locator is still valid
122:
$lob->save(null);
123:
124: echo 
"RETURNING INTO: ''\n";
125:
$s oci_parse($c"insert into lob_null_tab values (8, empty_clob()) returning data into :b");
126:
$lob oci_new_descriptor($cOCI_D_LOB);
127:
oci_bind_by_name($s':b'$lob, -1OCI_B_CLOB);
128:
oci_execute($sOCI_DEFAULT);  // Must have OCI_DEFAULT here so locator is still valid
129:
$lob->save('');
130:
131: echo 
"RETURNING INTO: text\n";
132:
$s oci_parse($c"insert into lob_null_tab values (9, empty_clob()) returning data into :b");
133:
$lob oci_new_descriptor($cOCI_D_LOB);
134:
oci_bind_by_name($s':b'$lob, -1OCI_B_CLOB);
135:
oci_execute($sOCI_DEFAULT);  // Must have OCI_DEFAULT here so locator is still valid
136:
$lob->save('Inserted with RETURNING INTO');
137:
138: echo 
"Fetch as string\n";
139:
$s oci_parse ($c'select id, data from lob_null_tab order by id');
140:
oci_execute($s);
141:
oci_fetch_all($s$res);
142:
var_dump($res);
143:
144: echo 
"\nFetch as a descriptor\n";
145:
$s oci_parse ($c'select id, data from lob_null_tab order by id');
146:
oci_execute($s);
147: while (
$arr oci_fetch_assoc($s)) {
148:     if (
is_object($arr['DATA'])) {
149:         echo 
$arr['ID'] . " is an object: ";
150:         
$r $arr['DATA']->load();
151:         
var_dump($r);
152:     }
153:     else {
154:         echo 
$arr['ID'] . " is not an object\n";
155:     }
156: }
157:
158: echo 
"\nFetch via the procedure parameter\n";
159: for (
$i 1$i <= 9$i++)
160: {
161:     
$s oci_parse ($c"call lob_null_proc_out($i, :b)");
162:     
$lob oci_new_descriptor($cOCI_D_LOB);
163:     
oci_bind_by_name($s':b'$lob, -1OCI_B_CLOB);
164:     
oci_execute($s);
165:     if (
is_object($lob)) {
166:         echo 
$i " is an object: ";
167:         
$r $lob->load();
168:         
var_dump($r);
169:     }
170:     else {
171:         echo 
$i " is not an object\n";
172:     }
173: }
174:
175:
// Cleanup
176:
177:
$s oci_parse($c'drop table lob_null_tab');
178: @
oci_execute($s);
179:
180: echo 
"Done\n";
181:
182:
?>
183:

Expected

Temporary CLOB: NULL
Temporary CLOB: ''
Temporary CLOB: text
Procedure parameter: NULL
Procedure parameter: ''
Procedure parameter: text
RETURNING INTO: null
RETURNING INTO: ''
RETURNING INTO: text
Fetch as string
array(2) {
  ["ID"]=>
  array(9) {
    [0]=>
    string(1) "1"
    [1]=>
    string(1) "2"
    [2]=>
    string(1) "3"
    [3]=>
    string(1) "4"
    [4]=>
    string(1) "5"
    [5]=>
    string(1) "6"
    [6]=>
    string(1) "7"
    [7]=>
    string(1) "8"
    [8]=>
    string(1) "9"
  }
  ["DATA"]=>
  array(9) {
    [0]=>
    string(0) ""
    [1]=>
    string(0) ""
    [2]=>
    string(26) "Inserted via SQL statement"
    [3]=>
    string(0) ""
    [4]=>
    string(0) ""
    [5]=>
    string(32) "Inserted via procedure parameter"
    [6]=>
    string(0) ""
    [7]=>
    string(0) ""
    [8]=>
    string(28) "Inserted with RETURNING INTO"
  }
}

Fetch as a descriptor
1 is an object: string(0) ""
2 is an object: string(0) ""
3 is an object: string(26) "Inserted via SQL statement"
4 is an object: string(0) ""
5 is an object: string(0) ""
6 is an object: string(32) "Inserted via procedure parameter"
7 is an object: string(0) ""
8 is an object: string(0) ""
9 is an object: string(28) "Inserted with RETURNING INTO"

Fetch via the procedure parameter
1 is an object: string(0) ""
2 is an object: string(0) ""
3 is an object: string(26) "Inserted via SQL statement"
4 is an object: string(0) ""
5 is an object: string(0) ""
6 is an object: string(32) "Inserted via procedure parameter"
7 is an object: string(0) ""
8 is an object: string(0) ""
9 is an object: string(28) "Inserted with RETURNING INTO"
Done

Output

***********************************************************************
Fatal NI connect error 12541, connecting to:
 (DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=XE)(CID=(PROGRAM=php)(HOST=nex2.php.net)(USER=nlopess)))(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521)))

  VERSION INFORMATION:
	TNS for Linux: Version 11.2.0.2.0 - Beta
	TCP/IP NT Protocol Adapter for Linux: Version 11.2.0.2.0 - Beta
  Time: 17-JUN-2018 06:01:58
  Tracing not turned on.
  Tns error struct:
    ns main err code: 12541
    TNS-12541: TNS:no listener
    ns secondary err code: 12560
    nt main err code: 511
    TNS-00511: No listener

Fatal error: connect.inc: Failed to connect as 'system' to 'localhost/XE': ORA-12541: TNS:no listener in /var/php_gcov/PHP_HEAD/ext/oci8/tests/connect.inc on line 14
    nt secondary err code: 111
    nt OS err code: 0

Diff

001+ ***********************************************************************
002+ Fatal NI connect error 12541, connecting to:
003+  (DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=XE)(CID=(PROGRAM=php)(HOST=nex2.php.net)(USER=nlopess)))(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521)))
004+ 
005+   VERSION INFORMATION:
006+ 	TNS for Linux: Version 11.2.0.2.0 - Beta
007+ 	TCP/IP NT Protocol Adapter for Linux: Version 11.2.0.2.0 - Beta
008+   Time: 17-JUN-2018 06:01:58
009+   Tracing not turned on.
010+   Tns error struct:
011+     ns main err code: 12541
012+     TNS-12541: TNS:no listener
013+     ns secondary err code: 12560
014+     nt main err code: 511
015+     TNS-00511: No listener
016+ 
017+ Fatal error: connect.inc: Failed to connect as 'system' to 'localhost/XE': ORA-12541: TNS:no listener in /var/php_gcov/PHP_HEAD/ext/oci8/tests/connect.inc on line 14
018+     nt secondary err code: 111
019+     nt OS err code: 0
001- Temporary CLOB: NULL
002- Temporary CLOB: ''
003- Temporary CLOB: text
004- Procedure parameter: NULL
005- Procedure parameter: ''
006- Procedure parameter: text
007- RETURNING INTO: null
008- RETURNING INTO: ''
009- RETURNING INTO: text
010- Fetch as string
011- array(2) {
012-   ["ID"]=>
013-   array(9) {
014-     [0]=>
015-     string(1) "1"
016-     [1]=>
017-     string(1) "2"
018-     [2]=>
019-     string(1) "3"
020-     [3]=>
021-     string(1) "4"
022-     [4]=>
023-     string(1) "5"
024-     [5]=>
025-     string(1) "6"
026-     [6]=>
027-     string(1) "7"
028-     [7]=>
029-     string(1) "8"
030-     [8]=>
031-     string(1) "9"
032-   }
033-   ["DATA"]=>
034-   array(9) {
035-     [0]=>
036-     string(0) ""
037-     [1]=>
038-     string(0) ""
039-     [2]=>
040-     string(26) "Inserted via SQL statement"
041-     [3]=>
042-     string(0) ""
043-     [4]=>
044-     string(0) ""
045-     [5]=>
046-     string(32) "Inserted via procedure parameter"
047-     [6]=>
048-     string(0) ""
049-     [7]=>
050-     string(0) ""
051-     [8]=>
052-     string(28) "Inserted with RETURNING INTO"
053-   }
054- }
055- 
056- Fetch as a descriptor
057- 1 is an object: string(0) ""
058- 2 is an object: string(0) ""
059- 3 is an object: string(26) "Inserted via SQL statement"
060- 4 is an object: string(0) ""
061- 5 is an object: string(0) ""
062- 6 is an object: string(32) "Inserted via procedure parameter"
063- 7 is an object: string(0) ""
064- 8 is an object: string(0) ""
065- 9 is an object: string(28) "Inserted with RETURNING INTO"
066- 
067- Fetch via the procedure parameter
068- 1 is an object: string(0) ""
069- 2 is an object: string(0) ""
070- 3 is an object: string(26) "Inserted via SQL statement"
071- 4 is an object: string(0) ""
072- 5 is an object: string(0) ""
073- 6 is an object: string(32) "Inserted via procedure parameter"
074- 7 is an object: string(0) ""
075- 8 is an object: string(0) ""
076- 9 is an object: string(28) "Inserted with RETURNING INTO"
077- Done

 

Generated at Mon, 18 Jun 2018 17:33:50 +0000 (2 days ago)

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