ID: 35824
User updated by: xing at mac dot com
Reported By: xing at mac dot com
-Status: Open
+Status: Bogus
Bug Type: PDO related
Operating System: centos 4.2
PHP Version: 5.1.2RC1
New Comment:
Turns out it's because I did not set the error attribute correctly.
Apparently you cannot set it via the construct method.
new PDO("mysql:host=1.1.1.1;unix_socket=/tmp/my.sock;dbname=testdb",
$USER,
$PASS,
array(
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION );
the above does not work...to set the error mode attribute..had to use
the below after pdo connection is made.
setAttribute (PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
Previous Comments:
------------------------------------------------------------------------
[2005-12-28 01:39:14] xing at mac dot com
Description:
------------
Mysql version 4.1.15
use mysql_pdo with attribute enabled to have it throw exception on all
errors:
Reproduce code:
---------------
$st = $db->prepare("select * from test where c = 2 AND (a = :a OR b =
:a)");
$st->execute(array(":a" => 2));
Expected result:
----------------
Rows matching where a == 2 or b == 2 OR an exception if pdo doesn't
support having the same variable appear more than once in a prepared
query.
Actual result:
--------------
0 row result regardless of what's in the database. No error or
exceptions from pdo. Everything points to successful query when nothing
has been executed.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=35824&edit=1