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: [email protected] T: @iliaa B: http://ilia.ws
