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(databend): save grid edits without an explicit transaction

HARRISON3de078190e8f
diff --git a/apps/desktop/src/lib/__tests__/table/tableEditing.spec.ts b/apps/desktop/src/lib/__tests__/table/tableEditing.spec.ts
index 29bb2a91b7..ecee65d242 100644
--- a/apps/desktop/src/lib/__tests__/table/tableEditing.spec.ts
+++ b/apps/desktop/src/lib/__tests__/table/tableEditing.spec.ts
@@ -189,6 +189,23 @@ describe("tableEditing", () => {
expect(canEditExistingTableRows("clickhouse", undefined, [])).toBe(false);
});
+ it("keeps Databend grid saves out of an explicit transaction", () => {
+ // The Databend JDBC driver reports supportsTransactions() == false, and the
+ // agent rejects an explicit transaction for that reason. A grid save that
+ // opted into executeInTransaction therefore always failed with
+ // "Transactions are not supported by this JDBC driver" (#12003).
+ expect(supportsDataGridTransaction("databend")).toBe(false);
+ // Everything else stays Navicat-style, so inserts and primary-key edits
+ // must keep working through the plain (non-transactional) batch path.
+ expect(isTableDataEditable("databend", ["id"], "TABLE")).toBe(true);
+ expect(canInsertTableRows("databend")).toBe(true);
+ // Navicat-style: update/delete do not require a primary key, and keyless
+ // rows can be addressed by a value predicate.
+ expect(canEditExistingTableRows("databend", undefined, ["id"])).toBe(true);
+ expect(canEditExistingTableRows("databend", undefined, [])).toBe(true);
+ expect(canUseKeylessRowPredicate("databend", [])).toBe(true);
+ });
+
it("uses tbname only when editing TDengine stable rows", () => {
const columns = [column("ts", true), column("seq", true), column("voltage")];
expect(editablePrimaryKeys("tdengine", columns, "STABLE")).toEqual([DBX_TDENGINE_TBNAME_COLUMN, "ts", "seq"]);
diff --git a/apps/desktop/src/lib/database/databaseTableDataCapabilities.ts b/apps/desktop/src/lib/database/databaseTableDataCapabilities.ts
index 22573ac190..628be9c0e8 100644
--- a/apps/desktop/src/lib/database/databaseTableDataCapabilities.ts
+++ b/apps/desktop/src/lib/database/databaseTableDataCapabilities.ts
@@ -209,6 +209,23 @@ const DATABASE_CAPABILITY_OVERRIDES: Partial<Record<DatabaseType, Partial<Databa
transaction: false,
},
},
+ databend: {
+ // Databend's JDBC driver reports supportsTransactions() == false, and the
+ // agent refuses an explicit transaction for exactly that reason
+ // ("Transactions are not supported by this JDBC driver"). Grid saves must
+ // therefore go through executeBatch, not executeInTransaction, or every
+ // edit fails with that error (issue #12003). The capability override must
+ // repeat the Navicat-style defaults, since an override replaces the whole
+ // tableData object rather than merging field by field.
+ tableData: {
+ insert: true,
+ updateRequiresPrimaryKey: false,
+ deleteRequiresPrimaryKey: false,
+ keylessRowPredicate: true,
+ requiresTransactionalTableForExistingRows: false,
+ transaction: false,
+ },
+ },
prestosql: {
tableData: {
insert: true,