Re: oci_commit always returns true even when the transaction fails.

From: Date: Tue, 16 Mar 2010 23:12:19 +0000
Subject: Re: oci_commit always returns true even when the transaction fails.
References: 1 2  Groups: php.db 
Request: Send a blank email to php-db+get-46966@lists.php.net to get a copy of this message
echo "Second Insert\n"; $s = oci_parse($c, "insert into t_tab values ( 1,-1)"); $r = oci_execute($s, OCI_DEFAULT); // Explore the difference with and without OCI_DEFAULT if (!$r) {
    $m = oci_error($s);
    trigger_error('Could not execute: '. $m['message'], E_USER_ERROR);
} $r = oci_commit($c); if (!$r) {
    $m = oci_error($s);
Correction: the two oci_error() calls after oci_commit() should use the $c connection resource, not $s, e.g.:
     $m = oci_error($c);
    trigger_error('Could not commit: '. $m['message'], E_USER_ERROR);
} $s = oci_parse($c, "drop table t_tab"); oci_execute($s); ?>
-- Email: christopher.jones@oracle.com Tel: +1 650 506 8630 Blog: http://blogs.oracle.com/opal/ Free PHP Book: http://tinyurl.com/ugpomhome

« previous php.db (#46966) next »