Expand PDO API coverage - #471
Draft
JanJakes wants to merge 10 commits into
Draft
Conversation
JanJakes
force-pushed
the
pdo-coverage
branch
6 times, most recently
from
August 4, 2026 19:03
01db6d5 to
2bd2721
Compare
Expose generated IDs through PDO::lastInsertId(), retain integer conversion in the legacy facade, and migrate direct consumers to the PDO API.
JanJakes
commented
Aug 5, 2026
| * | ||
| * @return int|string | ||
| */ | ||
| public function get_insert_id() { |
Member
Author
JanJakes
commented
Aug 5, 2026
| * @throws PDOException When the query execution fails. | ||
| * @return PDOStatement The PDO statement object. | ||
| */ | ||
| public function get_last_column_count(): int { |
Member
Author
Snapshot IDs produced by user INSERT and REPLACE statements so internal information-schema writes cannot alter PDO and legacy driver results.
Treat direct transaction calls as independent operations so insert IDs and SQLite query traces do not leak across operation boundaries.
Initialize the original MySQL query string and delegate supported result-oriented PDOStatement operations to the wrapped SQLite statement.
Preserve native PDO diagnostics and provide MySQL-compatible SQLSTATE, vendor code, and message tuples for emulated errors.
Track driver diagnostics and honor PDO::ATTR_ERRMODE for query() and exec() while keeping the underlying SQLite connection in exception mode.
Accept null options, pass numeric attributes to new SQLite connections, and apply caller-visible attributes through the wrapper.
Override PDO::connect() on PHP 8.4 and newer while loading an empty compatibility trait on older supported runtimes.
Return the standard IM001 PDO diagnostic according to the configured error mode instead of invoking uninitialized parent PDO state.
Snapshot raw result metadata into each PDO statement, resolve and cache MySQL-compatible metadata lazily, and migrate consumers away from mutable driver-wide last-query metadata. Preserve the legacy metadata getters only on the deprecated WP_SQLite_Driver facade.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Stacked on #469.
This expands PDO compatibility for
WP_MySQL_On_SQLitebefore 3.0 by covering connection diagnostics, constructor options, result statements, column metadata, and PHP 8.4's connection factory. Prepared statements now fail through standard PDO diagnostics until parameter binding can be implemented safely across the full translation pipeline.lastInsertId(),errorCode(), anderrorInfo()without relying on uninitialized parent PDO state.PDOStatement::$queryStringand delegate safe result-statement methods including iteration,closeCursor(),bindColumn(),nextRowset(), diagnostics, anddebugDumpParams().getColumnMeta()with itsarray|falsecontract, and migrate the WordPress and MySQL proxy consumers.get_last_column_count()andget_last_column_meta()compatibility methods.PDOException::$errorInfowith native SQLite or emulated MySQL diagnostics.PDO::connect()on PHP 8.4+ so it creates the emulated connection.prepare()as unsupported with SQLSTATEIM001, respecting the configured PDO error mode instead of triggering an uninitialized-object error.