feat(sql): per-statement result tabs for multi-statement scripts - #53
Merged
Conversation
Run a multi-statement script and get one result tab per statement. - SQLStatementSplitter (SimpletonSQL): split a script on top-level ';', reusing SQLTokenizer so semicolons inside strings, comments, and quoted identifiers don't split. Pure + headless. - SQLPanelModel runs each statement in order, publishing [StatementResult] and a selectedResultIndex mirrored into result; selectResult(_:) switches tabs. Inline editing / FK navigation stay single-statement affordances — a multi-statement run is read-only (they need a single-table SELECT context a script doesn't provide). - SQLResultsView shows a tab strip when there is more than one result (leading keyword + row/affected count per tab); a single statement renders exactly as before. Covered by 12 CoreChecks (splitting incl. strings/comments/identifiers); the SQL e2e asserts the path end to end (tabs=true singleTab=true).
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.
Summary
Run a multi-statement SQL script and get one result tab per statement (SP4 "per-statement result tabs"). Shared by the drawer panel and the workspace.
SQLStatementSplitter(SimpletonSQL) — split a script on top-level;, reusingSQLTokenizerso semicolons inside strings, comments, and quoted identifiers don't split. Pure + headless.SQLPanelModel— runs each statement in order, publishing[StatementResult]and aselectedResultIndexmirrored intoresult;selectResult(_:)switches tabs. Inline editing / FK navigation remain single-statement affordances (they need a single-table SELECT context a script doesn't provide), so a multi-statement run is read-only.SQLResultsView— a tab strip appears when there is more than one result (each tab shows the leading keyword + row/affected count). A single statement renders exactly as before.Testing
swift build·swift format lint --recursive --parallel --strict Sources Tests— cleanswift run CoreChecks— 1579 (12 new: splitting incl. strings/comments/quoted identifiers, trimming, blank fragments)scripts/e2e/sql-e2e.sh— PASS, asserting the path end-to-end: a two-statement script yields two read-only tabs, tab selection switches the shown result, and a single statement stays editable —tabs=true singleTab=truescripts/e2e/workspace-e2e.sh— PASS