Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:97228 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 38168 invoked from network); 29 Nov 2016 18:13:13 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Nov 2016 18:13:13 -0000 Authentication-Results: pb1.pair.com header.from=php@beccati.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=php@beccati.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain beccati.com designates 176.9.123.236 as permitted sender) X-PHP-List-Original-Sender: php@beccati.com X-Host-Fingerprint: 176.9.123.236 box.beccati.com Received: from [176.9.123.236] ([176.9.123.236:58849] helo=box.beccati.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FD/C2-20013-735CD385 for ; Tue, 29 Nov 2016 13:13:11 -0500 Received: from authenticated-user (box.beccati.com [176.9.123.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by box.beccati.com (Postfix) with ESMTPSA id 15806200258; Tue, 29 Nov 2016 19:13:08 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=beccati.com; s=mail; t=1480443188; bh=SKEEJzeTARLFVXYC2DiECRhhTfs0bnW7hTJnyzBQmnQ=; h=Subject:To:References:Cc:From:Date:In-Reply-To:From; b=EeDRzrS5nrQx0fLyXUtR5CWrsPNRfYlkPJhy2iGllTAPgH3TslrN/KnginJk8SHCp 77iDj30gM3+efUv+ibxzPRz6ilfokyHTCNZXXytloNI1avgNJBFAVtU1XoZlReNmPl pMWXMPJH3/J0srVqDSe5sqwJrteTM7VRSj6nasHA135n+RiYyB2tOi0/Q+g4rvjgWK JyLTh9IKYiQQ0jovM2Nr/nspykv5uyC+c/qGN4qM7rvlNhexfaFQWqhuu/j0Aa3V5S GpOqp0QWAzx0pWPHpgMfm7bNecR8yR9LNskcIOmEdh7gMFz2vIhiuyoOTQz9xYixNG 5++a9QgUkZYAQ== To: Adam Baratz References: Cc: "internals@lists.php.net" Message-ID: <7eaa3b8f-7e21-a50c-946e-3f721db09a10@beccati.com> Date: Tue, 29 Nov 2016 19:13:02 +0100 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Re: [RFC] Debugging PDO Prepared Statement Emulation v2 From: php@beccati.com (Matteo Beccati) Hi Adam, On 29/11/2016 00:16, Adam Baratz wrote: > I'd be happy to make the feature more specific. The "Parsed" line would > only show with emulated prepares enabled, after execute() has been called. > I'd prefer using "Parsed" because the language would be more specific. It > would also correspond to pdo_parse_params(), the function which does the > emulation. Sure, it might be the name of the function, but technically it's parsing + interpolation. > Basically, you'd never see this kind of example: > > SQL: "SELECT * FROM tbl WHERE x = ?" >> Sent SQL: "SELECT * FROM tbl WHERE x = $1" >> why not? That's what active_query_string contains e.g. in pdo_pgsql w/o emulate prepares. Which is more or less what has been sent to the server, unless cursors are used. I don't see why it is deemed to be not-useful or less useful than emulated prepares. In fact it would come in very handy for extended tests of a bugfix I have in the pipeline. > I haven't tested, but I'm pretty sure the feature could be implemented by > adding this block below the first php_stream_printf() call in > debugDumpParams(): > > /* show parsed SQL if emulated prepares enabled */ >> /* pointers will be equal if PDO::query() was invoked */ >> if (stmt->active_query_string != NULL && stmt->active_query_string != >> stmt->query_string) { >> php_stream_printf(out, "Parsed SQL: [%zd] %.*s\n", >> stmt->active_query_stringlen, (int) stmt->active_query_stringlen, >> stmt->active_query_string); >> } > > > Let me know what you think of this approach. If it sounds fine, I'll update > the RFC. Possibly, but tbh I haven't had time to check. Cheers -- Matteo Beccati Development & Consulting - http://www.beccati.com/