Skip to content

Unify emulated MySQL server identity - #479

Open
JanJakes wants to merge 4 commits into
docs-fixesfrom
versions
Open

Unify emulated MySQL server identity#479
JanJakes wants to merge 4 commits into
docs-fixesfrom
versions

Conversation

@JanJakes

@JanJakes JanJakes commented Aug 7, 2026

Copy link
Copy Markdown
Member

Summary

This PR is stacked on #477.

This PR makes the configured MySQL version the single source of truth for parsing and version reporting. It also makes the driver consistently identify itself as MySQL on SQLite instead of exposing SQLite details through MySQL-facing APIs.

The changes are:

  • Version handling: Validate mysql_version, unify its usage, and fix formatting.
  • Server identity: Report the driver name and consistent server, client, SQL, and WordPress version information.
  • System variables: Report version and version_comment through both @@ variables and SHOW VARIABLES.

Why

The parser previously used a hard-coded MySQL version, while different public APIs could report conflicting MySQL and SQLite identities. The version and server identity reporting was messy and unfinished.

Reported values

With the default mysql_version (80038) and current driver version (3.0.0-rc.8), the APIs report:

The MariaDB reference values were measured with MariaDB 10.11.15 from the official container and PHP 8.5.9 with mysqlnd. Distribution and client suffixes can vary.

Interface MySQL on SQLite MariaDB reference
PDO::ATTR_DRIVER_NAME mysql mysql
PDO::ATTR_SERVER_VERSION 8.0.38-mysql-on-sqlite-3.0.0-rc.8 10.11.15-MariaDB-ubu2204
PDO::ATTR_CLIENT_VERSION mysqlnd 8.0.38-mysql-on-sqlite-3.0.0-rc.8 mysqlnd 8.5.9
VERSION() 8.0.38-mysql-on-sqlite-3.0.0-rc.8 10.11.15-MariaDB-ubu2204
@@version
@@GLOBAL.version
SHOW VARIABLES: version
8.0.38-mysql-on-sqlite-3.0.0-rc.8 10.11.15-MariaDB-ubu2204
@@version_comment
@@GLOBAL.version_comment
SHOW VARIABLES: version_comment
MySQL on SQLite mariadb.org binary distribution
WP_SQLite_DB::db_version() 8.0.38 10.11.15
WP_SQLite_DB::db_server_info() 8.0.38-mysql-on-sqlite-3.0.0-rc.8 10.11.15-MariaDB-ubu2204
WP_MySQL_On_SQLite::$client_info mysqlnd 8.0.38-mysql-on-sqlite-3.0.0-rc.8 mysqlnd 8.5.9

Accepted WordPress test failures

Reporting MySQL 8.0.38 causes WordPress to apply MySQL 8 behavior when interpreting database metadata. This exposes three existing compatibility gaps:

  • Tests_DB_Charset::test_get_column_charset data sets #5 and #6, because the driver still reports utf8 instead of the modern utf8mb3 alias.
  • Tests_DB_dbDelta::test_column_type_change, because the driver still reports integer display widths that MySQL 8.0.19 and later omit.

These cases are tracked as expected failures in this PR. Version-dependent metadata reporting will be addressed separately in a follow-up.

@JanJakes JanJakes mentioned this pull request Aug 7, 2026
10 tasks
Use the configured MySQL version for parser version gates and report it consistently through PDO, SQL, and wpdb APIs.
Expose the MySQL PDO driver name while identifying the implementation as MySQL on SQLite through @@version_comment.
Reporting MySQL 8.0.38 exposes existing differences in utf8mb3 metadata and integer display-width reporting. Track the three affected WordPress tests as expected failures and remove the spatial-index case that now passes.
@JanJakes
JanJakes marked this pull request as ready for review August 7, 2026 16:08
@JanJakes
JanJakes requested a review from adamziel August 7, 2026 16:11
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