25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。
TypeScript aicliclickhousedatabasedatabase-clientdatabase-managementdockerguimcpmongodbmysqlpostgresqlredisrustsql-serversqlitetaurivue
fix(editor): complete Dameng columns without selected schema
t8y222055e081ff6
diff --git a/apps/desktop/src/stores/__tests__/connectionStore.completion.spec.ts b/apps/desktop/src/stores/__tests__/connectionStore.completion.spec.tsindex 1392f8a3c4..5092a2c7a5 100644--- a/apps/desktop/src/stores/__tests__/connectionStore.completion.spec.ts+++ b/apps/desktop/src/stores/__tests__/connectionStore.completion.spec.ts@@ -72,6 +72,18 @@ function sqlServerConnection(): ConnectionConfig {} as ConnectionConfig;}+function damengConnection(): ConnectionConfig {+ return {+ ...postgresConnection(),+ id: "dameng-1",+ name: "Dameng",+ db_type: "dameng",+ port: 5236,+ username: "dbx_test",+ database: "",+ } as ConnectionConfig;+}+function dorisConnection(): ConnectionConfig {return {...postgresConnection(),@@ -295,6 +307,32 @@ describe("connectionStore completion assistant", () => {expect(store.lookupLocalCompletionColumns("oracle-1", "ORCL", "ORDERS")).toEqual([]);});+ it("uses the Dameng login schema for unqualified column completion", async () => {+ const completionAssistantSearch = vi.fn().mockRejectedValue(new Error("assistant unavailable"));+ const getColumns = vi.fn().mockResolvedValue([{ name: "ID", data_type: "BIGINT", is_nullable: false, column_default: null, is_primary_key: true, extra: null, comment: null }]);++ vi.doMock("@/lib/backend/tauriRuntime", () => ({ isTauriRuntime: () => false }));+ vi.doMock("@/lib/backend/api", () => ({+ checkConnectionHealth: vi.fn().mockResolvedValue(undefined),+ completionAssistantSearch,+ getColumns,+ }));++ const { useConnectionStore } = await import("@/stores/connectionStore");+ const store = useConnectionStore();+ store.connections = [damengConnection()];+ store.connectedIds.add("dameng-1");++ const first = await store.listCompletionColumns("dameng-1", "", "tb_user");+ const cached = await store.listCompletionColumns("dameng-1", "", "tb_user");++ expect(completionAssistantSearch).toHaveBeenCalledTimes(1);+ expect(getColumns).toHaveBeenCalledTimes(1);+ expect(getColumns).toHaveBeenCalledWith("dameng-1", "", "dbx_test", "tb_user", undefined, undefined);+ expect(first).toEqual([expect.objectContaining({ name: "ID", table: "tb_user", schema: "dbx_test" })]);+ expect(cached).toEqual(first);+ });+it("rejects assistant columns returned for a different MySQL parent table", async () => {const completionAssistantSearch = vi.fn().mockResolvedValue({candidates: [diff --git a/apps/desktop/src/stores/connectionStore.ts b/apps/desktop/src/stores/connectionStore.tsindex 70f099ad85..81f0913d8b 100644--- a/apps/desktop/src/stores/connectionStore.ts+++ b/apps/desktop/src/stores/connectionStore.ts@@ -6077,7 +6077,7 @@ export const useConnectionStore = defineStore("connection", () => {const oracleIdentifier = config?.db_type === "oracle";const uppercaseUnquotedIdentifier = oracleIdentifier || config?.db_type === "saphana";const completionTable = uppercaseUnquotedIdentifier && context?.tableQuoted === false ? table.toUpperCase() : table;- const rawCompletionSchema = schema?.trim() || undefined;+ const rawCompletionSchema = schema?.trim() || (config?.db_type === "dameng" ? config.username?.trim() || undefined : undefined);const completionSchema = uppercaseUnquotedIdentifier && rawCompletionSchema && context?.schemaQuoted === false ? rawCompletionSchema.toUpperCase() : rawCompletionSchema;const usesOracleCurrentSchema = config?.db_type === "oracle" && !completionSchema;if (isSchemaAwareDatabase(connectionId) && !connectionUsesDatabaseObjectTreeMode(config) && !completionSchema && !usesOracleCurrentSchema) {