Skip to content

Simplify the MySQL-on-SQLite driver API#449

Merged
JanJakes merged 2 commits into
trunkfrom
simplify-api
Jul 15, 2026
Merged

Simplify the MySQL-on-SQLite driver API#449
JanJakes merged 2 commits into
trunkfrom
simplify-api

Conversation

@JanJakes

@JanJakes JanJakes commented Jul 10, 2026

Copy link
Copy Markdown
Member

Summary

Use the PDO-compatible WP_MySQL_On_SQLite class directly in both the WordPress plugin and MySQL proxy, while retaining WP_SQLite_Driver temporarily for backward compatibility. This includes:

  • Rename WP_PDO_MySQL_On_SQLite to WP_MySQL_On_SQLite and align implementation, test, tooling, and CI.
  • Adapt legacy SQL behavior tests and production consumers to the PDOStatement query API.

This should be reviewed and merged together with Automattic/wp-cli-sqlite-command#33.

Motivation

Using the PDO-compatible driver directly makes it the primary public entry point with a clear, PDO-defined API. The legacy WP_SQLite_Driver constructor and result API remain available only as a temporary backward-compatibility layer.

Developer impact

The WP_SQLite_Driver API remains available for backward compatibility, but new consumers should construct WP_MySQL_On_SQLite with its DSN and options, and consume query() results as PDOStatement objects. Consumers using WP_PDO_MySQL_On_SQLite must update the class name to WP_MySQL_On_SQLite.

JanJakes added 2 commits July 15, 2026 16:18
Migrate the WordPress integration, MySQL proxy, tools, and tests to the PDO-style driver constructor and statement API.
Rename WP_PDO_MySQL_On_SQLite to WP_MySQL_On_SQLite and align the implementation and test filenames with the public class name.
@JanJakes
JanJakes merged commit 2f49fd5 into trunk Jul 15, 2026
23 checks passed
@JanJakes
JanJakes deleted the simplify-api branch July 15, 2026 14:54
batonac added a commit to Avunu/sqlite-database-integration that referenced this pull request Jul 17, 2026
Bring in the upstream 3.0.0-rc.7 release and reconcile it with the
Cloudflare D1 backend. The notable upstream changes are the driver API
simplification (WordPress#449), WordPress 7.0 compatibility (WordPress#450), and journal
mode preservation in the driver wrapper.

Reconciliation:

- Engine class: upstream renamed WP_PDO_MySQL_On_SQLite to
  WP_MySQL_On_SQLite (class-wp-pdo-mysql-on-sqlite.php ->
  class-wp-mysql-on-sqlite.php). The D1 connection injection is
  re-applied on top of the renamed, simplified API. Journal mode is
  preserved for D1 by reusing the injected connection directly rather
  than reading PRAGMA journal_mode off it.

- Driver test suites: upstream refactored the driver suites to exercise
  the WP_MySQL_On_SQLite PDO engine directly (was the WP_SQLite_Driver
  facade). The D1 backend switching is adapted accordingly:
  wp_sqlite_tests_create_pdo_engine() now exposes the raw SQLite handle,
  and the D1 skip-list keys follow the renamed WP_MySQL_On_SQLite_Tests
  class. WP_SQLite_Driver_No_UDF_Tests is renamed to
  WP_MySQL_On_SQLite_No_UDF_Tests for consistency, and the hardcoded
  test paths in the D1 and upstream-merge-check workflows are updated.

- D1 wpdb drop-in: WP_D1_DB now constructs WP_MySQL_On_SQLite directly,
  matching upstream's rewritten WP_SQLite_DB, which routes results
  through PDO statements instead of the legacy facade return values.

Verified with the default and D1 backend test suites and PHPCS.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

2 participants