Skip to content

feat: soft-split SQL statements at 2+ blank lines when ; is missing - #124

Merged
Blankll merged 10 commits into
masterfrom
feat/soft-split-missing-semicolon
Jul 29, 2026
Merged

feat: soft-split SQL statements at 2+ blank lines when ; is missing#124
Blankll merged 10 commits into
masterfrom
feat/soft-split-missing-semicolon

Conversation

@Blankll

@Blankll Blankll commented Jul 28, 2026

Copy link
Copy Markdown
Member

Changes

1. Soft-split SQL statements at blank lines (当 ; 忘记时自动分割)

Added splitRangesAtBlankLines() that runs after the standard ;-based split. When 2+ consecutive blank lines are followed by a SQL keyword, the range is split at that point.

Split keywords: SELECT, CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, TRUNCATE, GRANT, REVOKE, EXPLAIN, SHOW, DESCRIBE, USE, SET, CALL, EXEC/EXECUTE, BEGIN, COMMIT, ROLLBACK, DECLARE, ANALYZE, VACUUM, PRAGMA, REFRESH, COPY, WITH, MERGE, REPLACE

Safety: Requires 2+ blank lines (not 1) — a single blank line within a multi-line statement won't split it.

CTE protection: When the segment starts with WITH, suppresses soft-split for the next DML keyword (SELECT/INSERT/UPDATE/DELETE) since it's the main query of a CTE, not a new statement.

2. Table view toolbar fixes

  • Fixed refresh icon: i-carbon-refresh does not exist in Carbon icons → changed to i-carbon-renew (same icon as "Reload database list")
  • Fixed nested button bug: Refresh button was wrapping the columns dropdown (<button> inside <button>) — properly separated
  • Icons inside inputs: Search and filter icons moved from outside to inside the input boxes (absolute positioned), saving toolbar space
  • Removed separator: Visual separator between search and filter removed (no longer needed)
  • Consistent style: Refresh button uses variant="ghost" like other toolbar icon buttons

3. Export filename format

Default CSV export filename changed from {tableName}.csv to {connectionName}-{databaseName}-{schema?}-{tableName}-{timestamp}.csv

Verification

  • 455 tests pass (no regressions)
  • 9 new test cases for blank-line splitting including CTE protection
  • Lint clean

When statements are separated by 2+ blank lines followed by a SQL keyword (SELECT, INSERT, CREATE, etc.), automatically split them into separate statements even without a ; delimiter. This recovers gracefully from forgotten semicolons between queries.
@Blankll
Blankll force-pushed the feat/soft-split-missing-semicolon branch 4 times, most recently from eaafac4 to 8dd7e58 Compare July 28, 2026 14:32
When statements are separated by 2+ blank lines followed by a SQL keyword, auto-split into separate statements even without ; delimiter. Also handles comment lines between blank lines, and suppresses false splits for CTE main queries (WITH ... AS (...) \n\n\n SELECT ...).
@Blankll
Blankll force-pushed the feat/soft-split-missing-semicolon branch from 8dd7e58 to e97e6aa Compare July 28, 2026 14:32
@Blankll
Blankll merged commit b0d4b88 into master Jul 29, 2026
3 checks passed
@Blankll
Blankll deleted the feat/soft-split-missing-semicolon branch July 29, 2026 08:12
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