Skip to content

feat(sql): per-statement result tabs for multi-statement scripts - #53

Merged
bbjansen merged 1 commit into
mainfrom
feature/sql-result-tabs
Aug 16, 2026
Merged

feat(sql): per-statement result tabs for multi-statement scripts#53
bbjansen merged 1 commit into
mainfrom
feature/sql-result-tabs

Conversation

@bbjansen

Copy link
Copy Markdown
Owner

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 ;, 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 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 — clean
  • swift run CoreChecks1579 (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=true
  • scripts/e2e/workspace-e2e.sh — PASS

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).
@bbjansen
bbjansen merged commit bb55de6 into main Aug 16, 2026
5 checks passed
@bbjansen
bbjansen deleted the feature/sql-result-tabs branch August 16, 2026 09:36
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