#48314 [Opn->Fbk]: PDO_MySQL doesn't use prepared statements
| From: | johannes@php.net | Date: | Mon, 18 May 2009 13:43:32 +0000 |
| Subject: | #48314 [Opn->Fbk]: PDO_MySQL doesn't use prepared statements | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-137440@lists.php.net to get a copy of this message | ||
ID: 48314
Updated by: johannes@php.net
Reported By: vrana@php.net
-Status: Open
+Status: Feedback
Bug Type: PDO related
Operating System: Windows
PHP Version: 5.2.9
New Comment:
Try also disabling PDO::ATTR_EMULATE_PREPARES. PHP 5.3 got some
improvements/fixes with PDO_mysql (due to mysqlnd work) not sure if some
parts can be backported.
Previous Comments:
------------------------------------------------------------------------
[2009-05-18 13:25:17] vrana@php.net
Description:
------------
It seems that PDO_MySQL doesn't use prepared statements even with
disabled PDO::MYSQL_ATTR_DIRECT_QUERY. If the prepared statements would
by used then the binary data passed in the example wouldn't cause a
parse error.
MySQL version: 5.1.26
Reproduce code:
---------------
<?php
$pdo = new PDO("mysql:host=localhost", "ODBC", "");
$pdo->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, false);
$pdo->exec("SET NAMES gbk");
$stmt = $pdo->prepare("SELECT ?");
$stmt->execute(array(chr(0xbf) . chr(0x27)));
print_r($stmt->errorInfo());
?>
Expected result:
----------------
Array
(
[0] => 00000
)
Actual result:
--------------
Array
(
[0] => 42000
[1] => 1064
[2] => You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use
near ''¿\''' at line 1
)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=48314&edit=1