2
Test oci_commit failure
4
<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
8
require(dirname(__FILE__).'/connect.inc');
13
"drop table commit_002_tab",
14
"create table commit_002_tab
15
( x int constraint commit_002_tab_check_x check ( x > 0 ) deferrable initially immediate,
16
y int constraint commit_002_tab_check_y check ( y > 0 ) deferrable initially deferred)"
19
foreach ($stmtarray as $stmt) {
20
$s = oci_parse($c, $stmt);
21
$r = @oci_execute($s);
24
if (!in_array($m['code'], array( // ignore expected errors
25
942 // table or view does not exist
26
, 2289 // sequence does not exist
27
, 4080 // trigger does not exist
28
, 38802 // edition does not exist
30
echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
37
echo "First Insert\n";
38
$s = oci_parse($c, "insert into commit_002_tab values (-1, 1)");
39
$r = @oci_execute($s, OCI_DEFAULT);
42
echo 'Could not execute: '. $m['message'] . "\n";
47
echo 'Could not commit: '. $m['message'] . "\n";
51
echo "Second Insert\n";
52
$s = oci_parse($c, "insert into commit_002_tab values (1, -1)");
53
$r = @oci_execute($s, OCI_NO_AUTO_COMMIT);
56
echo 'Could not execute: '. $m['message'] . "\n";
61
echo 'Could not commit: '. $m['message'] . "\n";
68
"drop table commit_002_tab"
71
foreach ($stmtarray as $stmt) {
72
$s = oci_parse($c, $stmt);
83
Could not execute: ORA-02290: %s (%s.COMMIT_002_TAB_CHECK_X) %s
86
Warning: oci_commit(): ORA-02091: %s
87
ORA-02290: %s (%s.COMMIT_002_TAB_CHECK_Y) %s in %scommit_002.php on line %d
88
Could not commit: ORA-02091: %s
89
ORA-02290: %s (%s.COMMIT_002_TAB_CHECK_Y) %s