1 | import { Histogram, Counter, labelValues } from 'prom-client';
|
2 | import { Transaction } from '../transaction/TransactionManager';
|
3 | import { ConnectionPool } from './ConnectionPool';
|
4 | export declare abstract class DBTransaction<C> {
|
5 | protected timer: (labels?: labelValues) => void;
|
6 | protected rolledBackTransactionsCounter: Counter.Internal;
|
7 | protected transactionExecutionDurationsHistogram: Histogram.Internal;
|
8 | protected clientName: string;
|
9 | protected readonly: boolean;
|
10 | protected connectionPool: ConnectionPool<C>;
|
11 | protected connection: C;
|
12 | protected transaction: Transaction;
|
13 | protected rolledBack: boolean;
|
14 | |
15 |
|
16 |
|
17 |
|
18 | constructor(clientName: string, readonly: boolean, connectionPool: ConnectionPool<C>);
|
19 | /**
|
20 | * Executes a query in the current connection
|
21 | * @param sql The SQL to execute
|
22 | * @param bindsArr the list of parameters to pass to the query, or an empty array if there are no parameters
|
23 | */
|
24 | protected abstract runQueryInConnection(sql: string, bindsArr: Array<any>): Promise<any>;
|
25 | runQueryWithoutTransaction(sql: string, bindsArr?: Array<any>): Promise<any>;
|
26 | getTransaction(): Transaction;
|
27 | begin(): Promise<void>;
|
28 | private obtainConnection();
|
29 | query(sql: string, ...bindArrs: any[]): Promise<any>;
|
30 | queryAssoc(sql: string, bindObj: object): Promise<any>;
|
31 | markError(error: any): void;
|
32 | sanitizeAndRunQueryInConnection(sql: string, bindsArr?: Array<any>): Promise<any>;
|
33 | runQueryAssocPrivate(sql: string, bindsObj: object): Promise<any>;
|
34 | doTransactionBegin(): Promise<void>;
|
35 | getTransactionBeginSQL(): string;
|
36 | doTransactionCommit(): Promise<void>;
|
37 | getTransactionCommitSQL(): string;
|
38 | doTransactionRollback(): Promise<void>;
|
39 | getTransactionRollbackSQL(): string;
|
40 | releaseConnection(): Promise<void>;
|
41 | end(): Promise<void>;
|
42 | isRolledBack(): boolean;
|
43 | isReadonly(): boolean;
|
44 | }
|