Skip to content

armgit / dbx

Public Imported from GitHub
0

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。

fix(tdengine): keep database context when viewing tables

zipg72bfd74e5e20
diff --git a/apps/desktop/src/lib/__tests__/database/jdbcDialect.spec.ts b/apps/desktop/src/lib/__tests__/database/jdbcDialect.spec.ts
index b7f5f3210b..3359eeeeb0 100644
--- a/apps/desktop/src/lib/__tests__/database/jdbcDialect.spec.ts
+++ b/apps/desktop/src/lib/__tests__/database/jdbcDialect.spec.ts
@@ -92,6 +92,19 @@ describe("jdbc dialect inference", () => {
).toBe("sqlserver");
});
+ it("detects TDengine JDBC connections and keeps the selected database in the object tree", () => {
+ const connection = {
+ db_type: "jdbc" as const,
+ connection_string: "jdbc:TAOS-RS://tdengine.example:6041/",
+ jdbc_driver_class: "com.taosdata.jdbc.rs.RestfulDriver",
+ };
+
+ expect(inferJdbcDialect(connection)).toBe("tdengine");
+ expect(effectiveDatabaseTypeForConnection(connection)).toBe("tdengine");
+ expect(connectionUsesDatabaseObjectTreeMode(connection)).toBe(false);
+ expect(connectionObjectTreeQuerySchema(connection, "dbx_test")).toBe("dbx_test");
+ });
+
it("keeps Phoenix as generic JDBC while preserving its schema tree", () => {
const connection = { db_type: "jdbc" as const, driver_profile: "phoenix" };
diff --git a/apps/desktop/src/lib/database/jdbcDialect.ts b/apps/desktop/src/lib/database/jdbcDialect.ts
index 4205a17ed8..a2fe509a6f 100644
--- a/apps/desktop/src/lib/database/jdbcDialect.ts
+++ b/apps/desktop/src/lib/database/jdbcDialect.ts
@@ -38,6 +38,7 @@ const JDBC_DIALECT_MATCHERS: Array<{ type: DatabaseType; patterns: RegExp[] }> =
{ type: "sqlserver", patterns: [/jdbc:sqlserver:/i, /sqlserver/i, /mssql/i] },
{ type: "oracle", patterns: [/jdbc:oracle:/i, /oracle/i] },
{ type: "clickhouse", patterns: [/jdbc:clickhouse:/i, /clickhouse/i] },
+ { type: "tdengine", patterns: [/jdbc:taos(?:-rs|-ws)?:/i, /taosdata/i, /tdengine/i] },
{ type: "h2", patterns: [/jdbc:h2:/i, /\bh2\b/i] },
{ type: "sqlite", patterns: [/jdbc:sqlite:/i, /sqlite/i] },
{ type: "db2", patterns: [/jdbc:db2:/i, /\bdb2\b/i] },
@@ -214,6 +215,8 @@ export function connectionUsesDatabaseObjectTreeMode(connection?: JdbcDialectCon
const dialect = inferJdbcDialect(connection);
if (!dialect) return true;
if (dialect === "hive" || dialect === "trino") return false;
+ // TDengine exposes databases as the top-level namespace, without schemas.
+ if (dialect === "tdengine") return false;
if (dialect === "databend") return true;
return !usesTreeSchemaMode(dialect);
}