Skip to content

Add OracleDialect to the independent SQL dialects module#151

Draft
Copilot wants to merge 4 commits intomasterfrom
copilot/define-independent-sql-dialects
Draft

Add OracleDialect to the independent SQL dialects module#151
Copilot wants to merge 4 commits intomasterfrom
copilot/define-independent-sql-dialects

Conversation

Copy link

Copilot AI commented Mar 19, 2026

The src/dialects/ module was missing an Oracle formatter alongside the existing SQLite, MySQL, MSSQL, and PostgreSQL ones.

Changes

  • src/dialects/oracle.js — new OracleDialect extends SqlFormatter implementing Oracle-specific SQL:

    • Pagination via OFFSET n ROWS FETCH NEXT n ROWS ONLY (Oracle 12c+)
    • "double-quoted" identifier escaping
    • Date parts with EXTRACT(... FROM ...), date truncation with TRUNC()
    • Null coalescing with NVL(), string cast with TO_CHAR()
    • Numeric casts as NUMBER(p,s), boolean as NUMBER(1,0)
    • REGEXP_LIKE() for regex, LOWER(RAWTOHEX(SYS_GUID())) for UUID generation
    • $toGuid via DBMS_CRYPTO.HASH (MD5-based, deterministic)
    • $getDate mapped to TRUNC(SYSDATE) / SYSDATE / SYSTIMESTAMP
  • src/dialects/index.js — exports OracleDialect

  • spec/SqlDialects.spec.js — 31 Oracle-specific tests; OracleDialect added to shared cross-dialect assertions

Usage

import { OracleDialect } from '@themost/query';

const formatter = new OracleDialect();

formatter.formatLimitSelect(query);
// SELECT "ProductData"."id" AS "id" FROM "ProductData" OFFSET 20 ROWS FETCH NEXT 10 ROWS ONLY

formatter.$year({ $name: 'createdAt' });   // EXTRACT(YEAR FROM "createdAt")
formatter.$ifNull({ $name: 'desc' }, ''); // NVL("desc", '')
formatter.$toString({ $name: 'price' });  // TO_CHAR("price")

💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.

Copilot AI and others added 2 commits March 19, 2026 12:51
Co-authored-by: kbarbounakis <9191768+kbarbounakis@users.noreply.github.com>
…PostgreSQL)

Co-authored-by: kbarbounakis <9191768+kbarbounakis@users.noreply.github.com>
Copilot AI changed the title [WIP] Add independent SQL dialects to module Define independent SQL dialects inside the query module Mar 19, 2026
Copilot AI requested a review from kbarbounakis March 19, 2026 13:01
Co-authored-by: kbarbounakis <9191768+kbarbounakis@users.noreply.github.com>
Copilot AI changed the title Define independent SQL dialects inside the query module Add OracleDialect to the independent SQL dialects module Mar 19, 2026
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