ID:               40772
 Updated by:       [EMAIL PROTECTED]
 Reported By:      vunnuk_o at ukr dot net
-Status:           Open
+Status:           Feedback
 Bug Type:         PDO related
 Operating System: Win XP
 PHP Version:      5.2.1
 New Comment:

>This works on Linux (SQLite) but fails on Windows.
Which PHP version are you using?

>Otherwise on Linux it leads to another error:
>The auto-commit mode cannot be changed for this driver
How is that related to your problem and how to reproduce it?


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

[2007-03-11 20:02:56] vunnuk_o at ukr dot net

This works on Linux (SQLite) but fails on Windows. So still a bug.
Also, your example has an error

array(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION));
should be 
array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));

Otherwise on Linux it leads to another error:
The auto-commit mode cannot be changed for this driver

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

[2007-03-11 18:31:22] [EMAIL PROTECTED]

Unfortunately on syntax errors SQLite returns a generic "error"
message, 
which is why PHP returns HY000 error code.

As far as constructor not support exception option setting, I cannot 
seem to replicate in SQLite. Here is the sample code I am using


$d = new PDO('sqlite:test.db', NULL, NULL, array(PDO::ATTR_ERRMODE, 
PDO::ERRMODE_EXCEPTION));
$d->query("SELETC * FROM test");

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

[2007-03-11 17:24:35] dennis at inmarket dot lviv dot ua

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

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

[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

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

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
    http://bugs.php.net/40772

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

Reply via email to