Repository navigation
feat(history): record a multi-statement run one statement at a time - #602
Merged
Merged
Conversation
A script executed as one batch recorded one history entry for the whole thing. A script whose third statement failed showed as one opaque failure, with no way to tell which line to look at (#329). Each QueryResult now carries the statement it came from, and QueryError carries the index of the statement that failed. The pairing is the backend's: the executor already splits the script to run it, and splitting the text again in the frontend would be a second splitter to keep in step with the first, which they would not stay. CoreError gains an AtStatement wrapper rather than an index on every variant — only the multi-statement executor knows the index, and only a caller that has to point at a line cares. Its Display passes straight through, so nothing that only reads the message has to know it exists. The frontend records one entry per result. Row counts are per statement. Timing is not: the batch's elapsed time is repeated on each entry, because per-statement timings are not measured separately and inventing a split would be worse than repeating the one number that is true. A result with no statement text falls back to the whole script, so a backend that does not report it leaves the panel showing what ran rather than an empty row. The SQLite executor is that case today. Verified against live MySQL 8: a three-statement script whose last statement hits a missing table reports statement_index 2 and code 1146, and each result names its own statement. Closes #329 Co-Authored-By: Claude Opus 5 <[email protected]>
EVWorth
force-pushed
the
feat/history-per-statement
branch
from
September 10, 2026 01:04
df3c3a7 to
22a56a8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #329.
A script executed as one batch recorded one history entry for the whole thing. A script whose third statement failed showed as one opaque failure, with no way to tell which line to look at.
The pairing is the backend's
QueryResultnow carries the statement it came from, andQueryErrorcarries the index of the statement that failed. The executor already splits the script to run it — splitting the text again in the frontend would be a second splitter to keep in step with the first, and they wouldn't stay in step.CoreErrorgains anAtStatementwrapper rather than an index on every variant: only the multi-statement executor knows the index, and only a caller that has to point at a line cares. ItsDisplaypasses straight through, so nothing that merely reads the message has to know it exists.Two honest limits
Verified on a live server
MySQL 8:
SELECT 1; SELECT 2; SELECT * FROM definitely_not_a_tablereportsstatement_index: 2and code 1146; each result names its own statement. Both are permanent integration tests.One test that was passing for the wrong reason
The
makeQueryResultfixture had nosql, so the success-path assertions were exercising the fallback rather than the new path. Fixed, which surfaced a test whose fixture disagreed with the SQL it claimed to run.Verification
2 live integration tests, 4 new store tests. Full suite 1911 passing, clippy clean, 0 lint errors.