Skip to content

Support Oracle-style SQL block splitting#325

Open
haos666 wants to merge 1 commit into
TabularisDB:mainfrom
haos666:haos666/oracle-dm-sql-splitter
Open

Support Oracle-style SQL block splitting#325
haos666 wants to merge 1 commit into
TabularisDB:mainfrom
haos666:haos666/oracle-dm-sql-splitter

Conversation

@haos666

@haos666 haos666 commented Jun 16, 2026

Copy link
Copy Markdown

Summary

Follow-up to #316 for the Oracle/DM splitter work discussed with @ymadd.

This keeps the behavior additive and dialect-gated behind the existing oracle SQL dialect:

  • enable line-leading / as an Oracle-style statement terminator
  • fold PL/SQL-style source units until the next slash-terminated segment instead of splitting on internal semicolons
  • support Oracle q-quoting / nq-quoting so ; and / inside quoted literals do not split statements
  • include DM-specific block openers: CREATE CLASS, CREATE CLASS BODY, and CREATE JAVA CLASS
  • keep other dialect presets structurally unchanged by leaving the new flags disabled outside oracle

This PR does not include trigger RPC forwarding (#321), batch forwarding, SQL import/export, or BLOB hooks.

Validation

Automated checks:

  • pnpm exec vitest run tests/utils/sqlSplitter
  • pnpm exec vitest run tests/utils/sqlSplitter/dialects.test.ts tests/utils/sqlSplitter/splitter.test.ts tests/utils/sqlSplitter/tokenizer.test.ts
  • pnpm exec vitest run (130 files / 2588 tests)
  • pnpm run typecheck
  • pnpm run lint
  • pnpm run build
  • pnpm run test:rust (671 Rust tests)
  • git diff --check

Local DM/UI smoke on the DM external plugin:

  • CREATE OR REPLACE TRIGGER ... BEGIN ... END; / plus a following SELECT is detected as 2 statements, not split at internal semicolons.
  • q-quoted text containing both ; and a line-leading / stays inside one statement.
  • simple slash-separated SQL statements split as expected under the oracle dialect.

@kilo-code-bot

kilo-code-bot Bot commented Jun 16, 2026

Copy link
Copy Markdown

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (5 files)
  • src/utils/sqlSplitter/index.ts — Adds Oracle dialect flags (slashTerminator, plsqlBlocks, qQuoting) to DialectOptions
  • src/utils/sqlSplitter/splitter.ts — Implements PL/SQL block folding until slash terminators; robust opener detection for CREATE, BEGIN, DECLARE, WITH FUNCTION/PROCEDURE
  • src/utils/sqlSplitter/tokenizer.ts — Adds slashDelimiter and Q-quoted string scanning (q'…', nq'…')
  • tests/utils/sqlSplitter/splitter.test.ts — Comprehensive tests covering block folding, q-quoting, labeled blocks, inline functions, EOF handling, and SQL*Plus tradeoffs
  • tests/utils/sqlSplitter/tokenizer.test.ts — Tokenizer tests for slash delimiter line-leading logic and q-quoting boundaries

Reviewed by kimi-k2.6-20260420 · 259,687 tokens

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