Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:130554 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 649B31A00BC for ; Fri, 3 Apr 2026 17:33:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1775237615; bh=s/E3CIkQ1aoPoq+LB+Fqh7CQ+LrXh4bv+4kncRF0QuA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=O5pG5uSzjA34N/yyoXdqyjNegqXQ+vk4IGu761jos/sO4DVfx3hLsOXX6Fys0Pp3Q DfVPdv4YsTWNDMnX/rrUxlcH3LxuARlNGjoy5mHwfIThNQMZ7TAeHXvao46jyDNCXf x4WjV08tJ8B9V3UfxfhLfxT4GSaxNsr5rCR0/J59wQekDu6+sOCii7aIjc7+R5zx8I AD/tPqqsYmbQvLTPzRtyutV+dusKPC4/1JZE+OEiCR1Ro/bhfUGzWGoTPqyr7bw+r7 WK+bwaXJeYHCaqt6Q0VE66t8lbLZMd94hbqLAiMj4yZmzaES7VEIAn/2tUiw2oOomk n3vStP+iYuPag== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id C780F1801DF for ; Fri, 3 Apr 2026 17:33:34 +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=ARC_SIGNED,ARC_VALID,BAYES_50, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS,T_PDS_PRO_TLD autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from gerbil.ash.relay.mailchannels.net (gerbil.ash.relay.mailchannels.net [23.83.222.67]) (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 17:33:23 +0000 (UTC) X-Sender-Id: yszpovajlk|x-authuser|juris@glaive.pro Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 0771446173F; Fri, 03 Apr 2026 17:33:18 +0000 (UTC) Received: from server52.areait.lv (100-96-162-172.trex-nlb.outbound.svc.cluster.local [100.96.162.172]) (Authenticated sender: yszpovajlk) by relay.mailchannels.net (Postfix) with ESMTPA id 0ABB84619A7; Fri, 03 Apr 2026 17:33:16 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; d=mailchannels.net; s=arc-2022; cv=none; t=1775237597; b=HfuQX3AXzGcOfLFGniToDm3W6vx88wxQlTtE7RrcXU32LZFHo7oIBBNAajZe/kRTGmeVgG +1mRRnFhHI88MKWN9RA/dCmXfhGCUzBjOqUWrvhgN6qdUIV1LiVjQuDxEuWuC3zxW0+75W Cay/Sj6RshuSdm3hr2NA21GRhuibXfSjtjwP+nPtvngfJ4pCwdg6XnUmYgiUI/FjfylfT3 aEZ/Wj14bG/nnlwsbEiGt6i3gEArSFdRBn/y0zkvaWmC6NTc/uCGD+Avv1h+BvN4+TaU26 obbXfsUuUA0QhhK93JoVUoyIbO6OIpjbQ9694ivz25oX3Sqhjx7+4KUwJjHm2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1775237597; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references:dkim-signature; bh=pbkzSQo2sMtqe/ikEF3mcgRLQ1hnOMf1uFPfjBKG3GM=; b=26ATwUy9cGb/xhNn4XQyUHzCE9RLkoOnF35E6zKxmr+YjjyzDfsfBhVg7HcTsLd2syFREa TrlRT3DjjsKLO2rmC1M7vYigA/hrEIJFtb5vnqS6GS+4BwMn95RKSCt3orEUKOrybNNwr0 SAN8zIvfvNCCAn69l9y3BW7d9S9yL83sDzumWZBAzsU4MO5Fjm6Xkq24O9lCN5cBaTXZVl 7fFxJwW3P0Fb5meoT2dlFx6p9G2tk6hS6UTTJG9+LKXnGxRn5kqBWqR1Jy+av/nY+TLWdU TNBTDd0k3vvR1Um62PcpIC8qa0RFOd+/tItqam8Bshnoo78xhvyXY1OqAEb36g== ARC-Authentication-Results: i=1; rspamd-bd48b9d95-b7k4c; auth=pass smtp.auth=yszpovajlk smtp.mailfrom=juris@glaive.pro X-Sender-Id: yszpovajlk|x-authuser|juris@glaive.pro X-MC-Relay: Neutral X-MailChannels-SenderId: yszpovajlk|x-authuser|juris@glaive.pro X-MailChannels-Auth-Id: yszpovajlk X-Reaction-Harmony: 180289c807b4d2b0_1775237597689_354950337 X-MC-Loop-Signature: 1775237597689:2272814951 X-MC-Ingress-Time: 1775237597689 Received: from server52.areait.lv (server52.areait.lv [83.149.95.205]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.96.162.172 (trex/7.1.5); Fri, 03 Apr 2026 17:33:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=glaive.pro; s=default; h=Content-Type:Message-ID:References:In-Reply-To:Subject:Cc:To: From:Date:MIME-Version:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=pbkzSQo2sMtqe/ikEF3mcgRLQ1hnOMf1uFPfjBKG3GM=; b=hbtzLIQcGToMsyzJk+zc7oylkI grKDZH9VoNsBE2I2Vvm8R1661ZQVQCfTiU107zNuHGfvgioM1LXgPGWjBDUBgaAyAUA6EcFQw5Bpx qO6eUFXZSMz24wlIaWb2cOdNK1KkodzS53U8G2uVSYunItjErNiR2tRTm3MDi3WTTTVTxaWimvGAZ 5N0E8uPwzRzFXqeeNmme5Ceq2pD9IzHbZKtTCTskXpwPY66bY1y+BVjhusk4zcxJoaeyrdlZeo4Ky 9JFzeEMyV2TzSSUV7sbCZcCRO5M5TTCMLdWSK0H1AzCPJp9d9txvzL/M/CLCrOjkgVUHIhONiNm8v pgbQB8AQ==; Received: from [::1] (port=41728 helo=glaive.pro) by server52.areait.lv with esmtpa (Exim 4.99.1) (envelope-from ) id 1w8iOR-00000001ak6-1MNF; Fri, 03 Apr 2026 20:33:15 +0300 Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 Date: Fri, 03 Apr 2026 20:33:14 +0300 To: Ilia Cc: PHP Developers Mailing List Subject: Re: [PHP-DEV] PDO SQLite: statement attributes for SQL text retrieval In-Reply-To: References: User-Agent: Roundcube Webmail/1.4.8 Message-ID: <4d8d56c4522430326d796e240b24cdd2@glaive.pro> X-Sender: juris@glaive.pro Organization: SIA "Glaive.pro" Content-Type: multipart/alternative; boundary="=_0cb922866a7204a8946220225b74b3ea" X-AuthUser: juris@glaive.pro From: juris@glaive.pro (Juris Evertovskis) --=_0cb922866a7204a8946220225b74b3ea Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed On 2026-04-03 15:29, Ilia wrote: > Hi internals, > > I'm looking for feedback on a small pdo_sqlite addition. > > PR: https://github.com/php/php-src/pull/21456 > Implements: https://github.com/php/php-src/issues/21322 > > Two new read-only statement attributes on Pdo\Sqlite: > - Pdo\Sqlite::ATTR_SQL -- original SQL text of a prepared statement > (via sqlite3_sql()) > - Pdo\Sqlite::ATTR_EXPANDED_SQL -- SQL with bound parameters inlined > (via sqlite3_expanded_sql()) > > $stmt = $db->prepare('SELECT :name AS greeting'); > $stmt->bindValue(':name', 'hello'); > $stmt->execute(); > > $stmt->getAttribute(Pdo\Sqlite::ATTR_SQL); // "SELECT :name AS > greeting" > $stmt->getAttribute(Pdo\Sqlite::ATTR_EXPANDED_SQL); // "SELECT 'hello' > AS greeting" > > This mirrors SQLite3Stmt::getSQL() from the non-PDO API, but uses PDO's > getAttribute() mechanism rather than adding a driver-specific method. > The attribute system is how PDO drivers expose driver-specific > functionality, so it's a natural fit. > > ATTR_EXPANDED_SQL is gated behind a configure check for > sqlite3_expanded_sql availability. > > I don't think this needs a full RFC given the scope (two read-only > attributes, single driver, no BC impact), but I wanted input from the > list. > > Thoughts? > > -- > > Ilia Alshanetsky > Technologist, CTO, Entrepreneur > E: ilia@ilia.ws > T: @iliaa > B: http://ilia.ws Hello, I don't doubt the need to extract statement strings since logging the executed statements is something I do often, especially during development (tools like laravel-debugbar and newrelic's achieve that). It helps noticing repeated queries and other issues. But two things here are unclear to me: - What's insufficient with `->queryString` and other existing features? Does one of these overlap with `->queryString` or not? - What's so special about SQLite? Wouldn't the same need be just as present for any other driver? BR, Juris --=_0cb922866a7204a8946220225b74b3ea Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=UTF-8

On 2026-04-03 15:29, Ilia wrote:

Hi internals,

I'm looking for feedback on a small pdo_sqlit= e addition.

PR: https://github.com/php/= php-src/pull/21456
Implements: https://= github.com/php/php-src/issues/21322

Two new read-only statem= ent attributes on Pdo\Sqlite:
- Pdo\Sqlite::ATTR_SQL — original = SQL text of a prepared statement (via sqlite3_sql())
- Pdo\Sqlite::ATT= R_EXPANDED_SQL — SQL with bound parameters inlined (via sqlite3_expan= ded_sql())

$stmt =3D $db->prepare('SELECT :name AS greeting')= ;
$stmt->bindValue(':name', 'hello');
$stmt->execute();

$stmt->getAttribute(Pdo\Sqlite::ATTR_SQL);       =    // "SELECT :name AS greeting"
$stmt->getAttribute(Pdo\= Sqlite::ATTR_EXPANDED_SQL); // "SELECT 'hello' AS greeting"

This= mirrors SQLite3Stmt::getSQL() from the non-PDO API, but uses PDO's getAttr= ibute() mechanism rather than adding a driver-specific method. The attribut= e system is how PDO drivers expose driver-specific functionality, so it's a= natural fit.

ATTR_EXPANDED_SQL is gated behind a configure chec= k for sqlite3_expanded_sql availability.

I don't think this need= s a full RFC given the scope (two read-only attributes, single driver, no B= C impact), but I wanted input from the list.

Thoughts?

--
Ilia Alshanetsky
Technologist, CTO, Entrepreneur
T: @iliaa 

Hello,

I don't doubt the need to extract statement strings since logging the ex= ecuted statements is something I do often, especially during development (t= ools like laravel-debugbar and newrelic's achieve that). It helps noticing = repeated queries and other issues.

But two things here are unclear to me:
- What's insufficient with `= ->queryString` and other existing features? Does one of these overlap wi= th `->queryString` or not?
- What's so special about SQLite? W= ouldn't the same need be just as present for any other driver?

BR,
Juris

--=_0cb922866a7204a8946220225b74b3ea--