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_2.phpt ('Prefetch with REF cursor. Test No 2')

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

Expected

------Test 1- Check Roundtrips with  prefetch 0 and 5 -----------
array(2) {
  [0]=>
  string(1) "0"
  [1]=>
  string(5) "test0"
}
array(2) {
  [0]=>
  string(1) "1"
  [1]=>
  string(5) "test1"
}
array(2) {
  [0]=>
  string(1) "2"
  [1]=>
  string(5) "test2"
}
array(2) {
  [0]=>
  string(1) "3"
  [1]=>
  string(5) "test3"
}
array(2) {
  [0]=>
  string(1) "4"
  [1]=>
  string(5) "test4"
}
Number of roundtrips made with prefetch count 0 for 5 rows is  6
array(2) {
  [0]=>
  string(1) "5"
  [1]=>
  string(5) "test5"
}
array(2) {
  [0]=>
  string(1) "6"
  [1]=>
  string(5) "test6"
}
array(2) {
  [0]=>
  string(1) "7"
  [1]=>
  string(5) "test7"
}
array(2) {
  [0]=>
  string(1) "8"
  [1]=>
  string(5) "test8"
}
array(2) {
  [0]=>
  string(1) "9"
  [1]=>
  string(5) "test9"
}
Number of roundtrips made with prefetch count 5 for 5 rows is  2
------Test 2 - Set Prefetch before PL/SQL fetch ----------
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:08
  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:09:08
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- Check Roundtrips with  prefetch 0 and 5 -----------
002- array(2) {
003-   [0]=>
004-   string(1) "0"
005-   [1]=>
006-   string(5) "test0"
007- }
008- array(2) {
009-   [0]=>
010-   string(1) "1"
011-   [1]=>
012-   string(5) "test1"
013- }
014- array(2) {
015-   [0]=>
016-   string(1) "2"
017-   [1]=>
018-   string(5) "test2"
019- }
020- array(2) {
021-   [0]=>
022-   string(1) "3"
023-   [1]=>
024-   string(5) "test3"
025- }
026- array(2) {
027-   [0]=>
028-   string(1) "4"
029-   [1]=>
030-   string(5) "test4"
031- }
032- Number of roundtrips made with prefetch count 0 for 5 rows is  6
033- array(2) {
034-   [0]=>
035-   string(1) "5"
036-   [1]=>
037-   string(5) "test5"
038- }
039- array(2) {
040-   [0]=>
041-   string(1) "6"
042-   [1]=>
043-   string(5) "test6"
044- }
045- array(2) {
046-   [0]=>
047-   string(1) "7"
048-   [1]=>
049-   string(5) "test7"
050- }
051- array(2) {
052-   [0]=>
053-   string(1) "8"
054-   [1]=>
055-   string(5) "test8"
056- }
057- array(2) {
058-   [0]=>
059-   string(1) "9"
060-   [1]=>
061-   string(5) "test9"
062- }
063- Number of roundtrips made with prefetch count 5 for 5 rows is  2
064- ------Test 2 - Set Prefetch before PL/SQL fetch ----------
065- Fetch Row from PHP
066- array(2) {
067-   [0]=>
068-   string(1) "0"
069-   [1]=>
070-   string(5) "test0"
071- }
072- Fetch Row from PL/SQL
073- int(101)
074- string(%d) "test101"
075- Done

 

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

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