On Mon, Sep 7, 2015 at 1:23 AM, Johannes Schlüter <johan...@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