#40772 [Fbk->Opn]: PDO::query() does not raise exception
| From: | vunnuk_o at ukr dot net | Date: | Sun, 11 Mar 2007 15:47:27 +0000 |
| Subject: | #40772 [Fbk->Opn]: PDO::query() does not raise exception | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-110196@lists.php.net to get a copy of this message | ||
ID: 40772
User updated by: vunnuk_o at ukr dot net
Reported By: vunnuk_o at ukr dot net
-Status: Feedback
+Status: Open
Bug Type: PDO related
Operating System: Win XP
PHP Version: 5.2.1
New Comment:
This happens for MySQL an SQLite
Previous Comments:
------------------------------------------------------------------------
[2007-03-11 14:42:16] iliaa@php.net
What PDO back-end are you using?
------------------------------------------------------------------------
[2007-03-10 18:49:24] vunnuk_o at ukr dot net
Description:
------------
PDO::query() does not throw an error when the SQL query contains syntax
error
Reproduce code:
---------------
$pdo = new PDO($dsn, $user, $pass,
array(PDO::ATTR_ERRMODE=>PDO::ERRMODE_EXCEPTION));
$pdo->query("SELETC * FROM test");
Expected result:
----------------
Exception should be raised.
Actual result:
--------------
Exception is not raised
but $pdo->errorCode() reports 42000
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=40772&edit=1