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 c3f95d9
Browse filesBrowse the repository at this point in the historyBrowse files
Load and instantiate WP_MySQL_On_SQLite automatically when available while retaining flag-controlled fallbacks for older plugin layouts. Adapt query results, documentation, and fixtures to the PDO API.
Centralize MySQL identifier quoting and ensure multiline identifiers remain safely inside dump comments.
Copy file name to clipboardExpand all lines: AGENTS.md
+6-6Lines changed: 6 additions & 6 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]`Enable the AST driver on older integration plugin releases. The current `WP_MySQL_On_SQLite` API is selected automatically when available.
15
15
16
16
### `wp sqlite export [<file>]`
17
17
@@ -23,7 +23,7 @@ Exports the SQLite database to a MySQL-compatible SQL dump file. Generates `DROP
23
23
-`[--tables=<tables>]` Comma-separated list of tables to include. If omitted, all tables are exported.
24
24
-`[--exclude_tables=<tables>]` Comma-separated list of tables to skip.
25
25
-`[--porcelain]` Output only the filename (for scripting).
26
-
-`[--enable-ast-driver]`Use the new AST-based driver.
26
+
-`[--enable-ast-driver]`Enable the AST driver on older integration plugin releases.
27
27
28
28
### `wp sqlite tables`
29
29
@@ -32,13 +32,13 @@ Lists all user tables in the SQLite database, excluding internal/system tables.
32
32
**Parameters:**
33
33
34
34
-`[--format=<format>]` Output format: `list` (default, one table per line), `csv`, or `json`.
35
-
-`[--enable-ast-driver]`Use the new AST-based driver.
35
+
-`[--enable-ast-driver]`Enable the AST driver on older integration plugin releases.
- 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
+
-The PDO-based `WP_MySQL_On_SQLite` API is selected automatically when available; `WP_SQLite_Translator` and `WP_SQLite_Driver`remain as compatibility fallbacks for older integration plugin releases
-`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 the class is 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