Re: [PATCH - PR] Disable ATTR_EMULATE_PREPARES by default for PDO_Mysql

From: Date: Mon, 03 Nov 2014 09:18:08 +0000
Subject: Re: [PATCH - PR] Disable ATTR_EMULATE_PREPARES by default for PDO_Mysql
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-78570@lists.php.net to get a copy of this message
Hi all Resuming this once again after Anthony's blog post... On 16/10/2014 18:10, Ferenc Kovacs wrote: > On Thu, Oct 16, 2014 at 5:47 PM, Rasmus Lerdorf <rasmus@lerdorf.com> wrote: >> I do agree that the default should probably be server-side since it is >> the least surprising. We just need to make it very very clear in the >> upgrade doc that this change will likely slow down peoples' apps and >> show them how to turn client-side prepares back on. >> >> -Rasmus >> > > I don't think we should remove the option, just change the defaults, and > most people would be fine switching back to the emulation, but it should be > their conscious decision imo. Yes. For the record, pdo_pgsql and pdo_mysql seem to be the only PDO drivers that can effectively emulate prepares. As far as I could tell, the others ignore the attribute. For pgsql the default is to use server-side prepares, so I'd be all for making both work consistently by default. However, I think PDO is fundamentally flawed in enforcing the use of prepared statements even when 99% of the times the queries issued by a PHP script need only to be executed once. It surely is a waste of resources having to allocate a prepared query, execute it and deallocate it each and every time. I certainly wish there was something in the mysql client/protocol similar to PQexecParams, which would be the best of both worlds. Cheers -- Matteo Beccati Development & Consulting - http://www.beccati.com/

« previous php.internals (#78570) next »