I figured out how this works. The secret sauce is this code, which uses regular expressions to rewrite the MySQL SQL queries for compatibility with SQLite!
https://github.com/aaemnnosttv/wp-sqlite-db/blob/14f9e917c55...
https://github.com/aaemnnosttv/wp-sqlite-db/blob/14f9e917c55...
There are a variety of mature MySQL dialect parsers available[1][2], and MySQL should have its own public APIs for transforming a query into an AST. Any of those would be a safer and more correct alternative.
Or at least how much WP could be changed to meet at a common ground. How hard would be to run WP on Postgres? MSSQL? Or that legal company that sells a DB?
Behold: https://github.com/WordPress/WordPress/blob/master/wp-includ...