Re: [PECL-DEV] mysqlnd_qc (mysqlnd query cache) 1.0.1 with prepared statement support

[email protected] (Ulf Wendel) Tue, 13 Jul 2010 23:42:18 +0200
Newsgroups php.pdo
Message-ID <[email protected]>
Lukas Kahwe Smith schrieb:
> On 13.07.2010, at 23:27, Ulf Wendel wrote:
> 
>> Lukas Kahwe Smith schrieb:
>>> On 13.07.2010, at 21:16, Ulf Wendel wrote:
>>>> Lukas Kahwe Smith schrieb:
>>>>> On 13.07.2010, at 19:55, Ulf Wendel wrote:
>>>>>> Lukas Kahwe Smith schrieb:
>>>>>>> On 13.07.2010, at 19:26, Ulf Wendel wrote:
>>>>>>>> Benjamin Eberlei schrieb:
>>>>>>>>> Actually missing prepared statements and unbuffered queries were the
>>>>>>>>> only issues I had with the Query Cache so far. Can i compile the Mysqlnd
>>>>>>>>> + Query Cache PECL Trunk against 5.3.99-DEV only to test it? 
>>>>>>>> ... remember that PDO emulates prepared statements by default.
>>>>>>> by default? since when?
>>>>>> Since when does it not?
>>>>>>
>>>>> good question.
>>>>> it certainly didnt in the beginning:
>>>>> http://netevil.org/uuid/444a6017-0548-2459-2943-44a601714d58
>>>>> as you can see the feature was added later on and had to be enabled manually.
>>>> Well, a blog post... one would have to check the CVS log but I'm too lazy/tired... To add one "I recall and in this blog...", emulation should have been the default when we started adding mysqlnd support in mid 2008. Whenever...
>>>>
>>>> Question is if and when to disable the emulation default in favour of native PS. The answer may be a bit like with ext/mysql, it may be: fear the installed user base.
>>> The documentation also only talks about emulation being used in case its not natively available. I have not looked at the source, but if indeed this has changed, then it ought to be documented and I am not sure I really like this change, especially in light of the rather crude and flaky parser used and the simplistic quoting logic used.
>> You are not the first one to be surprised about the status quo and you are certainly an insider.
>>
>> Yes, the PDO emulation is not the most sophisticated one. But I don't need to tell you about the shortcomings of the MySQL server and the drawbacks of native prepared statements. Although PDO_MYSQL will fallback to non-prepared statements, if the server hints that a statement cannot be prepared this does not solve the issue with the MySQL (Server) Query Cache for many. Also, the extra round trip to find out that a statement cannot be prepared is not desired.
>>
>> It is not an easy decision. Especially for me who always yells about abusing PS for security...
>>
>> How to move forward: improve documentation?
> 
> 
> ok moving the discussion to the pdo list.
> i guess first up we need to confirm if this is a general default or just the mysql default and when this all changed.

Well, check the source. It will tell you.  Emulation is not a default 
for all drivers. Its a driver decision.

http://lxr.php.net/xref/PHP_5_2/ext/pdo_mysql/mysql_driver.c#474
http://lxr.php.net/xref/PHP_5_3/ext/pdo_mysql/mysql_driver.c#617

No change from 5.2 to 5.3.

Ulf