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: handle legacy gbase driver_profile and add MCP driver_profile param

t8y24aa907d8b520
diff --git a/apps/desktop/src/lib/jdbcDialect.ts b/apps/desktop/src/lib/jdbcDialect.ts
index ba3245cc9d..a7a9132c3a 100644
--- a/apps/desktop/src/lib/jdbcDialect.ts
+++ b/apps/desktop/src/lib/jdbcDialect.ts
@@ -28,15 +28,15 @@ export function inferJdbcDialect(connection?: JdbcDialectConnection): DatabaseTy
export function effectiveDatabaseTypeForConnection(connection?: JdbcDialectConnection): DatabaseType | undefined {
if (!connection) return undefined;
- if (connection.db_type === "gbase" && connection.driver_profile === "gbase8a") return "mysql";
- if (connection.db_type === "gbase" && connection.driver_profile === "gbase8s") return "informix";
+ if (connection.db_type === "gbase" && isGbase8sProfile(connection.driver_profile)) return "informix";
+ if (connection.db_type === "gbase") return "mysql";
if (connection.db_type !== "jdbc") return connection.db_type;
return inferJdbcDialect(connection) ?? "jdbc";
}
export function tableStructureDatabaseTypeForConnection(connection?: JdbcDialectConnection): DatabaseType | undefined {
if (!connection) return undefined;
- if (connection.db_type === "gbase" && connection.driver_profile === "gbase8a") return "gbase";
+ if (connection.db_type === "gbase" && !isGbase8sProfile(connection.driver_profile)) return "gbase";
return effectiveDatabaseTypeForConnection(connection);
}
@@ -55,14 +55,13 @@ export function connectionUsesSchemaExecutionContext(connection?: Pick<Connectio
}
export function connectionObjectTreeQuerySchema(connection: JdbcDialectConnection | undefined, database: string, schema?: string): string {
- if (connection?.db_type === "gbase" && connection.driver_profile === "gbase8a") return "";
if (connection?.db_type === "jdbc" && inferJdbcDialect(connection) === "databend") return schema || database;
if (connectionUsesDatabaseObjectTreeMode(connection)) return "";
return schema || database;
}
export function connectionObjectTreeNodeSchema(connection: JdbcDialectConnection | undefined, database: string, schema?: string): string | undefined {
- if (connection?.db_type === "gbase" && connection.driver_profile === "gbase8a") return undefined;
+ if (connection?.db_type === "jdbc" && inferJdbcDialect(connection) === "databend") return schema || database;
if (connection?.db_type === "jdbc" && inferJdbcDialect(connection) === "databend") return schema || database;
if (connectionUsesDatabaseObjectTreeMode(connection)) return undefined;
if (schema) return schema;
@@ -76,3 +75,7 @@ export function codeMirrorSqlDialect(dbType: DatabaseType | undefined): "mysql"
if (dbType === "sqlserver") return "sqlserver";
return "mysql";
}
+
+function isGbase8sProfile(driverProfile?: string): boolean {
+ return driverProfile === "gbase8s";
+}
diff --git a/packages/mcp-server/src/index.ts b/packages/mcp-server/src/index.ts
index 282d4dba9e..78aa134c6f 100644
--- a/packages/mcp-server/src/index.ts
+++ b/packages/mcp-server/src/index.ts
@@ -167,8 +167,9 @@ export function createDbxMcpServer(backend: Backend, options: { isWebMode?: bool
password: z.string().default("").describe("Password"),
database: z.string().optional().describe("Default database name"),
ssl: z.boolean().default(false).describe("Enable SSL"),
+ driver_profile: z.string().optional().describe("Driver profile (e.g. 'gbase8a', 'gbase8s')"),
},
- async ({ name, db_type, host, port, username, password, database, ssl }) => {
+ async ({ name, db_type, host, port, username, password, database, ssl, driver_profile }) => {
const existing = await backend.findConnection(name);
if (existing) return text(`Connection "${name}" already exists.`);
const DEFAULT_PORTS: Record<string, number> = {
@@ -189,6 +190,7 @@ export function createDbxMcpServer(backend: Backend, options: { isWebMode?: bool
password,
database,
ssl,
+ driver_profile,
ssh_enabled: false,
} as Omit<ConnectionConfig, "id">);
await notifyReload();
diff --git a/src-tauri/src/commands/transfer.rs b/src-tauri/src/commands/transfer.rs
index 032f12f754..cb663b9d64 100644
--- a/src-tauri/src/commands/transfer.rs
+++ b/src-tauri/src/commands/transfer.rs
@@ -268,6 +268,7 @@ pub async fn cancel_transfer(transfer_id: String) -> Result<(), String> {
/// Sort table names by foreign key dependency.
/// `parents_first: true` → parent tables first (insert/export order).
/// `parents_first: false` → child tables first (drop order).
+#[allow(dead_code)]
#[tauri::command]
pub async fn sort_tables_by_fk_dependency(
state: tauri::State<'_, std::sync::Arc<AppState>>,