fix(cli): close direct query resources after command execution

Fix #745
This commit is contained in:
Scars
2026-06-05 14:56:55 +08:00
committed by GitHub
parent 249a1ed649
commit 6016b293ce
4 changed files with 92 additions and 3 deletions
+3
View File
@@ -5,6 +5,7 @@ import {
removeConnection as desktopRemoveConnection,
} from "./connections.js";
import {
closeDatabaseResources as desktopCloseDatabaseResources,
describeTable as desktopDescribeTable,
executeQuery as desktopExecuteQuery,
listTables as desktopListTables,
@@ -20,6 +21,7 @@ export interface Backend {
listTables(config: ConnectionConfig, schema?: string): Promise<TableInfo[]>;
describeTable(config: ConnectionConfig, table: string, schema?: string): Promise<ColumnInfo[]>;
executeQuery(config: ConnectionConfig, sql: string, options?: QueryOptions): Promise<QueryResult>;
close?(): Promise<void>;
}
export async function createBackend(env: NodeJS.ProcessEnv = process.env): Promise<Backend> {
@@ -35,5 +37,6 @@ export async function createBackend(env: NodeJS.ProcessEnv = process.env): Promi
listTables: desktopListTables,
describeTable: desktopDescribeTable,
executeQuery: desktopExecuteQuery,
close: desktopCloseDatabaseResources,
};
}