import { Connection } from './Connection'; import { DataConnection } from './DataConnection'; import { DataSet } from './DataSet'; import { DataTable } from './DataTable'; import { Query, QueryBuilder } from './query'; import { SchemaGrammar } from './schema/grammars'; export declare abstract class DataSource { protected debug: boolean; protected readonly: boolean; protected queryBuilder: QueryBuilder; protected schemaGrammar: SchemaGrammar; constructor(queryBuilder?: QueryBuilder, schemaGrammar?: SchemaGrammar); /** The schema grammar used to compile Blueprints into DDL for this engine. */ getSchemaGrammar(): SchemaGrammar; setDebugEnabled(debug: boolean): void; isDebugEnabled(): boolean; setReadonly(readonly: boolean): void; isReadonly(): boolean; table(tableName: string): DataTable; getConnection(): Promise; withConnection(callback: (connection: DataConnection) => Promise): Promise; /** * The connection that holds the transaction currently open for THIS source in * the active async context, or `undefined` when no transaction is in progress. * Query/execute and the entity layer route their statements through it so the * whole unit of work shares one connection. */ getActiveConnection(): DataConnection | undefined; /** * Runs `callback` inside a database transaction on this source. Every entity * and query operation performed within the callback (and the async work it * awaits) runs on the same connection and is committed atomically. If the * callback throws, the transaction is rolled back and the error is re-thrown. * * Transactions join: calling `transaction()` again while one is already open * for this source reuses the in-progress transaction instead of nesting a new * one, so the outermost call controls the commit/rollback. */ transaction(callback: (connection: DataConnection) => Promise): Promise; query(sql: string, bindings?: Array): Promise>; query(query: Query): Promise>; execute(sql: string, bindings?: Array): Promise; execute(query: Query): Promise; protected abstract requestConnection(): Promise; abstract close(): Promise; }