Skip to content

Expand PDO API coverage - #471

Draft
JanJakes wants to merge 11 commits into
removalsfrom
pdo-coverage
Draft

Expand PDO API coverage#471
JanJakes wants to merge 11 commits into
removalsfrom
pdo-coverage

Conversation

@JanJakes

@JanJakes JanJakes commented Aug 4, 2026

Copy link
Copy Markdown
Member

Summary

Stacked on #469.

This expands PDO compatibility for WP_MySQL_On_SQLite before 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.

  • Implement lastInsertId(), errorCode(), and errorInfo() without relying on uninitialized parent PDO state.
  • Isolate the public last insert ID from internal information-schema writes.
  • Honor numeric PDO constructor options, including fetch, stringification, persistence, and error modes, while keeping internal SQLite operations exception-safe.
  • Initialize PDOStatement::$queryString and delegate safe result-statement methods including iteration, closeCursor(), bindColumn(), nextRowset(), diagnostics, and debugDumpParams().
  • Snapshot result column metadata into each statement, implement getColumnMeta() with its array|false contract, and migrate the WordPress and MySQL proxy consumers.
  • Deprecate the stateful get_last_column_count() and get_last_column_meta() compatibility methods.
  • Populate PDOException::$errorInfo with native SQLite or emulated MySQL diagnostics.
  • Override PDO::connect() on PHP 8.4+ so it creates the emulated connection.
  • Report prepare() as unsupported with SQLSTATE IM001, respecting the configured PDO error mode instead of triggering an uninitialized-object error.

@JanJakes
JanJakes force-pushed the pdo-coverage branch 3 times, most recently from ceac9e8 to 89f9344 Compare August 4, 2026 15:03
Delegate last insert IDs and connection error diagnostics to the active SQLite PDO connection instead of the uninitialized parent PDO state.
Track IDs produced by user INSERT and REPLACE statements so internal information-schema writes cannot alter PDO and legacy driver results.
Initialize the original MySQL query string and expose safe result-oriented PDOStatement operations through the wrapped SQLite statement.
Expose MySQL-compatible metadata through each PDO statement and migrate internal consumers away from mutable driver-wide last-query metadata. Retain the legacy getters as deprecated compatibility APIs.
Preserve native PDO diagnostics and provide MySQL-compatible SQLSTATE, vendor code, and message tuples for emulated errors.
Apply numeric PDO attributes alongside named driver extensions, accept null options, and emulate caller-visible error modes while keeping internal SQLite operations exception-safe.
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.
@JanJakes
JanJakes force-pushed the pdo-coverage branch 2 times, most recently from c3cab19 to 01db6d5 Compare August 4, 2026 18:55
@JanJakes JanJakes mentioned this pull request Aug 4, 2026
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant