|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2002-10-17 08:38 UTC] maxim@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 17:00:01 2025 UTC |
I'm not really sure this is considered a bug, but in my view it's certainly an unexpected behaviour. Here's the case: In the end of a transaction of several insert/update statements, I'd like to check if all the statements executed without errors before deciding whether to commit or roll back: ... $stmt = ociparse($conn,$qry1); @ociexecute($stmt, OCI_DEFAULT); $stmt = ociparse($conn,$qry2); @ociexecute($stmt, OCI_DEFAULT); $stmt = ociparse($conn,$qry3); @ociexecute($stmt, OCI_DEFAULT); $stmt = ociparse($conn,$qry4); @ociexecute($stmt, OCI_DEFAULT); /* etc... */ if (!OCIError($stmt)) OCICommit($conn); else OCIRollback($conn); ... The problem is that if the execution of qry3 crashes and qry4 is OK, OCIError returns false and the transaction is committed. Since handling transactions must be the most useful area for an error-array like this, I'd expect the behaviour described in the documentation of OCIError: "Return the last error of stmt|conn|global". Now it returns the error of the last statement run - and if the last statement was successful, it returns false (regardless of what the last error was). Regards Eirik Olsen