From 897e6998fd790e305498b5e2e761680b8cf2fa5b Mon Sep 17 00:00:00 2001 From: Quinlevi <745208799@qq.com> Date: Mon, 8 Jun 2026 02:07:00 +0800 Subject: [PATCH] feat(dameng): full DM8 database support Adds Dameng DM8 explain/autotrace support and user-management SQL support, with backend autotrace safety checks and escaped CREATE USER SQL. --- .cargo/config.toml | 1 + apps/desktop/src/App.vue | 3 + .../explain/ExplainPlanNodeTree.vue | 86 +++-- .../components/explain/ExplainPlanViewer.vue | 37 +- .../src/components/layout/EditorToolbar.vue | 18 + .../src/composables/useSqlExecution.ts | 4 +- apps/desktop/src/lib/api.ts | 2 + .../desktop/src/lib/databaseCapabilitySets.ts | 1 - apps/desktop/src/lib/explainPlan.ts | 362 +++++++++++++++++- apps/desktop/src/lib/http.ts | 19 + apps/desktop/src/lib/tauri.ts | 20 + apps/desktop/src/stores/queryStore.ts | 61 ++- crates/dbx-core/assets/agent-protocol-v1.json | 1 + crates/dbx-core/src/db/agent_driver.rs | 9 +- crates/dbx-core/src/db_admin_sql.rs | 17 + crates/dbx-core/src/query_execution_sql.rs | 156 +++++++- crates/dbx-web/src/main.rs | 2 + crates/dbx-web/src/routes/query.rs | 68 ++++ .../main/java/app/dbx/jdbc/DbxJdbcPlugin.java | 237 ++++++++++++ pnpm-lock.yaml | 37 +- src-tauri/src/commands/query.rs | 66 ++++ src-tauri/src/lib.rs | 2 + 22 files changed, 1154 insertions(+), 55 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index 03feda3c7..398b7f9d6 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,4 +1,5 @@ [env] +# Enable SQLite's built-in math functions for rusqlite's bundled libsqlite3. LIBSQLITE3_FLAGS = "SQLITE_ENABLE_MATH_FUNCTIONS" [target.x86_64-pc-windows-msvc] diff --git a/apps/desktop/src/App.vue b/apps/desktop/src/App.vue index c77a2b64d..c4950f0f4 100644 --- a/apps/desktop/src/App.vue +++ b/apps/desktop/src/App.vue @@ -204,6 +204,7 @@ const { cancelActiveExecution, tryExplain, onDangerConfirm, + explainMode, } = useSqlExecution({ activeTab, activeConnection, @@ -1073,6 +1074,8 @@ onUnmounted(() => { :active-tab="activeTab" :active-connection="activeConnection" :executable-sql="executableSql" + :explain-mode="explainMode" + @update:explain-mode="(m: 'explain' | 'autotrace') => (explainMode = m)" @execute="tryExecute()" @cancel="cancelActiveExecution()" @explain="tryExplain()" diff --git a/apps/desktop/src/components/explain/ExplainPlanNodeTree.vue b/apps/desktop/src/components/explain/ExplainPlanNodeTree.vue index 6e092912c..bab313852 100644 --- a/apps/desktop/src/components/explain/ExplainPlanNodeTree.vue +++ b/apps/desktop/src/components/explain/ExplainPlanNodeTree.vue @@ -1,43 +1,71 @@ diff --git a/apps/desktop/src/components/layout/EditorToolbar.vue b/apps/desktop/src/components/layout/EditorToolbar.vue index d9b960cfb..9102f6d25 100644 --- a/apps/desktop/src/components/layout/EditorToolbar.vue +++ b/apps/desktop/src/components/layout/EditorToolbar.vue @@ -33,12 +33,14 @@ const props = defineProps<{ activeTab: QueryTab; activeConnection?: ConnectionConfig; executableSql: string; + explainMode?: string; }>(); const emit = defineEmits<{ execute: []; cancel: []; explain: []; + "update:explainMode": [mode: "explain" | "autotrace"]; formatSql: []; saveSql: []; openSql: []; @@ -165,6 +167,22 @@ function connectionById(connectionId: string): ConnectionConfig | undefined { activeTab.isExplaining ? t("toolbar.stopExplain") : t("toolbar.explainPlan") }} + +