Files
evento/node_modules/@mikro-orm/sql/dialects/oracledb/OracleDialect.d.ts
2026-03-18 14:55:56 -03:00

108 lines
3.3 KiB
TypeScript

import {
type AliasNode,
CompiledQuery,
type DatabaseConnection,
type DatabaseIntrospector,
DefaultQueryCompiler,
type Dialect,
DialectAdapterBase,
type Driver,
type Kysely,
type QueryCompiler,
type QueryResult,
type TransactionSettings,
} from 'kysely';
/**
* Subset of oracledb's Pool interface used by the dialect.
* We define our own interface to avoid importing the `oracledb` package directly.
*/
export interface OraclePool {
getConnection(): Promise<OraclePoolConnection>;
close(drainTime?: number): Promise<void>;
}
/**
* Subset of oracledb's Connection interface used by the dialect.
*/
export interface OraclePoolConnection {
execute<R>(
sql: string,
params: unknown[],
options?: Record<string, unknown>,
): Promise<{
rows?: R[];
rowsAffected?: number;
resultSet?: OracleResultSet<R>;
outBinds?: unknown;
}>;
commit(): Promise<void>;
rollback(): Promise<void>;
close(): Promise<void>;
}
interface OracleResultSet<R> {
getRow(): Promise<R>;
close(): Promise<void>;
}
declare class OracleQueryCompiler extends DefaultQueryCompiler {
protected getLeftIdentifierWrapper(): string;
protected getRightIdentifierWrapper(): string;
protected visitAlias(node: AliasNode): void;
}
declare class OracleAdapter extends DialectAdapterBase {
#private;
get supportsReturning(): boolean;
get supportsTransactionalDdl(): boolean;
acquireMigrationLock(_: Kysely<any>): Promise<void>;
releaseMigrationLock(_: Kysely<any>): Promise<void>;
}
declare class OracleConnection implements DatabaseConnection {
#private;
readonly id: number;
constructor(connection: OraclePoolConnection, executeOptions?: Record<string, unknown>);
executeQuery<R>(compiledQuery: CompiledQuery): Promise<QueryResult<R>>;
formatQuery(query: CompiledQuery): {
sql: string;
bindParams: unknown[];
};
streamQuery<R>(compiledQuery: CompiledQuery, _chunkSize?: number): AsyncIterableIterator<QueryResult<R>>;
get connection(): OraclePoolConnection;
}
declare class OracleDriver implements Driver {
#private;
constructor(config: OracleDialectConfig);
init(): Promise<void>;
acquireConnection(): Promise<OracleConnection>;
savepoint(
connection: OracleConnection,
savepointName: string,
compileQuery: QueryCompiler['compileQuery'],
): Promise<void>;
rollbackToSavepoint(
connection: OracleConnection,
savepointName: string,
compileQuery: QueryCompiler['compileQuery'],
): Promise<void>;
releaseSavepoint(
connection: OracleConnection,
savepointName: string,
compileQuery: QueryCompiler['compileQuery'],
): Promise<void>;
beginTransaction(connection: OracleConnection, settings: TransactionSettings): Promise<void>;
commitTransaction(connection: OracleConnection): Promise<void>;
rollbackTransaction(connection: OracleConnection): Promise<void>;
releaseConnection(connection: OracleConnection): Promise<void>;
destroy(): Promise<void>;
}
export interface OracleDialectConfig {
pool: OraclePool;
executeOptions?: Record<string, unknown>;
}
export declare class OracleDialect implements Dialect {
#private;
constructor(config: OracleDialectConfig);
createDriver(): OracleDriver;
createAdapter(): OracleAdapter;
createIntrospector(db: Kysely<any>): DatabaseIntrospector;
createQueryCompiler(): OracleQueryCompiler;
}
export {};