[php-src] PR #21456: ext/pdo_sqlite: add ATTR_SQL and ATTR_EXPANDED_SQL statement attributes

From: Date: Sun, 15 Mar 2026 16:42:29 +0000
Subject: [php-src] PR #21456: ext/pdo_sqlite: add ATTR_SQL and ATTR_EXPANDED_SQL statement attributes
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-35244@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/21456 Author: iliaal ## Summary Implements #21322 -- adds support for retrieving the SQL text of a prepared PDO SQLite statement via PDOStatement::getAttribute(), mirroring SQLite3Stmt::getSQL(). Two new statement attributes on Pdo\Sqlite: - ATTR_SQL -- returns the original SQL text (sqlite3_sql()) - ATTR_EXPANDED_SQL -- returns SQL with bound parameters expanded (sqlite3_expanded_sql(), guarded by configure check) ```php $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" ``` ## Changes - php_pdo_sqlite_int.h -- new enum values PDO_SQLITE_ATTR_SQL, PDO_SQLITE_ATTR_EXPANDED_SQL - sqlite_statement.c -- handle new attributes in pdo_sqlite_stmt_get_attribute() - config.m4 / config.w32 -- configure check for sqlite3_expanded_sql - pdo_sqlite.stub.php + pdo_sqlite_arginfo.h -- PHP-visible constants - New test pdo_sqlite_getattr_sql.phpt, updated pdo_sqlite_constants.phpt Feature addition is fairly small, I don't think it needs an RFC. Implements feature request #21322

« previous php.git-pulls (#35244) next »