Skip to content

Run every statement in a query passed to the CLI - #352

Open
jayhemnani9910 wants to merge 1 commit into
Maxteabag:mainfrom
jayhemnani9910:fix/cli-multi-statement
Open

jayhemnani9910 wants to merge 1 commit into
Maxteabag:mainfrom
jayhemnani9910:fix/cli-multi-statement

Conversation

@jayhemnani9910

Copy link
Copy Markdown

sqlit query -f script.sql passed the whole file to the driver in one call, so a file with more than one statement failed on SQLite with You can only execute one statement at a time, and nothing ran. The README documents -f for SQL files.

The CLI now splits the query with split_statements, like the TUI. It runs the statements in order, stops at the first error and prints the last statement's result. A single-statement query takes the same path as before.

create table; insert; select in a file now runs and prints the row. The new CLI test fails without the change. pytest tests/unit tests/cli passes. I only ran this against SQLite.

sqlit query -f script.sql handed the whole file to the driver, and
SQLite refuses more than one statement per execute.

This branch has not been deployed

No deployments
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