Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:130548 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by lists.php.net (Postfix) with ESMTPS id 872011A00BC for ; Fri, 3 Apr 2026 15:58:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1775231895; bh=XbBnwJdwm3Ov+DB6Yg5mbTw/xQjwId6VL8Wkeu1tesU=; h=From:Subject:Date:References:Cc:In-Reply-To:To:From; b=mEbcOrQIREa+tyQrsZwEGUbcsbhBeiuYA7dYRE27++Kp+kxp/ljEoLJiEcJXMBMmr qEHuVwi4Dfuslh9FPR4eS1Sl84uaijMis8opAxwvcmtIR/FOmUWM2VmpoCShq5q/1X xWJ9/Gn0XpKAgUH7GEtP8sabp4bWd4KrFwFPzFFRc3oyeryegziTUumCXmqFlE3A4w pHLU3+a2Np5ZJkGS9pSwEcMbvl7jy84BpSa1hxjSyxvF6CcYNKQz6ofDvCXdn+7nhf cbqgu8BvbbtEvizUdSOc3sXMp8WdGJ7BCsfCZWF2WcMW3lzdiO1Tvhkk8rXB2WNT64 ZiZmr2Tb9uG1A== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 90DA9180040 for ; Fri, 3 Apr 2026 15:58:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from mail.sakiot.com (mail.sakiot.com [160.16.227.216]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 3 Apr 2026 15:58:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=sakiot.com; s=default; t=1775231882; bh=XbBnwJdwm3Ov+DB6Yg5mbTw/xQjwId6VL8Wkeu1tesU=; h=From:Subject:Date:References:Cc:In-Reply-To:To:From; b=qkFGHftJs1ZFIt6esiJBaSMWbcG/2IZIEMUvdM8c0wdQFG7/as3li2wZNjGaeOOPv ywUI+Aaah4UGcSsTPifzbVZkwP5NTgO2hFvG41Ragem2gtq8taZyyFGIKgmZvIUGP7 bpihwqDkVyU+VAJVchH4PKkvPzTqRZzlK1gs+igA= Received: from smtpclient.apple (madb688d19.ap.nuro.jp [219.104.141.25]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.sakiot.com (Postfix) with ESMTPSA id 94FCC4019C; Sat, 4 Apr 2026 00:58:02 +0900 (JST) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow Mime-Version: 1.0 (1.0) Subject: Re: [PHP-DEV] PDO SQLite: statement attributes for SQL text retrieval Date: Sat, 4 Apr 2026 00:57:49 +0900 Message-ID: <606EDE71-8E63-4626-A509-5E067DA3EACA@sakiot.com> References: Cc: Kamil Tekiela , internals@lists.php.net, saki@php.net In-Reply-To: To: Ilia X-Mailer: iPhone Mail (23D8133) From: saki@sakiot.com (Saki Takamachi) > When a query is structured (generated), easily getting the final value has= merit. This is especially true when you need to see how the bound parameter= s were substituted, which might occur in a different file or function, there= fore, having the ability to fetch that clearly adds value, in my opinion. >=20 > One other scenario can be audit trails and logging, if you wanted to captu= re changes made for update/insert operations without actually capturing the d= ata, using $stmt->getAttribute(Pdo\Sqlite::ATTR_SQL); to get the query with= out the data could also be a valid use-case for this functionality.=20 >=20 > I am somewhat curios as to the reasoning for the objection, give that the f= unctionality does not add any meaningful complexity, performance impact or a= ny other conceivable downsides I can think of, perhaps you can share some yo= ur reasoning? Hi Ilia, First of all, one quick note: there is a convention here that you should not= post above the quoted text, so please keep that in mind. As a basic premise, retrieving the SQL is already possible at present: ``` $sql =3D $stmt->queryString; ``` What you are trying to implement for SQLite this time makes it possible to r= etrieve the SQL in either its pre-binding or post-binding state, so it is sl= ightly more capable than the property above. That said, these are almost certainly very similar features, and from the us= er=E2=80=99s point of view, being able to retrieve SQL from a property in on= e case and from an attribute in another may feel somewhat inconsistent. (I would also add that, personally, SQL does not feel like an =E2=80=9Cattri= bute=E2=80=9D to me.) If so, I think it would be better to make these new features methods instead= , which would also make it clearer that they are SQLite-specific functionali= ty. This has another advantage as well: it would make it possible to declare the= return type explicitly. Regards, Saki=