Repository navigation
Commit 1f557c2
authored
Unify emulated MySQL server identity (#479)
## 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`<br>`@@GLOBAL.version`<br>`SHOW VARIABLES: version` |
`8.0.38-mysql-on-sqlite-3.0.0-rc.8` | `10.11.15-MariaDB-ubu2204` |
| `@@version_comment`<br>`@@GLOBAL.version_comment`<br>`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.1 parent 75664b9 commit 1f557c2
9 files changed
Lines changed: 250 additions & 73 deletions
File tree
- .github/workflows
- packages
- mysql-on-sqlite
- src/sqlite
- tests
- fixtures
- plugin-sqlite-database-integration/wp-includes/sqlite
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
| |||
52 | 54 | | |
53 | 55 | | |
54 | 56 | | |
55 | | - | |
| 57 | + | |
56 | 58 | | |
57 | 59 | | |
58 | 60 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
48 | 58 | | |
49 | 59 | | |
50 | 60 | | |
| |||
488 | 498 | | |
489 | 499 | | |
490 | 500 | | |
491 | | - | |
| 501 | + | |
492 | 502 | | |
493 | 503 | | |
494 | 504 | | |
| |||
775 | 785 | | |
776 | 786 | | |
777 | 787 | | |
| 788 | + | |
778 | 789 | | |
779 | 790 | | |
780 | 791 | | |
| |||
824 | 835 | | |
825 | 836 | | |
826 | 837 | | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
827 | 848 | | |
828 | 849 | | |
829 | 850 | | |
| |||
852 | 873 | | |
853 | 874 | | |
854 | 875 | | |
855 | | - | |
| 876 | + | |
856 | 877 | | |
857 | 878 | | |
858 | 879 | | |
| |||
909 | 930 | | |
910 | 931 | | |
911 | 932 | | |
912 | | - | |
913 | | - | |
| 933 | + | |
| 934 | + | |
914 | 935 | | |
915 | 936 | | |
916 | 937 | | |
| |||
1423 | 1444 | | |
1424 | 1445 | | |
1425 | 1446 | | |
1426 | | - | |
1427 | | - | |
| 1447 | + | |
| 1448 | + | |
| 1449 | + | |
| 1450 | + | |
| 1451 | + | |
| 1452 | + | |
| 1453 | + | |
| 1454 | + | |
1428 | 1455 | | |
1429 | | - | |
1430 | | - | |
| 1456 | + | |
1431 | 1457 | | |
1432 | 1458 | | |
1433 | 1459 | | |
| |||
1546 | 1572 | | |
1547 | 1573 | | |
1548 | 1574 | | |
1549 | | - | |
| 1575 | + | |
1550 | 1576 | | |
1551 | 1577 | | |
1552 | 1578 | | |
| |||
3247 | 3273 | | |
3248 | 3274 | | |
3249 | 3275 | | |
3250 | | - | |
3251 | | - | |
3252 | | - | |
3253 | | - | |
3254 | | - | |
3255 | | - | |
3256 | | - | |
3257 | | - | |
3258 | | - | |
3259 | | - | |
3260 | | - | |
3261 | | - | |
3262 | | - | |
3263 | | - | |
3264 | | - | |
3265 | | - | |
3266 | | - | |
3267 | | - | |
3268 | | - | |
3269 | | - | |
3270 | | - | |
3271 | | - | |
3272 | | - | |
3273 | | - | |
3274 | | - | |
| 3276 | + | |
3275 | 3277 | | |
3276 | 3278 | | |
3277 | 3279 | | |
| |||
3284 | 3286 | | |
3285 | 3287 | | |
3286 | 3288 | | |
| 3289 | + | |
| 3290 | + | |
| 3291 | + | |
| 3292 | + | |
| 3293 | + | |
| 3294 | + | |
| 3295 | + | |
| 3296 | + | |
| 3297 | + | |
| 3298 | + | |
| 3299 | + | |
| 3300 | + | |
| 3301 | + | |
| 3302 | + | |
| 3303 | + | |
| 3304 | + | |
| 3305 | + | |
| 3306 | + | |
| 3307 | + | |
| 3308 | + | |
| 3309 | + | |
| 3310 | + | |
| 3311 | + | |
| 3312 | + | |
| 3313 | + | |
| 3314 | + | |
| 3315 | + | |
| 3316 | + | |
| 3317 | + | |
| 3318 | + | |
| 3319 | + | |
| 3320 | + | |
| 3321 | + | |
3287 | 3322 | | |
3288 | 3323 | | |
3289 | 3324 | | |
| |||
4294 | 4329 | | |
4295 | 4330 | | |
4296 | 4331 | | |
4297 | | - | |
4298 | | - | |
4299 | | - | |
4300 | | - | |
4301 | | - | |
4302 | | - | |
4303 | | - | |
| 4332 | + | |
4304 | 4333 | | |
4305 | | - | |
| 4334 | + | |
4306 | 4335 | | |
4307 | 4336 | | |
4308 | 4337 | | |
| |||
5077 | 5106 | | |
5078 | 5107 | | |
5079 | 5108 | | |
5080 | | - | |
5081 | | - | |
5082 | | - | |
5083 | | - | |
5084 | | - | |
5085 | | - | |
5086 | | - | |
5087 | | - | |
| 5109 | + | |
5088 | 5110 | | |
5089 | 5111 | | |
5090 | 5112 | | |
5091 | 5113 | | |
5092 | 5114 | | |
| 5115 | + | |
| 5116 | + | |
| 5117 | + | |
| 5118 | + | |
| 5119 | + | |
| 5120 | + | |
| 5121 | + | |
| 5122 | + | |
| 5123 | + | |
| 5124 | + | |
| 5125 | + | |
| 5126 | + | |
| 5127 | + | |
| 5128 | + | |
| 5129 | + | |
| 5130 | + | |
| 5131 | + | |
| 5132 | + | |
| 5133 | + | |
| 5134 | + | |
| 5135 | + | |
| 5136 | + | |
| 5137 | + | |
| 5138 | + | |
| 5139 | + | |
| 5140 | + | |
| 5141 | + | |
| 5142 | + | |
| 5143 | + | |
| 5144 | + | |
| 5145 | + | |
| 5146 | + | |
| 5147 | + | |
| 5148 | + | |
| 5149 | + | |
| 5150 | + | |
5093 | 5151 | | |
5094 | 5152 | | |
5095 | 5153 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
78 | | - | |
| 78 | + | |
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
104 | 176 | | |
105 | 177 | | |
106 | 178 | | |
| |||
0 commit comments