Edit report at http://bugs.php.net/bug.php?id=48314&edit=1
ID: 48314 Updated by: [email protected] Reported by: [email protected] Summary: PDO_MySQL doesn't use prepared statements -Status: Open +Status: Bogus Type: Bug Package: PDO related Operating System: Windows PHP Version: 5.2.9 Block user comment: N Private report: N New Comment: As Ulf said: There is a fallback in PDO to emulate in case the prepare failed. The list of prepareable statements can be found on http://dev.mysql.com/doc/refman/5.1/en/c-api-prepared-statements.html for MySQL 5.1 and on http://dev.mysql.com/doc/refman/5.5/en/c-api-prepared-statements.html for the current 5.5. Previous Comments: ------------------------------------------------------------------------ [2010-09-06 11:14:31] [email protected] The sample script works fine with PHP 5.2.15-dev and MySQL 5.1.45-debug . What could happen in your case is that your server does not support preparing it and falls back to emulation. ------------------------------------------------------------------------ [2009-11-04 19:01:19] [email protected] Occasionally I am tempted to bogus any PDO MYSQL character set bug report I see. SET NAMES won't be recognized by the client and the wrong character set will be used for escaping. Adding a DSN option to specify the character set upon connect and setting it properly through the C API may be only five lines of code. But even if that would be implemented we would still have the PDO PS emulation as a potential pitfall. PDO will call the driver for escaping bound values and the driver will properly escape the values. But the PDO SQL parser itself won't care much about the current character set when searching for placeholders. ------------------------------------------------------------------------ [2009-09-29 21:41:34] [email protected] Well, you should not use SET NAMES. It will not change the charset used for quoting. Currently there is no way to change the charset via an API call. Try ext/mysqli... ------------------------------------------------------------------------ [2009-05-18 13:45:30] [email protected] Same result. ------------------------------------------------------------------------ [2009-05-18 13:43:31] [email protected] 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. ------------------------------------------------------------------------ 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/bug.php?id=48314 -- Edit this bug report at http://bugs.php.net/bug.php?id=48314&edit=1
