Unify emulated MySQL server identity - #479
Open
JanJakes wants to merge 4 commits into
Open
Conversation
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.
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
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:
mysql_version, unify its usage, and fix formatting.versionandversion_commentthrough both@@variables andSHOW 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.
PDO::ATTR_DRIVER_NAMEmysqlmysqlPDO::ATTR_SERVER_VERSION8.0.38-mysql-on-sqlite-3.0.0-rc.810.11.15-MariaDB-ubu2204PDO::ATTR_CLIENT_VERSIONmysqlnd 8.0.38-mysql-on-sqlite-3.0.0-rc.8mysqlnd 8.5.9VERSION()8.0.38-mysql-on-sqlite-3.0.0-rc.810.11.15-MariaDB-ubu2204@@version@@GLOBAL.versionSHOW VARIABLES: version8.0.38-mysql-on-sqlite-3.0.0-rc.810.11.15-MariaDB-ubu2204@@version_comment@@GLOBAL.version_commentSHOW VARIABLES: version_commentMySQL on SQLitemariadb.org binary distributionWP_SQLite_DB::db_version()8.0.3810.11.15WP_SQLite_DB::db_server_info()8.0.38-mysql-on-sqlite-3.0.0-rc.810.11.15-MariaDB-ubu2204WP_MySQL_On_SQLite::$client_infomysqlnd 8.0.38-mysql-on-sqlite-3.0.0-rc.8mysqlnd 8.5.9Accepted 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_charsetdata sets#5and#6, because the driver still reportsutf8instead of the modernutf8mb3alias.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.