ID:               18368
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
-Status:           Open
+Status:           Bogus
 Bug Type:         OCI8 related
 Operating System: win2000
 PHP Version:      4.2.0
-Assigned To:      
+Assigned To:      maxim
 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

This is the way OCIError() should work. OCIError() returns the errors
from the last Statement called, it does not buffer any previos errors
that happened within the script and shows its last one.

Perhaps you're right about the documentation. It should be saying:

"return the error for the last Statement or Connection executed"

instead of 

"return the last error occured"

because this way it feels like if there was an error it'll get printed
out regardless when it happened but as long as nothing failed after
it.

I will move this bug into the documentation issues.

Thanks Eirik,

Maxim Maletsky
[EMAIL PROTECTED]


Previous Comments:
------------------------------------------------------------------------

[2002-07-16 10:13:25] [EMAIL PROTECTED]

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 this bug report at http://bugs.php.net/?id=18368&edit=1

Reply via email to