Skip to content

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

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

[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
Contributor

@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
Copy link
Copy Markdown
Member

@JanJakes JanJakes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching the INSERT without INTO case!

This requires test coverage, and I believe it can be implemented in a much simpler way. Let me try...

@JanJakes JanJakes mentioned this pull request Apr 3, 2026
6 tasks
@JanJakes JanJakes closed this in #354 Apr 3, 2026
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.

2 participants