Bug #33707 [Com]: Errors in select statements not reported

From: Date: Fri, 26 Feb 2021 11:29:44 +0000
Subject: Bug #33707 [Com]: Errors in select statements not reported
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-232393@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=33707&edit=1 ID: 33707 Comment by: sabrinagilbe at gmail dot com Reported by: mangst at inventec dot ch Summary: Errors in select statements not reported Status: Closed Type: Bug Package: PDO related Operating System: Windows 2000 PHP Version: 5CVS-2005-07-14 (dev) Assigned To: wez Block user comment: N Private report: N New Comment: Thanks for the info i will try to figure it out for more https://www.krogerfeed.us/ Previous Comments: ------------------------------------------------------------------------ [2005-09-10 23:38:22] wez@php.net Fixed on the tip of the 5.1 branch. ------------------------------------------------------------------------ [2005-07-15 13:07:57] wez@php.net Ah, I misread the report. PDO::query() should report an error here of course. ------------------------------------------------------------------------ [2005-07-15 08:20:07] tony2001@php.net >I don't view this as a bug. You can't reproduce it? I can. >We report errors when the driver tells us there are errors; > PDO isn't doing anything wrong, per se. But there was an error, it's just hidden. This code works fine: <?php $db = new PDO('oci:dbname=..', '..', '..'); $st = $db->prepare('select blah from dual'); $rs = $st->execute(); var_dump($rs); var_dump($st->errorInfo()); ?> And this doesn't (only with OCI): <?php $db = new PDO('oci:dbname=..', '..', '..'); $rs = $db->query('select blah from dual'); var_dump($rs); var_dump($db->errorInfo()); ?> This happens because with MySQL it fails on prepare stage, but OCI passes prepare and fails only while executing the statement, so the error goes to the statement handle. ------------------------------------------------------------------------ [2005-07-14 23:58:04] wez@php.net 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. ------------------------------------------------------------------------ [2005-07-14 23:37:35] tony2001@php.net 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? ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=33707 -- Edit this bug report at https://bugs.php.net/bug.php?id=33707&edit=1

« previous php.bugs (#232393) next »