php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #61969 emulate prepares default on needs to be clearly documented
Submitted: 2012-05-07 17:50 UTC Modified: 2021-03-16 13:00 UTC
From: crmalibu at gmail dot com Assigned: cmb (profile)
Status: Closed Package: PDO related
PHP Version: 5.4.2 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: crmalibu at gmail dot com
New email:
PHP Version: OS:

 

 [2012-05-07 17:50 UTC] crmalibu at gmail dot com
Description:
------------
On this page http://php.net/manual/en/ref.pdo-mysql.php I quote

"PDO_MYSQL will take advantage of native prepared statement support present in MySQL 4.1 and higher. If you're using an older version of the mysql client libraries, PDO will emulate them for you."

I think the default setting of PDO::ATTR_EMULATE_PREPARES being on conflicts with my quote. It should say that its capable of taking advantage, but the default is to emulate.

semi related bug report on the setting https://bugs.php.net/bug.php?id=54638

Test script:
---------------
none

Expected result:
----------------
none

Actual result:
--------------
none

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-05-21 15:23 UTC] jpauli@php.net
I'd like to add that PDO::MYSQL_ATTR_DIRECT_QUERY does exactly the same thing as PDO::ATTR_EMULATE_PREPARES, they are just synonyms.
This can be quickly seen in source code : http://lxr.php.net/xref/PHP_5_4/ext/pdo_mysql/mysql_driver.c#390

Also, note that PDO::getAttribute() wont show you PDO::ATTR_EMULATE_PREPARES as it has not been implemented in the get() handler for pdo_mysql driver, referer here : http://lxr.php.net/xref/PHP_5_4/ext/pdo_mysql/mysql_driver.c#417
However, PDO::MYSQL_ATTR_DIRECT_QUERY has been
 [2013-01-03 07:02 UTC] philip@php.net
Interesting, I stumbled upon this topic today and will be documenting it. 
And nice MYSQL_ATTR_DIRECT_QUERY tip, I'll steal that... :)
 [2013-01-03 07:02 UTC] philip@php.net
-Assigned To: +Assigned To: philip
 [2017-10-24 06:21 UTC] kalle@php.net
-Status: Assigned +Status: Open -Assigned To: philip +Assigned To:
 [2021-03-16 13:00 UTC] cmb@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2021-03-16 13:00 UTC] cmb@php.net
This has already been fixed.  The docs now properly state:

| PDO_MYSQL uses emulated prepares by default.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 05:01:29 2024 UTC