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

From: Date: Sun, 06 Sep 2015 23:23:01 +0000
Subject: Re: Re: PDO: Disable emulated prepares by default?
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-88069@lists.php.net to get a copy of this message
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

« previous php.internals (#88069) next »