ID:               40772
 Comment by:       dennis at inmarket dot lviv dot ua
 Reported By:      vunnuk_o at ukr dot net
 Status:           Open
 Bug Type:         PDO related
 Operating System: Win XP
 PHP Version:      5.2.1
 New Comment:

Looks like PDO constructor does not like the PDO::ATTR_ERRMODE in the
options array. This way works:

$conn = new PDO($dsn, $user, $pass);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$conn->query("SELETC * FROM test"); // throws a PDOException

However, for SQLite the SQLSTATE still is HY000 instead of 42000


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

[2007-03-11 15:53:21] vunnuk_o at ukr dot net

However, SQLite's errorCode() is HY000... should not be 42000?

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

[2007-03-11 15:47:27] vunnuk_o at ukr dot net

This happens for MySQL an SQLite

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

[2007-03-11 14:42:16] [EMAIL PROTECTED]

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

Reply via email to