Skip to content

[AST] Support INSERT/REPLACE without INTO and MySQL priority modifiers#343

Open
wp-fuse wants to merge 1 commit intoWordPress:trunkfrom
wp-fuse:feature/pr-2-insert-without-into
Open

[AST] Support INSERT/REPLACE without INTO and MySQL priority modifiers#343
wp-fuse wants to merge 1 commit intoWordPress:trunkfrom
wp-fuse:feature/pr-2-insert-without-into

Conversation

@wp-fuse
Copy link
Copy Markdown

@wp-fuse wp-fuse commented Mar 30, 2026

Objective: Enhance the AST driver to support MySQL INSERT and REPLACE statements that omit the INTO keyword, and safely handle MySQL-specific priority modifiers that are unsupported in SQLite.

Changes:

Implemented robust INTO keyword injection in execute_insert_or_replace_statement.
Added logic to automatically skip unsupported MySQL priority modifiers (LOW_PRIORITY, HIGH_PRIORITY, DELAYED) which trigger syntax errors in SQLite.
Ensured that INTO is injected at the correct position relative to survive modifiers like OR IGNORE (translated from MySQL IGNORE).
Added semantic check to only apply OR IGNORE transformation on INSERT statements, not REPLACE.
Fixed a potential syntax issue in array_splice for better cross-version PHP compatibility.

Verification:

Validated via unit tests including simple INSERT without INTO, INSERT IGNORE without INTO, and INSERT LOW_PRIORITY ohne INTO.
All tests passing with WP_SQLITE_AST_DRIVER enabled.
Coding standards (CS) validated and fixed.

@wp-fuse wp-fuse force-pushed the feature/pr-2-insert-without-into branch from 517eca6 to 7f869ca Compare March 30, 2026 23:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant