You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit e9e9fbe
Browse filesBrowse the repository at this point in the historyBrowse files
Create WP_MySQL_On_SQLite through SQLiteDriverFactory when AST mode and the class are available, while preserving older driver fallbacks. Handle PDO-style query results in export and table listing, and add integration coverage for both commands.
Copy file name to clipboardExpand all lines: AGENTS.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ Imports a MySQL dump file into the SQLite database. Parses SQL statements using
11
11
**Parameters:**
12
12
13
13
-`<file>` (required), Path to the SQL dump file. Use `-` to read from STDIN.
14
-
-`[--enable-ast-driver]` Use the new AST-based `WP_SQLite_Driver`instead of the legacy `WP_SQLite_Translator` for full MySQL compatibility.
14
+
-`[--enable-ast-driver]` Use the new AST-based `WP_MySQL_On_SQLite` driver instead of the legacy `WP_SQLite_Translator` for full MySQL compatibility. Older integration plugin versions fall back to `WP_SQLite_Driver`.
15
15
16
16
### `wp sqlite export [<file>]`
17
17
@@ -38,7 +38,7 @@ Lists all user tables in the SQLite database, excluding internal/system tables.
- WordPress SQLite Database Integration plugin, translation layer between MySQL queries and SQLite
41
-
- Two driver modes: legacy `WP_SQLite_Translator` and new AST-based `WP_SQLite_Driver` (via `--enable-ast-driver`)
41
+
- Two driver modes: legacy `WP_SQLite_Translator` and new AST-based `WP_MySQL_On_SQLite` (via `--enable-ast-driver`), with a `WP_SQLite_Driver` compatibility fallback
-`command.php` is the entry point, it registers `wp sqlite` as a WP-CLI command pointing to `SQLite_Command`
106
106
-`SQLite_Command` delegates to `Import`, `Export`, and `Tables` classes
107
107
-`SQLiteDatabaseIntegrationLoader::load_plugin()` bootstraps the WordPress SQLite Database Integration plugin, which MUST be loaded before any database operations
108
-
-`SQLiteDriverFactory::create_driver()` creates the appropriate driver based on whether the AST driver is enabled
108
+
-`SQLiteDriverFactory::create_driver()` creates the PDO-based `WP_MySQL_On_SQLite`driver when AST mode and the class are available, with compatibility fallbacks for older integration plugin versions and the legacy translator
109
109
- The import parser (`Import::parse_statements()`) is a streaming SQL parser using PHP generators, it handles quotes, comments, escape sequences, and multi-line statements character by character
110
110
111
111
## Common Pitfalls
112
112
113
113
-**MUST load the SQLite plugin first:** All database operations require `SQLiteDatabaseIntegrationLoader::load_plugin()` to be called before creating a driver. The driver depends on classes from the WordPress SQLite Database Integration plugin.
114
-
-**Two driver APIs:**The legacy `WP_SQLite_Translator` and new `WP_SQLite_Driver` (AST) have different class names. Use `SQLiteDriverFactory::create_driver()` to get the correct one, do not instantiate drivers directly.
114
+
-**Multiple driver APIs:**Always use `SQLiteDriverFactory::create_driver()`. It selects the PDO-based `WP_MySQL_On_SQLite` API when available and preserves compatibility with older AST drivers and the legacy translator.
115
115
-**SQL parser edge cases:** The `Import::parse_statements()` method handles escape sequences, nested quotes, and multi-line comments manually. Changes to this parser MUST be tested with the existing Behat scenarios in `features/sqlite-import.feature`.
116
116
-**Encoding handling:** Import attempts UTF-8 conversion as a fallback when queries fail. This is intentional error recovery, not a bug.
117
117
-**`@when after_wp_config_load`:** All command methods use this WP-CLI hook annotation. New commands MUST include it to ensure WordPress config is loaded before execution.
0 commit comments