Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:96347 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 98842 invoked from network); 13 Oct 2016 19:12:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Oct 2016 19:12:49 -0000 Authentication-Results: pb1.pair.com smtp.mail=theanomaly.is@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=theanomaly.is@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.51 as permitted sender) X-PHP-List-Original-Sender: theanomaly.is@gmail.com X-Host-Fingerprint: 209.85.215.51 mail-lf0-f51.google.com Received: from [209.85.215.51] ([209.85.215.51:34741] helo=mail-lf0-f51.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AC/61-41968-EACDFF75 for ; Thu, 13 Oct 2016 15:12:47 -0400 Received: by mail-lf0-f51.google.com with SMTP id b81so148556481lfe.1 for ; Thu, 13 Oct 2016 12:12:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=k8Is5ZxJNNo1CTDYznKozJqdY84cYQ/yGdiGVS6Qk20=; b=xRdZ4ygXze90/HvUVPYyXG74CNh1RWEWDsGGJ0IqZejJai8XGrH6fH00GBlvmoG8ue ghWuJIgmkl205RpBocWdaB1UhrDGuKY8FZnsumCsVTVEtl+z5OdsxDLsjO50kqW0GEnf qH0XFZv5b2ivypZBAzOxtDFevjO2IGfAnBpxy1aOovspNPcwYFXw5SJj3vc1lTpMQ8Ir m0rkJVif92s/kRECFwYyt2YJ1K2h3xouVwJ4009LvEJadnepdN7JURy4RAmZsoCkcyo1 XT3xdnFwTg78DXJiafh4Db9Ca2YAW+Ei62GKXo9NZLkL9+n4ZetlItOCX5BChhft27TI vDmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=k8Is5ZxJNNo1CTDYznKozJqdY84cYQ/yGdiGVS6Qk20=; b=EpCSi+9MtPbbJOkwZiccCOyi5TfsAogC1H/ECd0bCGddvo1Vnrf1Qcg0A9Xt+6Hinw hR9RIwzVrlJj6QyiDjiY66V6L8IGLVZDpAlTWR/6V1YinvFgHP6xtLaEbZTv4+BipVGi XjW/cQAB0qTqTyggTkbLejL4VBuXFG3fCFR2/km/TEgF2ugHcpybUPdw1W8bQZ+536BE 6ZBbFmPMLn5gOWWs9CYYK7VOa0Htm6IwO1bZ4MfPE7uP2IGQycBDmyQG9WWmAZiuQNLk FdU9yY/Lf0b1LKKZfWNAKWZMXWAWn/vHfmhLJ8ULe8F5okeoJxzbPEhBzH+4RwkFonoy FYUA== X-Gm-Message-State: AA6/9RkMOQJW9lNj7pty8EjOjeeH8Tku6wK2QVuhNONEVr+dUoUlPlIDvT/qtsrN+77Q8HgfFXwh9aPl60EfOw== X-Received: by 10.28.27.141 with SMTP id b135mr93455wmb.78.1476385963048; Thu, 13 Oct 2016 12:12:43 -0700 (PDT) MIME-Version: 1.0 Received: by 10.80.135.94 with HTTP; Thu, 13 Oct 2016 12:12:42 -0700 (PDT) In-Reply-To: <9987c0a5-2315-0a8c-0f96-7a45323fa86d@beccati.com> References: <9987c0a5-2315-0a8c-0f96-7a45323fa86d@beccati.com> Date: Thu, 13 Oct 2016 15:12:42 -0400 Message-ID: To: Matteo Beccati Cc: Adam Baratz , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=001a114b2ffae10403053ec3e4d9 Subject: Re: [PHP-DEV] PDOStatement::activeQueryString() From: theanomaly.is@gmail.com (Sherif Ramadan) --001a114b2ffae10403053ec3e4d9 Content-Type: text/plain; charset=UTF-8 I really doubt this method will prove useful in practice for the use case you mention, and for a number of a reasons. 1) The name is misleading (there is no real query string in the case of native prepared statements - the SQL and data are always separate) 2) You would have to execute the statement first in order to get the debug information you're looking for (meaning that if the execution of the statement fails for any reason other than what the SQL parser can detect, there is no useful debug information from this method) 3) This only works if you use emulated prepares, which creates a whole new stream of complaints by people who don't understand the difference I don't think the real problem is seeing the entire query assembled with the parameters filled in, because the buggy part would never be the actual parameter values themselves. If there is a bug in the SQL, it's typically the result of a syntax error, or constraint violation, or name error. I sincerely doubt this method would prove useful in debugging in any of those things. The server-side error messages from the DBMS would prove more useful in those cases. In other words, I believe people would get more useful debug information by just turning off emulated prepares, putting PDO into Exception error mode, and looking at the error information provided by the DBMS since with server-side prepares you get failure upon preparing, and before execution even begins, such that parameters are no longer the actual concern for error. On Thu, Oct 13, 2016 at 2:42 PM, Matteo Beccati wrote: > Hi, > > On 13/10/2016 19:59, Adam Baratz wrote: > > I'd like to add a new method that would return the prepared statement as > it > > was executed. It's common for people I work with to want this info for > > debugging, but you can't get it from userland. The functionality is > similar > > to, but distinct from PDOStatement::debugDumpParams(). > > > > I figure it's always easier to discuss proposals alongside real code: > > https://github.com/php/php-src/pull/2159 > > > > Please let me know what you think, if an RFC would be appropriate, or > what. > > To be perfectly honest, my wish is that EMULATE_PREPARES could be > deprecated and removed and I see something this as a step in the > opposite direction. > > That said, I think a tiny RFC that explains what's the problem you are > trying to solve, the current issue and possible other solutions would be > very welcome. This is an API change and most likely will require all the > drivers to be adapted. > > > Cheers > -- > Matteo Beccati > > Development & Consulting - http://www.beccati.com/ > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --001a114b2ffae10403053ec3e4d9--