/** * Oracle 数据库适配器 * 使用 oracledb 驱动实现 DbAdapter 接口 * * 性能优化:使用批量查询获取 Schema 信息,避免 N+1 查询问题 * 连接管理:使用连接池 + 连接健康检测 + 断线自动重试,确保长连接稳定性 */ import { BaseAdapter, ExecuteScriptOptions, ExecuteBatchOptions, TransactionContext, BatchResult } from './base.js'; import type { QueryResult, SchemaInfo, TableInfo } from '../types/adapter.js'; export declare class OracleAdapter extends BaseAdapter { private pool; private config; private static thickModeInitialized; constructor(config: { host: string; port: number; user?: string; password?: string; database?: string; serviceName?: string; sid?: string; connectString?: string; oracleClientPath?: string; poolConfig?: { max?: number; min?: number; idleTimeoutMs?: number; }; }); private withRetry; private withConnection; /** * 构建 Oracle 连接字符串 */ private buildConnectionString; /** * 连接到 Oracle 数据库 */ connect(): Promise; /** * 断开数据库连接 */ disconnect(): Promise; /** * 执行 SQL 查询 */ executeQuery(query: string, params?: unknown[]): Promise; /** * v4.0.3: Fast-path single-table metadata query. Avoids scanning the * entire schema (8 dict queries on getSchema) when caller only wants * one table. Issues 5 targeted queries against data dictionary filtered * by TABLE_NAME / OWNER. */ getTableInfo(tableName: string): Promise; /** * 获取数据库结构信息(批量查询优化版本) */ getSchema(): Promise; private _getSchemaImpl; private makeTableKey; /** * 组装 Schema 信息 */ private assembleSchema; /** * 格式化 Oracle 数据类型 */ private formatOracleType; /** * P0-3: Override withTransaction to pin all statements to a single physical connection. * Without this, BEGIN/COMMIT and individual statements could end up on different * pooled connections, breaking "all-or-nothing" semantics. */ withTransaction(fn: (tx: TransactionContext) => Promise): Promise; /** * P0-3: Override executeScript to use withTransaction. * All statements run on a single connection so BEGIN/COMMIT are atomic. * Non-transactional mode falls back to the BaseAdapter default. */ executeScript(query: string, options?: ExecuteScriptOptions): Promise; /** * v4.0.2 Bug #10 fix: Override executeBatch. * BaseAdapter.executeBatch defaults to wrapping in BEGIN/COMMIT/ROLLBACK * (src/adapters/base.ts:215). oracledb rejects bare BEGIN with ORA-06550 * PLS-00103 (it's a PL/SQL keyword requiring a block). Same workaround as * Bug #9: route through withTransaction so autoCommit:false + the existing * tx.executeQuery handle atomicity without sending BEGIN. * * DDL inside a batch is not supported (DDL implicit-commits in Oracle). * DML only. */ executeBatch(sql: string, paramsList: unknown[][], options?: ExecuteBatchOptions): Promise; /** * 检查是否为写操作 */ isWriteOperation(query: string): boolean; protected getDialect(): import('../utils/adapter-factory.js').DbType; } //# sourceMappingURL=oracle.d.ts.map