Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:101045 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 96755 invoked from network); 3 Nov 2017 20:25:25 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Nov 2017 20:25:25 -0000 Authentication-Results: pb1.pair.com smtp.mail=scott@paragonie.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=scott@paragonie.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain paragonie.com designates 74.125.82.169 as permitted sender) X-PHP-List-Original-Sender: scott@paragonie.com X-Host-Fingerprint: 74.125.82.169 mail-ot0-f169.google.com Received: from [74.125.82.169] ([74.125.82.169:43802] helo=mail-ot0-f169.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0D/2D-09857-1B0DCF95 for ; Fri, 03 Nov 2017 15:25:23 -0500 Received: by mail-ot0-f169.google.com with SMTP id k10so3675621otb.0 for ; Fri, 03 Nov 2017 13:25:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragonie-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=1mB5zTwyKLS30GVgxhZYQhAs2zqD+aRwVZsdbO4O7wc=; b=gy2kKOK+FXLA3s7xdiY4YHdZwQfJLnPPzCQWiVjeOvN3lP8+uyrmPCyUgYzpy3gyFq m/LP5ha5zvyli857a0mqXdv+JvF8VF9GmU/mf6y1uJLArZCestm0P8OXBth4Yds8T7pu 5RX1PLEMV04z/LWfSNO1KzwUCWWV7DJW9T0XAv0v26I2T0JKi3dqV6HauR1o3tQwTAhw e3M6O3YkB9BFjdP+8BKPeK+nid5iOWoyUnAtyz/X2trK05zXvWxR+xOwlCjt4zNrUxqk j/Go5b9BOR2k1iG0P4e1/muFOQPogPf6L+VY8TB7Ik19OHulF1NEwnvwxawRm7WWWsLG yUrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=1mB5zTwyKLS30GVgxhZYQhAs2zqD+aRwVZsdbO4O7wc=; b=CArD7W9FSUN/V3E65CvQ4tYtp9rDWAsQ/ny1b19U3KbHOsYG5ZcmYQKBvIwsu5IWag eu/aBm6bmpgoapg3f/hw4b5F/U8NZgR1rN0torqJO3GGimS52SSyoCwiD3YEu8pgjkXU 0P2MB7WoYdua4NT99zWihaz6ACxRZk22Eg7bPArLrhm8NRjylal8e6RwdcAHJrWd8hJ3 TEM9+nMJjtfAWTMwDWpuxDFPO8qc7cS/aghgMGdWSQ6pUhHsHxalyvj6jwMJy8rM9fTc /WXQNBF90qCJ4o82ziruA05PV5i55axkhgTaVFWV1hP0m3r5iwh2/4jwUNvCCVdgDHYK aRig== X-Gm-Message-State: AJaThX5EpTEdNAeyYvaaNG/QPiNOTUjNNtg5pE2KX1x63SkV1B4+j3WP hLQjQW99feGNVhxYwOUsYllURiAdbncZUCGkRUmr74xlRcY= X-Google-Smtp-Source: ABhQp+Ti7Bip4sLfsdLlrKrFX5xWdBtJkPPCcSx/JwvPkQiZ58bkx46otR6x4JPWosAfPhbdGyySYgteskg6bCpunJE= X-Received: by 10.157.51.38 with SMTP id f35mr5087289otc.39.1509740718242; Fri, 03 Nov 2017 13:25:18 -0700 (PDT) MIME-Version: 1.0 Received: by 10.157.82.3 with HTTP; Fri, 3 Nov 2017 13:25:17 -0700 (PDT) In-Reply-To: <7e7d69c9-8383-9cd0-9a54-0e7e4bb80775@beccati.com> References: <7e7d69c9-8383-9cd0-9a54-0e7e4bb80775@beccati.com> Date: Fri, 3 Nov 2017 16:25:17 -0400 Message-ID: To: Matteo Beccati Cc: PHP Internals Content-Type: multipart/alternative; boundary="001a113f032236de3b055d19e7a1" Subject: Re: [PHP-DEV] Idea: PDO - Single-round-trip prepared statements From: scott@paragonie.com (Scott Arciszewski) --001a113f032236de3b055d19e7a1 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Nov 3, 2017 at 3:49 PM, Matteo Beccati wrote: > Hi Scott, > > On 03/11/2017 16:33, Scott Arciszewski wrote: > > 1. Which DB drivers (and which versions) support 1RT prepared statement= s > in > > addition to 2RT prepared statements? > > 2. Is there a better name for this usage than safeQuery()? > > > > If this turns out to be a good idea, I'll write up an RFC targeting PHP > 7.3. > > I've added a similar feature to pdo_pgsql a while ago > (PDO::PGSQL_ATTR_DISABLE_PREPARES), which is not enabled by default. > > It is basically somwthing in between real prepared statements (which is > the default on pdo_pgsql) and emulated prepares, and it uses libpq's own > PQexecParams function. > > At that time I had checked if libmysqlclient offered a similar function, > but it didn't seem like it, so I went for the pgsql-only constant. > > > Cheers > -- > Matteo Beccati > > Development & Consulting - http://www.beccati.com/ > =E2=80=8BMySQL calls it an X Protocol, apparently. https://dev.mysql.com/doc/internals/en/x-protocol-use-cases-use-cases.html#= x-protocol-use-cases-prepared-statements-with-single-round-trip We don't want to disable prepared statements (that constant's name is somewhat scary). We don't want to emulate prepared statements (although we'll probably have to respect the current configuration). We just need a separate method (my proposed safeQuery() being distinct from prepare()) that uses whatever that driver's single-round-trip prepare-and-execute equivalent API is. If none is available for the given driver, we need to decide whether to: 1. Throw a PDOException, or 2. Silently use two round trips in the background so it "just works" even if it's a slight performance hit =E2=80=8B(In case it wasn't clear, I'm very much NOT a fan of emulated prep= ares, and in EasyDB we go out of our way to disable this feature.) Scott Arciszewski Chief Development Officer Paragon Initiative Enterprises =E2=80=8B --001a113f032236de3b055d19e7a1--