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/imp_res_insert.phpt ('Oracle Database 12c Implicit Result Sets: Commit modes')

Script

1: <?php
2:
3:
require(dirname(__FILE__).'/connect.inc');
4:
5:
// Initialization
6:
7:
$c2 oci_new_connect($user$password$dbase);
8:
9:
$stmtarray = array(
10:     
"drop table imp_res_insert_tab",
11:     
"create table imp_res_insert_tab (c1 number)",
12:
13:     
"create or replace procedure imp_res_insert_proc_nc (p1 in number) as
14:       c1 sys_refcursor;
15:     begin
16:       execute immediate 'insert into imp_res_insert_tab values ('||p1||')';
17:       open c1 for select * from imp_res_insert_tab order by 1;
18:       dbms_sql.return_result(c1);
19:     end;"
,
20:
21:     
"create or replace procedure imp_res_insert_proc_c (p1 in number) as
22:       c1 sys_refcursor;
23:     begin
24:       execute immediate 'insert into imp_res_insert_tab values ('||p1||')';
25:       commit;
26:       open c1 for select * from imp_res_insert_tab order by 1;
27:       dbms_sql.return_result(c1);
28:     end;"
29:
30:
);
31:
32:
oci8_test_sql_execute($c$stmtarray);
33:
34:
// Run Test
35:
36:
echo "Test 1 - No commit in procedure, OCI_COMMIT_ON_SUCCESS mode\n";
37:
$s oci_parse($c"begin imp_res_insert_proc_nc(111); end;");
38:
oci_execute($sOCI_COMMIT_ON_SUCCESS);
39: while ((
$row oci_fetch_row($s)) !== false)
40:     echo 
$row[0], "\n";
41:
$s2 oci_parse($c2"select * from imp_res_insert_tab order by 1");
42:
oci_execute($s2OCI_NO_AUTO_COMMIT);
43:
oci_fetch_all($s2$res);
44:
var_dump($res['C1']);
45:
46: echo 
"\nTest 2 - No commit in procedure, OCI_NO_AUTO_COMMIT mode\n";
47:
$s oci_parse($c"begin imp_res_insert_proc_nc(222); end;");
48:
oci_execute($sOCI_NO_AUTO_COMMIT);
49: while ((
$row oci_fetch_row($s)) !== false)
50:     echo 
$row[0], "\n";
51:
// The 2nd connection won't see the newly inserted data
52:
$s2 oci_parse($c2"select * from imp_res_insert_tab order by 1");
53:
oci_execute($s2OCI_NO_AUTO_COMMIT);
54:
oci_fetch_all($s2$res);
55:
var_dump($res['C1']);
56:
57: echo 
"\nTest 3 - Commit in procedure, OCI_COMMIT_ON_SUCCESS mode\n";
58:
$s oci_parse($c"begin imp_res_insert_proc_c(333); end;");
59:
oci_execute($sOCI_COMMIT_ON_SUCCESS);
60:
// The 2nd connection will now see the previously uncommitted data inserted in the previous test
61:
while (($row oci_fetch_row($s)) !== false)
62:     echo 
$row[0], "\n";
63:
$s2 oci_parse($c2"select * from imp_res_insert_tab order by 1");
64:
oci_execute($s2OCI_NO_AUTO_COMMIT);
65:
oci_fetch_all($s2$res);
66:
var_dump($res['C1']);
67:
68: echo 
"\nTest 4 - Commit in procedure, OCI_NO_AUTO_COMMIT mode\n";
69:
$s oci_parse($c"begin imp_res_insert_proc_c(444); end;");
70:
oci_execute($sOCI_NO_AUTO_COMMIT);
71: while ((
$row oci_fetch_row($s)) !== false)
72:     echo 
$row[0], "\n";
73:
$s2 oci_parse($c2"select * from imp_res_insert_tab order by 1");
74:
oci_execute($s2OCI_NO_AUTO_COMMIT);
75:
oci_fetch_all($s2$res);
76:
var_dump($res['C1']);
77:
78:
// Clean up
79:
80:
$stmtarray = array(
81:     
"drop procedure imp_res_insert_proc_nc",
82:     
"drop procedure imp_res_insert_proc_c",
83:     
"drop table imp_res_insert_tab",
84: );
85:
86:
oci8_test_sql_execute($c$stmtarray);
87:
88:
?>
89:
===DONE===
90:

Expected

Test 1 - No commit in procedure, OCI_COMMIT_ON_SUCCESS mode
111
array(1) {
  [0]=>
  string(3) "111"
}

Test 2 - No commit in procedure, OCI_NO_AUTO_COMMIT mode
111
222
array(1) {
  [0]=>
  string(3) "111"
}

Test 3 - Commit in procedure, OCI_COMMIT_ON_SUCCESS mode
111
222
333
array(3) {
  [0]=>
  string(3) "111"
  [1]=>
  string(3) "222"
  [2]=>
  string(3) "333"
}

Test 4 - Commit in procedure, OCI_NO_AUTO_COMMIT mode
111
222
333
444
array(4) {
  [0]=>
  string(3) "111"
  [1]=>
  string(3) "222"
  [2]=>
  string(3) "333"
  [3]=>
  string(3) "444"
}
===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:49:52
  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 - No commit in procedure, OCI_COMMIT_ON_SUCCESS mode
002- 111
003- array(1) {
004-   [0]=>
005-   string(3) "111"
006- }
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:49:52
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
008- Test 2 - No commit in procedure, OCI_NO_AUTO_COMMIT mode
009- 111
010- 222
011- array(1) {
012-   [0]=>
013-   string(3) "111"
014- }
016- Test 3 - Commit in procedure, OCI_COMMIT_ON_SUCCESS mode
017- 111
018- 222
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
019- 333
020- array(3) {
021-   [0]=>
022-   string(3) "111"
023-   [1]=>
024-   string(3) "222"
025-   [2]=>
026-   string(3) "333"
027- }
028- 
029- Test 4 - Commit in procedure, OCI_NO_AUTO_COMMIT mode
030- 111
031- 222
032- 333
033- 444
034- array(4) {
035-   [0]=>
036-   string(3) "111"
037-   [1]=>
038-   string(3) "222"
039-   [2]=>
040-   string(3) "333"
041-   [3]=>
042-   string(3) "444"
043- }
044- ===DONE===

 

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

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