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

From: Date: Sat, 30 Apr 2011 00:25:25 +0000
Subject: Req #54638 [NEW]: PDO_MYSQL Always Uses Emulated Prepared Statements
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-160461@lists.php.net to get a copy of this message
From:             
Operating system: All
PHP version:      5.3SVN-2011-04-30 (SVN)
Package:          PDO related
Bug Type:         Feature/Change Request
Bug description:PDO_MYSQL Always Uses Emulated Prepared Statements

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 bug report at http://bugs.php.net/bug.php?id=54638&edit=1
-- 
Try a snapshot (PHP 5.2):            http://bugs.php.net/fix.php?id=54638&r=trysnapshot52
Try a snapshot (PHP 5.3):            http://bugs.php.net/fix.php?id=54638&r=trysnapshot53
Try a snapshot (trunk):              http://bugs.php.net/fix.php?id=54638&r=trysnapshottrunk
Fixed in SVN:                        http://bugs.php.net/fix.php?id=54638&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=54638&r=needdocs
Fixed in release:                    http://bugs.php.net/fix.php?id=54638&r=alreadyfixed
Need backtrace:                      http://bugs.php.net/fix.php?id=54638&r=needtrace
Need Reproduce Script:               http://bugs.php.net/fix.php?id=54638&r=needscript
Try newer version:                   http://bugs.php.net/fix.php?id=54638&r=oldversion
Not developer issue:                 http://bugs.php.net/fix.php?id=54638&r=support
Expected behavior:                   http://bugs.php.net/fix.php?id=54638&r=notwrong
Not enough info:                     http://bugs.php.net/fix.php?id=54638&r=notenoughinfo
Submitted twice:                     http://bugs.php.net/fix.php?id=54638&r=submittedtwice
register_globals:                    http://bugs.php.net/fix.php?id=54638&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=54638&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=54638&r=dst
IIS Stability:                       http://bugs.php.net/fix.php?id=54638&r=isapi
Install GNU Sed:                     http://bugs.php.net/fix.php?id=54638&r=gnused
Floating point limitations:          http://bugs.php.net/fix.php?id=54638&r=float
No Zend Extensions:                  http://bugs.php.net/fix.php?id=54638&r=nozend
MySQL Configuration Error:           http://bugs.php.net/fix.php?id=54638&r=mysqlcfg



Thread (6 messages)

« previous php.bugs (#160461) next »