Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:78571 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 27846 invoked from network); 3 Nov 2014 11:40:14 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Nov 2014 11:40:14 -0000 Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.169 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 209.85.212.169 mail-wi0-f169.google.com Received: from [209.85.212.169] ([209.85.212.169:48933] helo=mail-wi0-f169.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AA/22-08476-D9967545 for ; Mon, 03 Nov 2014 06:40:13 -0500 Received: by mail-wi0-f169.google.com with SMTP id n3so5803159wiv.4 for ; Mon, 03 Nov 2014 03:40:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=user-agent:in-reply-to:references:mime-version :content-transfer-encoding:content-type:subject:from:date:to:cc :message-id; bh=PRCVUXum4fBWsT9ybOOLh+R2JyZ9xo78El0t1l2plkk=; b=eduZ36xnSdNudTM54XlPVRW5GSyp+LCXBlnzBjc3LE5TOWAVmlf6EDkLxYOxpvsgSE 5JoDSA1cRjTLN2eOWEQtqAgIsrCgp57FhHCq4cJnpJbxMCW9OF54alGl/BlggUxpFH0Y 6Uk9yJCb2M4IGEuhAFcwslnFSVQn3rtyVU6x/tWmHJRZ2UhqgjmsSE7hI0hSwGWqovFn zT3mBoIgeRTGNQPeRl1/UuNQ7vbCKrfOEGMJABqOUi7ySnf0KXHlGi73VHyx8D7ZWVk/ qfxF8Hr2/V/1cy1Ht+nExCCo4O4Mw2RxRGBTDhu1uEX5v1WnWt7DAcwvLeFE0OUYPEOm R9fw== X-Received: by 10.194.48.116 with SMTP id k20mr48370381wjn.7.1415014810147; Mon, 03 Nov 2014 03:40:10 -0800 (PST) Received: from [192.168.0.3] (cpc68956-brig15-2-0-cust215.3-3.cable.virginm.net. [82.6.24.216]) by mx.google.com with ESMTPSA id pn4sm21878629wjc.38.2014.11.03.03.40.08 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 03 Nov 2014 03:40:09 -0800 (PST) User-Agent: K-9 Mail for Android In-Reply-To: <54574850.2020200@beccati.com> References: <543FE883.2070401@lerdorf.com> <54574850.2020200@beccati.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Date: Mon, 03 Nov 2014 11:40:06 +0000 To: PHP Internals CC: Anthony Ferrara Message-ID: <81A50472-F8B2-425F-97AD-713D1F0C07F4@gmail.com> Subject: Re: [PHP-DEV] [PATCH - PR] Disable ATTR_EMULATE_PREPARES by default for PDO_Mysql From: rowan.collins@gmail.com (Rowan Collins) On 3 November 2014 09:18:08 GMT, Matteo Beccati wrote: >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 >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. I think rhis Twitter exchange is very relevant here: https://twitter.com/dracony_gimp/status/528240781996605440?s=09 When using a one-shot call to query() with multiple statements (e.g. create temp table; populate temp table; select results) it's actually necessary with Postgres to switch on emulation, and for that emulation to allow multiple queries even though the DBMS wouldn't. We discovered this in moving from ext/postgres, where pg_query() doesn't attempt to prepare the query, so allows strings containing multiple statements. We therefore needed a compatible mode in order to switch to PDO. -- Rowan Collins [IMSoP]