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/bug40415.phpt ('Bug #40415 (Using oci_fetchall with nested cursors)')

Script

1: <?php 
2:
3:
require dirname(__FILE__)."/connect.inc";
4:
5:
// Setup
6:
7:
$create_1 "CREATE TABLE t1 (id1 INTEGER)";
8:
$create_2 "CREATE TABLE t2 (id2 INTEGER)";
9:
$drop_1 "DROP TABLE t1";
10:
$drop_2 "DROP TABLE t2";
11:
12:
$s1 oci_parse($c$drop_1);
13:
$s2 oci_parse($c$drop_2);
14: @
oci_execute($s1);
15: @
oci_execute($s2);
16:
17:
$s1 oci_parse($c$create_1);
18:
$s2 oci_parse($c$create_2);
19:
oci_execute($s1);
20:
oci_execute($s2);
21:
22: for(
$i=1$i 4$i++) {
23:     
$insert "INSERT INTO t1 VALUES(1".$i.")";
24:     
$s oci_parse($c$insert);
25:     
oci_execute($s);
26: }
27:
28: for(
$i=1$i 4$i++) {
29:     
$insert "INSERT INTO t2 VALUES(2".$i.")";
30:     
$s oci_parse($c$insert);
31:     
oci_execute($s);
32: }
33:
34:
35: function 
do_assoc($c
36: {
37:     
$query "SELECT t1.*, CURSOR( SELECT * FROM t2 ) AS CURSOR FROM t1";
38:
39:     
$stmt oci_parse($c$query);
40:     
oci_execute($stmt);
41:     
42:     while (
$row oci_fetch_assoc($stmt)) {
43:         print 
"Got row \"".$row['ID1']."\". Now getting nested cursor:\n";
44:         
var_dump(oci_execute($row['CURSOR']));
45:         while (
$row_n oci_fetch_assoc($row['CURSOR']) ) {
46:             
var_dump($row_n);
47:         }
48:     }
49: }
50:
51: function 
do_all($c
52: {
53:     
$query "SELECT t1.*, CURSOR( SELECT * FROM t2 ) AS CURSOR FROM t1";
54:
55:     
$stmt oci_parse($c$query);
56:     
oci_execute($stmt);
57:     
58:     
$rc1 oci_fetch_all($stmt$res);
59:     
60:     echo 
"Rows returned $rc1\n";
61:
62:     
var_dump($res);
63:
64:     foreach (
$res['CURSOR'] as $cv) {
65:         echo 
"Getting nested cursor\n";
66:         
var_dump(oci_execute($cv));
67:         
$rc2 oci_fetch_all($cv$res2);
68:         
var_dump($res2);
69:     }
70: }
71:
72:
73:
74: echo 
"Test 1: Associate fetch of nested cursor\n";
75:
do_assoc($c);
76:
77: echo 
"\nTest 2: fetchall of nested cursor\n";
78:
do_all($c);
79:
80:
81:
// Cleanup 
82:
$s1 oci_parse($c$drop_1);
83:
$s2 oci_parse($c$drop_2);
84: @
oci_execute($s1);
85: @
oci_execute($s2);
86:
87: echo 
"Done\n";
88:
?>
89:

Expected

Test 1: Associate fetch of nested cursor
Got row "11". Now getting nested cursor:
bool(true)
array(1) {
  ["ID2"]=>
  string(2) "21"
}
array(1) {
  ["ID2"]=>
  string(2) "22"
}
array(1) {
  ["ID2"]=>
  string(2) "23"
}
Got row "12". Now getting nested cursor:
bool(true)
array(1) {
  ["ID2"]=>
  string(2) "21"
}
array(1) {
  ["ID2"]=>
  string(2) "22"
}
array(1) {
  ["ID2"]=>
  string(2) "23"
}
Got row "13". Now getting nested cursor:
bool(true)
array(1) {
  ["ID2"]=>
  string(2) "21"
}
array(1) {
  ["ID2"]=>
  string(2) "22"
}
array(1) {
  ["ID2"]=>
  string(2) "23"
}

Test 2: fetchall of nested cursor
Rows returned 3
array(2) {
  ["ID1"]=>
  array(3) {
    [0]=>
    string(2) "11"
    [1]=>
    string(2) "12"
    [2]=>
    string(2) "13"
  }
  ["CURSOR"]=>
  array(3) {
    [0]=>
    resource(%d) of type (oci8 statement)
    [1]=>
    resource(%d) of type (oci8 statement)
    [2]=>
    resource(%d) of type (oci8 statement)
  }
}
Getting nested cursor
bool(true)
array(1) {
  ["ID2"]=>
  array(3) {
    [0]=>
    string(2) "21"
    [1]=>
    string(2) "22"
    [2]=>
    string(2) "23"
  }
}
Getting nested cursor
bool(true)
array(1) {
  ["ID2"]=>
  array(3) {
    [0]=>
    string(2) "21"
    [1]=>
    string(2) "22"
    [2]=>
    string(2) "23"
  }
}
Getting nested cursor
bool(true)
array(1) {
  ["ID2"]=>
  array(3) {
    [0]=>
    string(2) "21"
    [1]=>
    string(2) "22"
    [2]=>
    string(2) "23"
  }
}
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 05:02:07
  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 05:02:07
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- Test 1: Associate fetch of nested cursor
002- Got row "11". Now getting nested cursor:
003- bool(true)
004- array(1) {
005-   ["ID2"]=>
006-   string(2) "21"
007- }
008- array(1) {
009-   ["ID2"]=>
010-   string(2) "22"
011- }
012- array(1) {
013-   ["ID2"]=>
014-   string(2) "23"
015- }
016- Got row "12". Now getting nested cursor:
017- bool(true)
018- array(1) {
019-   ["ID2"]=>
020-   string(2) "21"
021- }
022- array(1) {
023-   ["ID2"]=>
024-   string(2) "22"
025- }
026- array(1) {
027-   ["ID2"]=>
028-   string(2) "23"
029- }
030- Got row "13". Now getting nested cursor:
031- bool(true)
032- array(1) {
033-   ["ID2"]=>
034-   string(2) "21"
035- }
036- array(1) {
037-   ["ID2"]=>
038-   string(2) "22"
039- }
040- array(1) {
041-   ["ID2"]=>
042-   string(2) "23"
043- }
044- 
045- Test 2: fetchall of nested cursor
046- Rows returned 3
047- array(2) {
048-   ["ID1"]=>
049-   array(3) {
050-     [0]=>
051-     string(2) "11"
052-     [1]=>
053-     string(2) "12"
054-     [2]=>
055-     string(2) "13"
056-   }
057-   ["CURSOR"]=>
058-   array(3) {
059-     [0]=>
060-     resource(%d) of type (oci8 statement)
061-     [1]=>
062-     resource(%d) of type (oci8 statement)
063-     [2]=>
064-     resource(%d) of type (oci8 statement)
065-   }
066- }
067- Getting nested cursor
068- bool(true)
069- array(1) {
070-   ["ID2"]=>
071-   array(3) {
072-     [0]=>
073-     string(2) "21"
074-     [1]=>
075-     string(2) "22"
076-     [2]=>
077-     string(2) "23"
078-   }
079- }
080- Getting nested cursor
081- bool(true)
082- array(1) {
083-   ["ID2"]=>
084-   array(3) {
085-     [0]=>
086-     string(2) "21"
087-     [1]=>
088-     string(2) "22"
089-     [2]=>
090-     string(2) "23"
091-   }
092- }
093- Getting nested cursor
094- bool(true)
095- array(1) {
096-   ["ID2"]=>
097-   array(3) {
098-     [0]=>
099-     string(2) "21"
100-     [1]=>
101-     string(2) "22"
102-     [2]=>
103-     string(2) "23"
104-   }
105- }
106- Done

 

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

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