oci_commit always returns true even when the transaction fails.

[email protected] (ZeYuan Zhang)
Newsgroups php.db
Message-ID <[email protected]>
Hi there.

Why oci_commit function always returns true even when the transaction fails.
I just copied the code in the php manual [Example 1636. oci_commit() example],
and runned it, the situation is as follows:

* The statements do commit at the moment when oci_commit executes.
* But some statements are committed to oracle successfully, when some fails.
  I think it cannot be called a transaction, and I did used
OCI_DEFAULT in the oci_execute function.

Code:
<?php
$conn = oci_connect('scott', 'tiger');
$stmt = oci_parse($conn, "INSERT INTO employees (name, surname) VALUES
('Maxim', 'Maletsky')");
oci_execute($stmt, OCI_DEFAULT);
$committed = oci_commit($conn);

if (!$committed) {
    $error = oci_error($conn);
    echo 'Commit failed. Oracle reports: ' . $error['message'];
}
?>
$committed is always true, whenever $stmt executes successfully or fails.
I use PHP5.2.12, apache_2.0.63-win32-x86-openssl-0.9.7m.msi, windows
xp, Oracle10.1
and oci8 1.2.5.

thanks.

-- paravoice
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.