Bug #18368: Successful OCIExecute clears OCIError

From: Date: Tue, 16 Jul 2002 14:13:25 +0000
Subject: Bug #18368: Successful OCIExecute clears OCIError
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-14314@lists.php.net to get a copy of this message
From: eo@clickbase.no Operating system: win2000 PHP version: 4.2.0 PHP Bug Type: OCI8 related Bug description: Successful OCIExecute clears OCIError 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 -- Edit bug report at http://bugs.php.net/?id=18368&edit=1 -- Fixed in CVS: http://bugs.php.net/fix.php?id=18368&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=18368&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=18368&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=18368&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=18368&r=support Expected behavior: http://bugs.php.net/fix.php?id=18368&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=18368&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=18368&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=18368&r=globals

« previous php.bugs (#14314) next »