Skip to content

feat: add Oracle driver (thin oracledb) and :n placeholders - #106

Merged
ryanrasti merged 1 commit into
mainfrom
oracle-driver
Aug 15, 2026
Merged

feat: add Oracle driver (thin oracledb) and :n placeholders#106
ryanrasti merged 1 commit into
mainfrom
oracle-driver

Conversation

@ryanrasti

Copy link
Copy Markdown
Owner

First slice of Oracle support: DialectName grows "oracle", compile emits :n binds, and OracleDriver talks thin-mode node-oracledb with fetchAsString so rows stay raw text. Connection construction no longer treats a non-pg dialect as sqlite — StatementExecutor runs statements and live() throws.

Live FROM DUAL tests skip unless ORACLE_URL is set. bin/startora boots gvenzl/oracle-free:23-slim-faststart for local work.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an initial Oracle dialect/driver integration so typegres can compile Oracle-style bind parameters and run statement-only connections without accidentally enabling sqlite live behavior.

Changes:

  • Extend DialectName with "oracle" and emit Oracle :n bind placeholders during SQL compilation.
  • Add a thin-mode node-oracledb-backed OracleDriver that normalizes all result values to string | null, plus smoke tests gated by ORACLE_URL.
  • Ensure non-live dialects use a statement-only executor and add local dev scripts (bin/startora, bin/stopora) for booting an Oracle container.

Reviewed changes

Copilot reviewed 12 out of 16 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
vitest.config.ts Adds a Vitest path alias for the Oracle driver entrypoint.
tsdown.config.ts Ensures the Oracle driver is built and oracledb stays external (never bundled).
tsconfig.json Adds TS path mapping for typegres/drivers/oracle.
src/oracle.ts Adds requireOracleUrl() helper for Oracle smoke tests (and future tooling).
src/live/canonical.ts Makes canonicalText() explicitly reject the new oracle dialect (live-only).
src/index.ts Updates usage comment to include the new OracleDriver import.
src/executor.ts Introduces StatementExecutor for dialects without live support.
src/drivers/oracle.ts Implements OracleDriver using thin node-oracledb, with string/hex normalization.
src/drivers/oracle.test.ts Adds always-on constructor/compile tests + ORACLE_URL-gated integration smoke tests.
src/database.ts Routes unknown/non-live dialects to StatementExecutor and improves live()/transaction() errors.
src/builder/sql.ts Adds "oracle" dialect and :n parameter placeholder compilation.
src/builder/sql.test.ts Adds unit test coverage for Oracle placeholder compilation.
package.json Exposes ./drivers/oracle and adds optional peer dependency metadata for oracledb.
package-lock.json Locks oracledb and @types/oracledb additions.
bin/stopora Adds helper script to stop the local Oracle container.
bin/startora Adds helper script to start/reuse an Oracle container and print ORACLE_URL.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/database.ts
Comment on lines 345 to 347
} else {
// The constructor rejects async sqlite drivers at attach — this
// branch exists so TS narrows `driver` above.
throw new Error("unreachable: sqlite Connection without a SyncDriver");
txExecutor = new StatementExecutor(this.database, execute, true);
}
Comment thread src/drivers/oracle.ts Outdated
Comment on lines +34 to +38
const toHex = (bytes: Uint8Array): string => {
let s = "\\x";
for (const b of bytes) { s += b.toString(16).padStart(2, "0"); }
return s;
};
First slice of Oracle support: DialectName grows "oracle", compile emits :n binds, and OracleDriver talks thin-mode node-oracledb with fetchAsString so rows stay raw text. Connection construction no longer treats a non-pg dialect as sqlite — StatementExecutor runs statements and live() throws.

Live FROM DUAL tests skip unless ORACLE_URL is set. bin/startora boots gvenzl/oracle-free:23-slim-faststart for local work.
@ryanrasti
ryanrasti merged commit 92750fa into main Aug 15, 2026
3 checks 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