1--TEST-- 2Test oci_commit failure 3--EXTENSIONS-- 4oci8 5--SKIPIF-- 6<?php 7$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs 8require(__DIR__.'/skipif.inc'); 9?> 10--FILE-- 11<?php 12 13require(__DIR__.'/connect.inc'); 14 15// Initialization 16 17$stmtarray = array( 18 "drop table commit_002_tab", 19 "create table commit_002_tab 20 ( x int constraint commit_002_tab_check_x check ( x > 0 ) deferrable initially immediate, 21 y int constraint commit_002_tab_check_y check ( y > 0 ) deferrable initially deferred)" 22); 23 24oci8_test_sql_execute($c, $stmtarray); 25 26// Run Test 27 28echo "First Insert\n"; 29$s = oci_parse($c, "insert into commit_002_tab values (-1, 1)"); 30$r = @oci_execute($s, OCI_DEFAULT); 31if (!$r) { 32 $m = oci_error($s); 33 echo 'Could not execute: '. $m['message'] . "\n"; 34} 35$r = oci_commit($c); 36if (!$r) { 37 $m = oci_error($c); 38 echo 'Could not commit: '. $m['message'] . "\n"; 39} 40 41 42echo "Second Insert\n"; 43$s = oci_parse($c, "insert into commit_002_tab values (1, -1)"); 44$r = @oci_execute($s, OCI_NO_AUTO_COMMIT); 45if (!$r) { 46 $m = oci_error($s); 47 echo 'Could not execute: '. $m['message'] . "\n"; 48} 49$r = oci_commit($c); 50if (!$r) { 51 $m = oci_error($c); 52 echo 'Could not commit: '. $m['message'] . "\n"; 53} 54 55 56// Clean up 57 58$stmtarray = array( 59 "drop table commit_002_tab" 60); 61 62oci8_test_sql_execute($c, $stmtarray); 63 64?> 65--EXPECTF-- 66First Insert 67Could not execute: ORA-02290: %s (%s.COMMIT_002_TAB_CHECK_X) %s 68Second Insert 69 70Warning: oci_commit(): ORA-02091: %s 71ORA-02290: %s (%s.COMMIT_002_TAB_CHECK_Y) %s in %scommit_002.php on line %d 72Could not commit: ORA-02091: %s 73ORA-02290: %s (%s.COMMIT_002_TAB_CHECK_Y) %s 74