/** * GaussDB / OpenGauss 数据库适配器 * 使用 pg 驱动实现 DbAdapter 接口 * GaussDB 和 OpenGauss 基于 PostgreSQL 开发,兼容 PostgreSQL 协议 * * 性能优化:使用批量查询获取 Schema 信息,避免 N+1 查询问题 * 连接管理:使用连接池 + TCP Keep-Alive + 断线自动重试,确保长连接稳定性 */ import { BaseAdapter, ExecuteScriptOptions, TransactionContext } from './base.js'; import type { QueryResult, SchemaInfo } from '../types/adapter.js'; export declare class GaussDBAdapter extends BaseAdapter { private pool; private config; constructor(config: { host: string; port: number; user?: string; password?: string; database?: string; poolConfig?: { max?: number; min?: number; idleTimeoutMs?: number; }; }); /** * 连接到 GaussDB / OpenGauss 数据库 */ connect(): Promise; /** * 断开数据库连接 */ disconnect(): Promise; /** * 执行 SQL 查询 */ executeQuery(query: string, params?: unknown[]): Promise; /** * 获取数据库结构信息(批量查询优化版本) */ getSchema(): Promise; /** * 获取数据库结构信息的内部实现 */ private _getSchemaImpl; /** * 构建带 schema 前缀的表名键 * 默认 schema (public) 的表直接用表名,保持向后兼容 */ private makeTableKey; /** * 组装 Schema 信息 */ private assembleSchema; /** * 检查是否为写操作 */ isWriteOperation(query: string): boolean; protected getDialect(): import('../utils/adapter-factory.js').DbType; /** * P0-3: Override withTransaction to use a single physical client from the pool. * All statements inside the callback's `tx.executeQuery` are guaranteed to run on * the same connection, so BEGIN/COMMIT/ROLLBACK provide true 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; } //# sourceMappingURL=gaussdb.d.ts.map