Req #54638 [Com]: PDO_MYSQL Always Uses Emulated Prepared Statements

From: Date: Sat, 30 Apr 2011 15:38:09 +0000
Subject: Req #54638 [Com]: PDO_MYSQL Always Uses Emulated Prepared Statements
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-160466@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=54638&edit=1

 ID:                 54638
 Comment by:         damien at tournoud dot net
 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)
 Block user comment: N
 Private report:     N

 New Comment:

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.


Previous Comments:
------------------------------------------------------------------------
[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


Thread (6 messages)

« previous php.bugs (#160466) next »