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/refcur_prefetch_4.phpt ('Prefetch with REF cursor. Test No 4')

Script

1: <?php
2:
require dirname(__FILE__)."/connect.inc";
3:
4:
// Creates the necessary package and tables. 
5:
$stmtarray = array(
6:        
"DROP TABLE refcurtest",
7:
8:        
"CREATE TABLE refcurtest (c1 NUMBER, c2 VARCHAR(20))",
9:
10:        
"CREATE or REPLACE PACKAGE refcurpkg is
11:            type refcursortype is ref cursor;
12:            procedure open_ref_cur(cur1 out refcursortype);
13:            procedure fetch_ref_cur(cur1 in refcursortype, c1 out number, c2 out varchar2);
14:         end refcurpkg;"
,
15:
16:        
"CREATE or REPLACE PACKAGE body refcurpkg is
17:           procedure open_ref_cur(cur1 out refcursortype) is
18:           begin
19:             open cur1 for select * from refcurtest order by c1;
20:           end open_ref_cur;
21:            procedure fetch_ref_cur(cur1 in refcursortype, c1 out number, c2 out varchar2) is
22:             begin
23:             fetch cur1 into c1,c2;
24:             end fetch_ref_cur;
25:          end refcurpkg;"
26:     
);
27:
28:
oci8_test_sql_execute($c$stmtarray);
29:
30:
// Insert 500 rows into the table.
31:
$insert_sql "INSERT INTO refcurtest (c1, c2) VALUES (:c1,:c2)";
32: if (!(
$s oci_parse($c$insert_sql))) {
33:     die(
"oci_parse(insert) failed!\n");
34: }
35:
36: for (
$i 0$i <= 500$i++) {
37:     
$val2 'test'.$i;
38:     
oci_bind_by_name($s,':c1',$i);
39:     
oci_bind_by_name($s,':c2',$val2);
40:     if (!
oci_execute($s)) {
41:         die(
"oci_execute(insert) failed!\n");
42:     }
43: }
44:
45:
// Steps to Fetch from PHP . For every sub-test,the cursor is bound and then executed.
46:
47:
$sql1 "begin refcurpkg.open_ref_cur(:cur1); end;";
48:
$s1 oci_parse($c,$sql1);
49:
$cur1 oci_new_cursor($c);
50: if (!
oci_bind_by_name($s1,":cur1",$cur1,-1,SQLT_RSET)) {
51:     die(
"oci_bind_by_name(sql1) failed!\n");
52: }
53:
54:
55:
// Steps to Fetch from PL/SQL . For every sub-test,the cursor is bound and then executed.
56:
57:
$sql2 "begin refcurpkg.fetch_ref_cur(:curs1,:c1,:c2); end;";
58:
$s2 oci_parse($c,$sql2);
59: if (!
oci_bind_by_name($s2":curs1"$cur1, -1SQLT_RSET)) {
60:     die(
"oci_bind_by_name(sql2) failed!\n");
61: }
62: if (!
oci_bind_by_name($s2":c1"$c1, -1SQLT_INT)) {
63:     die(
"oci_bind_by_name(sql2) failed!\n");
64: }
65: if (!
oci_bind_by_name($s2":c2"$c220SQLT_CHR)) {
66:     die(
"oci_bind_by_name(sql2) failed!\n");
67: }
68:
69:
70: echo 
"------Test 1 - Set Prefetch after PL/SQL fetch ----------\n";
71:
$cur1 oci_new_cursor($c);
72:
// Fetch from PL/SQL 
73:
if (!oci_bind_by_name($s2,":curs1",$cur1,-1,SQLT_RSET)) {
74:     die(
"oci_bind_by_name(sql2) failed!\n");
75: }
76:
oci_execute($s2);
77: echo 
"Fetch Row from PL/SQL\n";
78:
var_dump($c1);
79:
var_dump($c2);
80:
81:
// Fetch from PHP
82:
echo "Fetch Row from PHP\n";
83: if (!
oci_bind_by_name($s1,":cur1",$cur1,-1,SQLT_RSET)) {
84:     die(
"oci_bind_by_name(sql1) failed!\n");
85: }
86:
oci_set_prefetch($cur1,5);
87:
oci_execute($s1);
88:
oci_execute($cur1);
89:
var_dump(oci_fetch_row($cur1));
90:
91: echo 
"------Test 2- Overwrite prefetch-----------\n";
92:
// Fetch from PHP
93:
$cur1 oci_new_cursor($c);
94: if (!
oci_bind_by_name($s1,":cur1",$cur1,-1,SQLT_RSET)) {
95:     die(
"oci_bind_by_name(sql1) failed!\n");
96: }
97: echo 
"Fetch Row from PHP\n";
98:
oci_execute($s1);
99:
oci_execute($cur1);
100:
var_dump(oci_fetch_row($cur1));
101:
oci_set_prefetch($cur1,5);
102:
oci_set_prefetch($cur1,0);
103:
oci_set_prefetch($cur1,100);
104:
105:
// Fetch from PL/SQL
106:
if (!oci_bind_by_name($s2,":curs1",$cur1,-1,SQLT_RSET)) {
107:     die(
"oci_bind_by_name(sql2) failed!\n");
108: }
109:
oci_execute($s2);
110: echo 
"Fetch Row from PL/SQL\n";
111:
var_dump($c1);
112:
var_dump($c2);
113:
114:
115: function  
print_roundtrips($c) {
116:     
$sql_stmt "select value from v\$mystat a,v\$statname c where
117:      a.statistic#=c.statistic# and c.name='SQL*Net roundtrips to/from client'"
;
118:     
$s oci_parse($c,$sql_stmt);
119:     
oci_define_by_name($s,"VALUE",$value);
120:     
oci_execute($s);
121:     
oci_fetch($s);
122:     return 
$value;
123: }
124:
125:
// Clean up  here
126:
127:
$stmtarray = array(
128:     
"drop package refcurpkg",
129:     
"drop table refcurtest"
130:
);
131:
132:
oci8_test_sql_execute($c$stmtarray);
133:
134: echo 
"Done\n";
135:
?>
136:

Expected

------Test 1 - Set Prefetch after PL/SQL fetch ----------

Warning: oci_execute(): ORA-01001: %s
ORA-06512: at "%s.REFCURPKG", line %d
ORA-06512: at line %d in %s on line %d
Fetch Row from PL/SQL
int(0)
NULL
Fetch Row from PHP
array(2) {
  [0]=>
  string(1) "0"
  [1]=>
  string(5) "test0"
}
------Test 2- Overwrite prefetch-----------
Fetch Row from PHP
array(2) {
  [0]=>
  string(1) "0"
  [1]=>
  string(5) "test0"
}
Fetch Row from PL/SQL
int(101)
string(%d) "test101"
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:09:38
  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)))
001- ------Test 1 - Set Prefetch after PL/SQL fetch ----------
003- Warning: oci_execute(): ORA-01001: %s
004- ORA-06512: at "%s.REFCURPKG", line %d
005- ORA-06512: at line %d in %s on line %d
006- Fetch Row from PL/SQL
007- int(0)
008- NULL
009- Fetch Row from PHP
010- array(2) {
011-   [0]=>
012-   string(1) "0"
013-   [1]=>
014-   string(5) "test0"
015- }
016- ------Test 2- Overwrite prefetch-----------
017- Fetch Row from PHP
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:09:38
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
018- array(2) {
019-   [0]=>
020-   string(1) "0"
021-   [1]=>
022-   string(5) "test0"
023- }
024- Fetch Row from PL/SQL
025- int(101)
026- string(%d) "test101"
027- Done

 

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

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