Re: Re: PDO: Disable emulated prepares by default?

From: Date: Mon, 07 Sep 2015 17:27:47 +0000
Subject: Re: Re: PDO: Disable emulated prepares by default?
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-88101@lists.php.net to get a copy of this message
On Mon, Sep 7, 2015 at 1:23 AM, Johannes Schlüter <johannes@schlueters..de> wrote: > On Sun, 2015-09-06 at 18:25 +0100, Andrea Faulds wrote: > > Hi Scott, > > > > Scott Arciszewski wrote: > > > Inspired by > > > http://stackoverflow.com/a/12202218/2224584 > > > > > > Can we (in either PHP 7.0 or in PHP 7.1) turn emulated prepared > > > statements off by default, and still allow developers to turn it on if > > > they really want them? > > > > > > For now my code works around this design decision, but not everybody > > > is cognizant of this behavior. > > > > I don't know if there's really still time to add this in PHP 7.0, but I > > think emulated prepares being switched off would be a good idea. One > > Good enough to take the performance hit by the extra roundtrip? > > > reason in particular is that this means we'd get properly typed results, > > rather than just strings, which would work better with PHP 7's new > > scalar type hints. PDO returning strings everywhere when using emulation > > was one thing I was completely unaware of until I turned on strict > typing. > > For some definition of "properly". Large integers might still become > strings, same for decimals etc. Also if you might use other databases > than MySQL still anything might happen. > > Also mind that there are subtle differences on what can be done. A bit > constructed example but in MySQL you can't prepare > CREATE TABLE foo (id INT DEFAULT ?) > while PDO would let you do this. > > johannes > > also, binding ASC/DESC for ORDER BY is a common gotcha when moving from emulated prepares to native. -- Ferenc Kovács @Tyr43l - http://tyrael.hu

« previous php.internals (#88101) next »