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/pdo_oci/tests/bug57702.phpt ('PDO OCI Bug #57702 (Multi-row BLOB fetches)')

Script

1: <?php
2:
3:
require('ext/pdo/tests/pdo_test.inc');
4:
$db PDOTest::test_factory('ext/pdo_oci/tests/common.phpt');
5:
6:
// Note the PDO test setup sets PDO::ATTR_STRINGIFY_FETCHES to true
7: // (and sets PDO::ATTR_CASE to PDO::CASE_LOWER)
8:
9:
$query "begin execute immediate 'drop table bug57702'; exception when others then if sqlcode <> -942 then raise; end if; end;";
10:
$stmt $db->prepare($query);
11:
$stmt->execute();
12:
13:
$query "create table bug57702 (id number, data1 blob, data2 blob)";
14:
$stmt $db->prepare($query);
15:
$stmt->execute();
16:
17: function 
do_insert($db$id$data1$data2)
18: {
19:     
$db->beginTransaction(); 
20:     
$stmt $db->prepare("insert into bug57702 (id, data1, data2) values (:id, empty_blob(), empty_blob()) returning data1, data2 into :blob1, :blob2");
21:     
$stmt->bindParam(':id'$id);
22:     
$stmt->bindParam(':blob1'$blob1PDO::PARAM_LOB);
23:     
$stmt->bindParam(':blob2'$blob2PDO::PARAM_LOB);
24:     
$blob1 null;
25:     
$blob2 null;
26:     
$stmt->execute();
27:
28:     
fwrite($blob1$data1);  
29:     
fclose($blob1);
30:     
fwrite($blob2$data2);  
31:     
fclose($blob2);    
32:     
$db->commit();
33: }
34:
35:
do_insert($db1"row 1 col 1""row 1 col 2");
36:
do_insert($db2"row 2 col 1""row 2 col 2");
37:
38:
////////////////////
39:
40:
echo "First Query\n";
41:
42:
// Fetch it back
43:
$stmt $db->prepare('select data1, data2 from bug57702 order by id');
44:
$stmt->execute();
45:
$row $stmt->fetch(PDO::FETCH_ASSOC);
46:
var_dump($row['data1']);
47:
var_dump($row['data2']);
48:
$row $stmt->fetch(PDO::FETCH_ASSOC);
49:
var_dump($row['data1']);
50:
var_dump($row['data2']);
51:
52:
////////////////////
53:
54:
echo "\nSecond Query\n";
55:
56: foreach(
$db->query("select data1 as d1, data2 as d2 from bug57702 order by id") as $row) {
57:     
var_dump($row['d1']);
58:     
var_dump($row['d2']);
59: }
60:
61:
////////////////////
62:
63:
echo "\nThird Query\n";
64:
65:
$stmt $db->prepare('select data1 as d3_1, data2 as d3_2 from bug57702 order by id');
66:
67:
$rs $stmt->execute();
68:
$stmt->bindColumn('d3_1' $clob1PDO::PARAM_LOB);
69:
$stmt->bindColumn('d3_2' $clob2PDO::PARAM_LOB);
70:
71: while (
$stmt->fetch(PDO::FETCH_BOUND)) {
72:     
var_dump($clob1);
73:     
var_dump($clob2);
74: }
75:
76:
////////////////////
77:
78:
echo "\nFourth Query\n"
79:
80:
$a = array();
81:
$i 0;
82: foreach(
$db->query("select data1 as d4_1, data2 as d4_2 from bug57702 order by id") as $row) {
83:     
$a[$i][0] = $row['d4_1'];
84:     
$a[$i][1] = $row['d4_2'];
85:     
$i++;
86: }
87:
88: for (
$i 0$i count($a); $i++) {
89:     
var_dump($a[$i][0]);
90:     
var_dump($a[$i][1]);
91: }
92:
93:
////////////////////
94:
95:
echo "\nFifth Query\n"
96:
97:
$db->setAttribute(PDO::ATTR_STRINGIFY_FETCHESfalse);  // Let's use streams
98:
99: // Since each column only has one lob descriptor, the last row is
100: // shown twice because the lob descriptor for each column is reused in
101: // the stream
102:
103:
$a = array();
104:
$i 0;
105: foreach(
$db->query("select data1 as d4_1, data2 as d4_2 from bug57702 order by id") as $row) {
106:     
$a[$i][0] = $row['d4_1'];
107:     
$a[$i][1] = $row['d4_2'];
108:     
$i++;
109: }
110:
111: for (
$i 0$i count($a); $i++) {
112:     
var_dump(stream_get_contents($a[$i][0]));
113:     
var_dump(stream_get_contents($a[$i][1]));
114: }
115:
116:
////////////////////
117:
118:
echo "\nSixth Query\n"
119:
120:
$db->setAttribute(PDO::ATTR_STRINGIFY_FETCHESfalse);  // Let's use streams
121:
122:
$a = array();
123:
$i 0;
124: foreach(
$db->query("select data1 as d4_1, data2 as d4_2 from bug57702 order by id") as $row) {
125:     
$a[$i][0] = $row['d4_1'];
126:     
$a[$i][1] = $row['d4_2'];
127:     
var_dump(stream_get_contents($a[$i][0]));
128:     
var_dump(stream_get_contents($a[$i][1]));
129:     
$i++;
130: }
131:
132:
// Cleanup
133:
$query "drop table bug57702";
134:
$stmt $db->prepare($query);
135:
$stmt->execute();
136:
137: print 
"done\n";
138:
139:
?>
140:

Expected

First Query
string(11) "row 1 col 1"
string(11) "row 1 col 2"
string(11) "row 2 col 1"
string(11) "row 2 col 2"

Second Query
string(11) "row 1 col 1"
string(11) "row 1 col 2"
string(11) "row 2 col 1"
string(11) "row 2 col 2"

Third Query
string(11) "row 1 col 1"
string(11) "row 1 col 2"
string(11) "row 2 col 1"
string(11) "row 2 col 2"

Fourth Query
string(11) "row 1 col 1"
string(11) "row 1 col 2"
string(11) "row 2 col 1"
string(11) "row 2 col 2"

Fifth Query
string(11) "row 2 col 1"
string(11) "row 2 col 2"
string(11) "row 2 col 1"
string(11) "row 2 col 2"

Sixth Query
string(11) "row 1 col 1"
string(11) "row 1 col 2"
string(11) "row 2 col 1"
string(11) "row 2 col 2"
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 09:33:41
  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: Uncaught PDOException: SQLSTATE[HY000]: pdo_oci_handle_factory: ORA-12541: TNS:no listener
 (/var/php_gcov/PHP_HEAD/ext/pdo_oci/oci_driver.c:634) in /var/php_gcov/PHP_HEAD/ext/pdo/tests/pdo_test.inc:35
Stack trace:
#0 /var/php_gcov/PHP_HEAD/ext/pdo/tests/pdo_test.inc(35): PDO->__construct('oci:dbname=//lo...', 'system', 'oracle', NULL)
#1 /var/php_gcov/PHP_HEAD/ext/pdo/tests/pdo_test.inc(73): PDOTest::factory()
#2 /var/php_gcov/PHP_HEAD/ext/pdo_oci/tests/bug57702.php(4): PDOTest::test_factory('ext/pdo_oci/tes...')
#3 {main}
  thrown in /var/php_gcov/PHP_HEAD/ext/pdo/tests/pdo_test.inc on line 35
    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)))
001- First Query
002- string(11) "row 1 col 1"
003- string(11) "row 1 col 2"
004- string(11) "row 2 col 1"
005- string(11) "row 2 col 2"
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 09:33:41
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
007- Second Query
008- string(11) "row 1 col 1"
009- string(11) "row 1 col 2"
010- string(11) "row 2 col 1"
011- string(11) "row 2 col 2"
013- Third Query
014- string(11) "row 1 col 1"
015- string(11) "row 1 col 2"
016- string(11) "row 2 col 1"
017- string(11) "row 2 col 2"
018- 
019- Fourth Query
020- string(11) "row 1 col 1"
021- string(11) "row 1 col 2"
022- string(11) "row 2 col 1"
017+ Fatal error: Uncaught PDOException: SQLSTATE[HY000]: pdo_oci_handle_factory: ORA-12541: TNS:no listener
018+  (/var/php_gcov/PHP_HEAD/ext/pdo_oci/oci_driver.c:634) in /var/php_gcov/PHP_HEAD/ext/pdo/tests/pdo_test.inc:35
019+ Stack trace:
020+ #0 /var/php_gcov/PHP_HEAD/ext/pdo/tests/pdo_test.inc(35): PDO->__construct('oci:dbname=//lo...', 'system', 'oracle', NULL)
021+ #1 /var/php_gcov/PHP_HEAD/ext/pdo/tests/pdo_test.inc(73): PDOTest::factory()
022+ #2 /var/php_gcov/PHP_HEAD/ext/pdo_oci/tests/bug57702.php(4): PDOTest::test_factory('ext/pdo_oci/tes...')
023+ #3 {main}
024+   thrown in /var/php_gcov/PHP_HEAD/ext/pdo/tests/pdo_test.inc on line 35
025+     nt secondary err code: 111
026+     nt OS err code: 0
023- string(11) "row 2 col 2"
024- 
025- Fifth Query
026- string(11) "row 2 col 1"
027- string(11) "row 2 col 2"
028- string(11) "row 2 col 1"
029- string(11) "row 2 col 2"
030- 
031- Sixth Query
032- string(11) "row 1 col 1"
033- string(11) "row 1 col 2"
034- string(11) "row 2 col 1"
035- string(11) "row 2 col 2"
036- done

 

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

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