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

 ID:                 54638
 Updated by:         [email protected]
 Reported by:        me at ircmaxell dot com
 Summary:            PDO_MYSQL Always Uses Emulated Prepared Statements
 Status:             Open
 Type:               Feature/Change Request
 Package:            PDO related
 Operating System:   All
-PHP Version:        5.3SVN-2011-04-30 (SVN)
+PHP Version:        5.4
 Block user comment: N
 Private report:     N

 New Comment:

This is a 5.4 feature request. There were very good reasons for not
using the 

native prepared statement support in MySQL < 5.1.17.


Previous Comments:
------------------------------------------------------------------------
[2011-04-30 17:38:08] damien at tournoud dot net

Before MySQL 5.1.17, prepared statements completely skip the query cache
(see 

http://dev.mysql.com/doc/refman/5.1/en/query-cache-operation.html). I
think it's 

too early to make the switch.

------------------------------------------------------------------------
[2011-04-30 02:25:24] me at ircmaxell dot com

Description:
------------
The PDO_MySQL driver defaults emulate_prepare to 1, which forces all
prepared 

queries to be emulated by the driver.  This means that even though the
client 

library (mysqlnd or libmysql) may support prepared statements, PDO will
never 

really use them.



You can set the attribute PDO::ATTR_EMULATE_PREPARES to 0, and it
prepares and 

executes the prepared statements just fine using the native mode (rather
than 

emulation).  However this is not documented at all on PHP.NET.



Since PDO_MYSQL will fallback to emulation automatically if the client
library or 

server are too old for prepared statements, I would suggest that the
default 

value for emulate_prepare should be set to 0 to allow for true prepared


statements.



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



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

Reply via email to