Skip to content

feat(data-grid): add SQL INSERT as a copy format option#168

Merged
debba merged 1 commit intoTabularisDB:mainfrom
thomaswasle:feature/sql-insert-copy
May 7, 2026
Merged

feat(data-grid): add SQL INSERT as a copy format option#168
debba merged 1 commit intoTabularisDB:mainfrom
thomaswasle:feature/sql-insert-copy

Conversation

@thomaswasle
Copy link
Copy Markdown
Contributor

Adds SQL INSERT as a third option in the copy format selector, alongside the existing CSV and JSON options. Once selected,
Ctrl+C and right-click → "Copy selected row(s)" both produce ready-to-paste INSERT statements.

Example output:
INSERT INTO users (id, name, email) VALUES (1, 'Alice', 'alice@example.com');
INSERT INTO users (id, name, email) VALUES (2, NULL, 'bob@example.com');

Value quoting: null → NULL, booleans → TRUE/FALSE, numbers unquoted, strings/objects single-quoted with '' escaping.

Changes

  • CopyFormat type (SettingsContext.ts) extended to "csv" | "json" | "sql-insert" — all downstream prop types updated
    (DataGrid, MultiResultPanel, StackedResultItem, ResultEntryContent, Editor)
  • clipboard.ts — adds rowsToSqlInsert (and private helper rowToSqlInsert, sqlValue)
  • DataGrid.formatRows — routes "sql-insert" through rowsToSqlInsert; falls back to "table" as the identifier when no
    tableName prop is present (plain query results)
  • Settings panel (GeneralTab.tsx) and editor toolbar (Editor.tsx) both expose the new option

@debba debba merged commit 459b07b into TabularisDB:main May 7, 2026
1 check passed
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.

2 participants