Skip to content

fix(cli): execute SQLite scripts in statement order - #362

Merged
Maxteabag merged 1 commit into
mainfrom
fix/cli-sqlite-scripts
Nov 27, 2026
Merged

Maxteabag merged 1 commit into
mainfrom
fix/cli-sqlite-scripts

Conversation

@Maxteabag

Copy link
Copy Markdown
Owner

Summary

Follow-up to #352, based on the CLI script support proposed by Jay Hemnani (@jayhemnani9910). SQLite's statement completeness check keeps trigger bodies intact. The original PR's generic splitter reports incomplete input for a trigger that SQLite can execute as one statement.

The SQLite CLI runs script statements in order and reports the first error. On success, it displays only the final statement's result. SQLite commits standalone writes, so committed changes can survive a later error. The CLI leaves transaction boundaries to the script. Other providers continue to receive the original SQL.

Verification on ai-swarm

  • Real file-backed SQLite via the CLI: final result only; previous insert persists after a unique constraint error; a later insert is skipped; an uncommitted explicit transaction rolls back; an error while reading an intermediate SELECT also stops execution.
  • Standalone SQLite trigger and a trigger inside a script containing a UTF-8 BOM both fired all body statements. A separate CLI read returned 1, 2, 3.
  • PostgreSQL 16.16 accepted a tagged dollar-quoted PL/pgSQL body with internal semicolons. Invocation through the CLI returned 42.
  • MariaDB 11.8.9 accepted a BEGIN … END procedure with internal semicolons. Invocation through the CLI returned 42.

CLI and unit suite: 1,322 passed and 11 skipped. All six SQLite regressions passed on the final commit after a type-safe adjustment to the trivia matcher.

Use SQLite statement boundaries and preserve existing query handling for other drivers. Based on the CLI script support proposed by Jay Hemnani (jayhemnani9910) in #352.
@Maxteabag
Maxteabag merged commit cb49cbb into main Nov 27, 2026
23 checks passed
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