ID:               33707
 Updated by:       [EMAIL PROTECTED]
 Reported By:      mangst at inventec dot ch
 Status:           Assigned
 Bug Type:         PDO related
 Operating System: Windows 2000
 PHP Version:      5CVS-2005-07-14 (dev)
 Assigned To:      wez
 New Comment:

I don't view this as a bug.  We report errors when the driver tells us
there are errors; PDO isn't doing anything wrong, per se.

I also don't see how copying the errors up from the statement to the
dbh when execute() is called will help either.



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

[2005-07-14 23:37:35] [EMAIL PROTECTED]

That happens because Oracle's OCIStmtPrepare() doesn't validate the
query, it just allocates/prepares stmt handle for execution. Then PDO
happily executes this statement and all errors go to the stmt handle
(which is destroyed right after that).
Wez, from what I can see, with OCI we should always copy einfo struct
from the stmt handle to the dbh handle if stmt's execution failed.
Thoughts?

------------------------------------------------------------------------

[2005-07-14 22:07:02] mangst at inventec dot ch

Description:
------------
When a SQL statement is executed with PDO::query, PDO::errorInfo[0]
always reports "00000" even when an error has occurred and PDO::query
returned <false>.

Reproduce code:
---------------
<?php
    try {
        $db = new PDO('oci:dbname=***', '***', '***');
    } catch (PDOException $e) {
        exit ("Failed to obtain db handle: " . $e->getMessage());
    }
    $rs = $db->query('select nvarchar(8) from dual');
    echo 'Statement handle: ';
    var_dump($rs);
    echo "<br />\r\nError info of database handle: ";
    var_dump($db->errorInfo());
    $db = null;
?>

Expected result:
----------------
Somthing like:
Statement handle: bool(false)
Error info of database handle: array(1) { [0]=> string(5) "42000" [1]=>
"????" [2]=> string(x) "ORA-00904: "NVARCHAR": invalid identifier"}

Actual result:
--------------
Statement handle: bool(false)
Error info of database handle: array(1) { [0]=> string(5) "00000" }


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=33707&edit=1

Reply via email to