Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
2cfc1d3
Scaffold the mysql-parser package
JanJakes Jun 11, 2026
98c7268
Copy existing MySQL-on-SQLite primitives
JanJakes Jun 11, 2026
3aed18c
Add reproducible grammar build tooling
JanJakes Jun 11, 2026
744708d
Add generated grammar artifacts (mysql-8.4.10)
JanJakes Jun 11, 2026
469c8ae
Adapt the lexer to the MySQL grammar
JanJakes Jun 11, 2026
3807a26
Implement LALR(1) parser
JanJakes Jun 18, 2026
0f56737
Implement MySQL grammar for the LALR(1) parser
JanJakes Jun 18, 2026
0ffecc6
Pack modal shift targets in the parse table
JanJakes Jun 11, 2026
6e93e31
Add the MySQL server query corpus to the package
JanJakes Jun 12, 2026
85c4b9a
Add the corpus benchmark
JanJakes Jun 11, 2026
60fd4a1
Add the test suite and a CI job
JanJakes Jun 11, 2026
e347cb2
Add README.md
JanJakes Jun 18, 2026
33842bf
Speed up remaining_tokens() with a tight scan loop
JanJakes Jun 19, 2026
91f53a1
Replace the lexer's token queue with a single pending slot
JanJakes Jun 19, 2026
3c56165
Make WP_MySQL_Token::get_value() binary-safe for string literals
JanJakes Jun 18, 2026
ae509f6
Stop unescaping backslashes in backtick-quoted identifier values
JanJakes Jun 18, 2026
3496b6c
Keep IGNORE_SPACE whitespace out of function-name token ranges
JanJakes Jun 18, 2026
4f669e4
Support six-digit version comments in the lexer
JanJakes Jun 18, 2026
01a4ce5
Add a flattened child node accessor for grammar list rules
JanJakes Jun 12, 2026
33cbf06
Support the ANSI_QUOTES SQL mode in the lexer
JanJakes Jun 12, 2026
5eaef7a
Wire the SQLite driver to the wordpress/mysql-parser package
JanJakes Jun 12, 2026
884ae3a
Port the query translation layer to the new MySQL AST
JanJakes Jun 12, 2026
43129cd
Port the information schema builder to the new MySQL AST
JanJakes Jun 12, 2026
abccf3e
Adapt the test suites and tools to the mysql-parser package
JanJakes Jun 12, 2026
47a1035
Adapt the WordPress environments, plugin build, and CI workflows
JanJakes Jun 12, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/lexer-benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ jobs:
php-version: '8.4'
coverage: none

- name: Install Composer dependencies (mysql-on-sqlite)
uses: ramsey/composer-install@v3
with:
working-directory: packages/mysql-on-sqlite
composer-options: "--optimize-autoloader"

- name: Benchmark base vs PR
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
Expand Down
53 changes: 53 additions & 0 deletions .github/workflows/mysql-parser-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: MySQL Parser Tests

on:
push:
branches:
- trunk
paths:
- '.github/workflows/mysql-parser-tests.yml'
- 'packages/mysql-parser/**'
pull_request:
paths:
- '.github/workflows/mysql-parser-tests.yml'
- 'packages/mysql-parser/**'
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

# Disable permissions for all available scopes by default.
# Any needed permissions should be configured at the job level.
permissions: {}

jobs:
test:
# The runtime supports PHP 7.2+; test the oldest and the latest.
name: PHP ${{ matrix.php }}
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read # Required to clone the repo.
strategy:
fail-fast: false
matrix:
php: [ '7.2', '8.5' ]

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none

- name: Install dependencies
working-directory: packages/mysql-parser
run: composer install --no-interaction --no-progress

- name: Run tests
working-directory: packages/mysql-parser
run: composer run test
9 changes: 9 additions & 0 deletions .github/workflows/mysql-proxy-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@ jobs:
composer-options: "--optimize-autoloader"
working-directory: packages/mysql-proxy

# The proxy tests run the SQLite driver, which loads its own Composer
# dependencies (wordpress/mysql-parser).
- name: Install Composer dependencies (mysql-on-sqlite)
uses: ramsey/composer-install@v3
with:
ignore-cache: "yes"
composer-options: "--optimize-autoloader"
working-directory: packages/mysql-on-sqlite

- name: Run MySQL Proxy tests
run: composer run test
working-directory: packages/mysql-proxy
84 changes: 14 additions & 70 deletions .github/workflows/phpunit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ on:
paths:
- '.github/workflows/phpunit-tests.yml'
- 'packages/mysql-on-sqlite/**'
- 'packages/php-ext-wp-mysql-parser/**'
- 'packages/mysql-parser/**'
- 'composer.json'
- 'composer.lock'
pull_request:
paths:
- '.github/workflows/phpunit-tests.yml'
- 'packages/mysql-on-sqlite/**'
- 'packages/php-ext-wp-mysql-parser/**'
- 'packages/mysql-parser/**'
- 'composer.json'
- 'composer.lock'
workflow_dispatch:
Expand All @@ -29,10 +29,7 @@ permissions: {}

jobs:
test:
# The pure-PHP parser is exercised across the full PHP/SQLite range; the
# native Rust parser extension is exercised on PHP 8.0+ (its minimum). Both
# run the same mysql-on-sqlite suite, just with a different parser engine.
name: PHP ${{ matrix.php }}${{ matrix.extension && ' + ext-wp-mysql-parser' || '' }} / SQLite ${{ matrix.sqlite }}
name: PHP ${{ matrix.php }} / SQLite ${{ matrix.sqlite }}
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
Expand All @@ -41,24 +38,17 @@ jobs:
fail-fast: false
matrix:
include:
# Pure-PHP parser, across the supported PHP versions, each pinned to a
# representative SQLite version spanning the supported range.
- { php: '7.2', sqlite: '3.27.0', extension: false } # minimum with WP_SQLITE_UNSAFE_ENABLE_UNSUPPORTED_VERSIONS
- { php: '7.3', sqlite: '3.31.1', extension: false } # Ubuntu 20.04 LTS
- { php: '7.4', sqlite: '3.34.1', extension: false } # Debian 11 (Bullseye)
- { php: '8.0', sqlite: '3.37.0', extension: false } # minimum supported version (STRICT tables)
- { php: '8.1', sqlite: '3.40.1', extension: false } # Debian 12 (Bookworm)
- { php: '8.2', sqlite: '3.45.1', extension: false } # Ubuntu 24.04 LTS
- { php: '8.3', sqlite: '3.46.1', extension: false } # Debian 13 (Trixie)
- { php: '8.4', sqlite: '3.51.2', extension: false } # First 2026 release
- { php: '8.5', sqlite: 'latest', extension: false }
# Native Rust parser extension (requires PHP 8.0+).
- { php: '8.0', sqlite: '3.37.0', extension: true }
- { php: '8.1', sqlite: '3.40.1', extension: true }
- { php: '8.2', sqlite: '3.45.1', extension: true }
- { php: '8.3', sqlite: '3.46.1', extension: true }
- { php: '8.4', sqlite: '3.51.2', extension: true }
- { php: '8.5', sqlite: 'latest', extension: true }
# All supported PHP versions, each pinned to a representative SQLite
# version spanning the supported range.
- { php: '7.2', sqlite: '3.27.0' } # minimum with WP_SQLITE_UNSAFE_ENABLE_UNSUPPORTED_VERSIONS
- { php: '7.3', sqlite: '3.31.1' } # Ubuntu 20.04 LTS
- { php: '7.4', sqlite: '3.34.1' } # Debian 11 (Bullseye)
- { php: '8.0', sqlite: '3.37.0' } # minimum supported version (STRICT tables)
- { php: '8.1', sqlite: '3.40.1' } # Debian 12 (Bookworm)
- { php: '8.2', sqlite: '3.45.1' } # Ubuntu 24.04 LTS
- { php: '8.3', sqlite: '3.46.1' } # Debian 13 (Trixie)
- { php: '8.4', sqlite: '3.51.2' } # First 2026 release
- { php: '8.5', sqlite: 'latest' }

steps:
- name: Checkout repository
Expand Down Expand Up @@ -124,29 +114,6 @@ jobs:
exit 1
fi

- name: Set up Rust
if: matrix.extension
uses: dtolnay/rust-toolchain@stable

- name: Cache Rust build
if: matrix.extension
uses: Swatinem/rust-cache@v2
with:
workspaces: packages/php-ext-wp-mysql-parser
# Segregate by PHP version: the extension links against the PHP headers
# of the matrix's php-config, so a build cached for one PHP version is
# ABI-incompatible with another (Zend module API mismatch on load).
key: php-${{ matrix.php }}

- name: Install native build dependencies
if: matrix.extension
run: |
sudo apt-get update
sudo apt-get install -y libclang-dev
echo "PHP_CONFIG=$(command -v php-config)" >> "$GITHUB_ENV"
LIBCLANG_SO="$(find /usr/lib -name 'libclang.so*' | head -n 1)"
echo "LIBCLANG_PATH=$(dirname "$LIBCLANG_SO")" >> "$GITHUB_ENV"

- name: Install Composer dependencies (root)
uses: ramsey/composer-install@v3
with:
Expand All @@ -160,29 +127,6 @@ jobs:
ignore-cache: "yes"
composer-options: "--optimize-autoloader"

- name: Check Rust formatting
if: ${{ matrix.extension && matrix.php == '8.2' }}
run: cargo fmt --check
working-directory: packages/php-ext-wp-mysql-parser

- name: Build parser extension
if: matrix.extension
run: cargo build --release
working-directory: packages/php-ext-wp-mysql-parser

- name: Verify native parser extension
if: matrix.extension
run: php -d extension="$GITHUB_WORKSPACE/packages/php-ext-wp-mysql-parser/target/release/libwp_mysql_parser.so" tests/tools/verify-native-parser-extension.php
working-directory: packages/mysql-on-sqlite

- name: Run PHPUnit suite with parser extension
if: matrix.extension
env:
WP_SQLITE_REQUIRE_NATIVE_PARSER_EXTENSION: '1'
run: php -d extension="$GITHUB_WORKSPACE/packages/php-ext-wp-mysql-parser/target/release/libwp_mysql_parser.so" ./vendor/bin/phpunit -c ./phpunit.xml.dist
working-directory: packages/mysql-on-sqlite

- name: Run PHPUnit suite
if: ${{ ! matrix.extension }}
run: php ./vendor/bin/phpunit -c ./phpunit.xml.dist
working-directory: packages/mysql-on-sqlite
Loading
Loading