Goal
Run WordPress and arbitrary plugins through a pure-PHP database engine that preserves MySQL-visible SQL and wpdb behavior while using MDI canonical files as authoritative storage. The implementation is database-agnostic and has no SQLite, MySQL, MariaDB, sidecar, wire-protocol, or compiled-runtime dependency.
Architecture constraints
- Implement the SQL lexer, parser, typed AST, planner, optimizer, and executor in PHP.
- Execute through
WP_Markdown_Native_WPDB; the native engine does not require or emulate a real mysqli server handle.
- Keep SQL grammar, planning, and execution table-neutral. WordPress and plugin semantics enter through typed schemas and canonical storage providers.
- Use canonical options, Markdown content, JSON snapshots, and row partitions as native storage primitives.
- Implement MySQL-compatible coercion, collations, metadata, errors, insert IDs, affected rows, session state, and transaction behavior without linking behavior to a MySQL implementation.
- Expand compatibility from deterministic corpus and shadow evidence, not table-specific parser branches.
Workstreams
- Replace the bounded regex recognizer with a pure-PHP tokenizer and typed MySQL AST.
- Add generic expressions, aliases, joins, boolean predicates, ordering, grouping, aggregation, and limits.
- Add a typed schema catalog and MySQL-compatible type/collation system.
- Add canonical indexes and pushdown over options, Markdown posts, snapshots, and row partitions.
- Add generic DML, auto-increment, constraints, and exact
wpdb mutation state.
- Add atomic multi-file transactions, savepoints, locking, journaling, and crash recovery.
- Add dynamic DDL and plugin table persistence for
dbDelta() and schema introspection.
- Add a native
db.php bootstrap path before every SQLite/PDO check.
- Differentially verify WordPress install, front end, admin, REST, cron, WP-CLI, multisite, and representative plugins.
Acceptance criteria
- WordPress installs and boots with PHP alone and no database extension or external database process.
- Arbitrary plugin SQL issued through
wpdb is parsed and executed by the generic PHP engine.
- Core and plugin DDL/DML/transactions preserve MySQL-visible rows, metadata, errors, insert IDs, affected rows, and session behavior.
- Canonical files remain authoritative and recover after process termination at every transaction boundary.
- Unsupported SQL fails through deterministic MySQL-compatible
wpdb errors without fallback to SQLite or MySQL.
- The compatibility matrix has no unexplained differential failures for the accepted WordPress/plugin corpus.
References
AI assistance
GPT-5.6 Sol via OpenCode helped inspect the existing PHP query and storage contracts and structure the corrected pure-PHP workstreams. Chris Huber explicitly required a pure-PHP, database-agnostic implementation and rejected the prior sidecar direction.
Goal
Run WordPress and arbitrary plugins through a pure-PHP database engine that preserves MySQL-visible SQL and
wpdbbehavior while using MDI canonical files as authoritative storage. The implementation is database-agnostic and has no SQLite, MySQL, MariaDB, sidecar, wire-protocol, or compiled-runtime dependency.Architecture constraints
WP_Markdown_Native_WPDB; the native engine does not require or emulate a realmysqliserver handle.Workstreams
wpdbmutation state.dbDelta()and schema introspection.db.phpbootstrap path before every SQLite/PDO check.Acceptance criteria
wpdbis parsed and executed by the generic PHP engine.wpdberrors without fallback to SQLite or MySQL.References
AI assistance
GPT-5.6 Sol via OpenCode helped inspect the existing PHP query and storage contracts and structure the corrected pure-PHP workstreams. Chris Huber explicitly required a pure-PHP, database-agnostic implementation and rejected the prior sidecar direction.