From e4c56e6165b7943634062d3ac778cd1cf24f2db0 Mon Sep 17 00:00:00 2001 From: zipg Date: Thu, 16 Jul 2026 16:32:52 +0800 Subject: [PATCH] feat(sqlserver): add execution plan support --- .../components/explain/ExplainPlanViewer.vue | 3 +- .../query/sqlserverExplainPlan.spec.ts | 92 +++++++++++ apps/desktop/src/lib/backend/http.ts | 2 + apps/desktop/src/lib/backend/tauri.ts | 2 + apps/desktop/src/lib/diagram/explainPlan.ts | 142 ++++++++++++++++- .../queryStore.sqlserverExplain.spec.ts | 146 ++++++++++++++++++ apps/desktop/src/stores/queryStore.ts | 82 +++++++++- apps/desktop/src/types/database.ts | 2 +- .../assets/database-drivers.manifest.json | 2 +- crates/dbx-core/src/db/sqlserver.rs | 47 +++++- crates/dbx-core/src/query.rs | 56 +++++-- crates/dbx-core/src/query_execution_sql.rs | 66 ++++++++ crates/dbx-web/src/routes/query.rs | 3 + package.json | 1 + pnpm-lock.yaml | 9 ++ src-tauri/src/commands/query.rs | 4 + 16 files changed, 636 insertions(+), 23 deletions(-) create mode 100644 apps/desktop/src/lib/__tests__/query/sqlserverExplainPlan.spec.ts create mode 100644 apps/desktop/src/stores/__tests__/queryStore.sqlserverExplain.spec.ts diff --git a/apps/desktop/src/components/explain/ExplainPlanViewer.vue b/apps/desktop/src/components/explain/ExplainPlanViewer.vue index 8a0caf38e..fbde5be39 100644 --- a/apps/desktop/src/components/explain/ExplainPlanViewer.vue +++ b/apps/desktop/src/components/explain/ExplainPlanViewer.vue @@ -45,6 +45,7 @@ const rawContent = computed(() => { }); const isRawString = computed(() => typeof props.plan?.raw === "string"); +const rawFormatLabel = computed(() => (props.plan?.databaseType === "sqlserver" ? "XML" : isRawString.value ? "TEXT" : "JSON")); const nodeCount = computed(() => (props.plan ? flattenExplainPlanNodes(props.plan.nodes).length : 0)); function tableCellText(value: unknown): string { @@ -77,7 +78,7 @@ function tableCellText(value: unknown): string {