…buildDatasourceBaseInfo)
- convertDBType: add explicit case "DB2" -> "DB2" (D-01, compat-RISK-2 align with ODC ConnectType.DB2 literal)
- buildDatasourceBaseInfo: add DB2 branch passing AdditionalParams.database_name -> baseInfo.DefaultSchema, fail-fast with error containing "database_name" when missing (D-02, compat-RISK-5 decision A)
- Test_convertDBType: add "DB2": {input: "DB2", expected: "DB2"} (D-03)
- Test_buildDatasourceBaseInfo_DB2: new map-case test with 4 groups - DB2 happy path / DB2 missing database_name negative / MySQL regression / Oracle regression (D-04)
- Test_SupportDBType: add "DB2 unsupported" reverse-locking case per compat-RISK-1 decision A (D-S1)
- SupportDBType / sql_workbench_service_ee.go intentionally not changed per design §4.2 + compat-RISK-1 decision A
Refs: actiontech/dms-ee#839
User description
Summary
Wire DB2 through the DMS→ODC SQL workbench bridge so the dms front-end can open the ODC console against a DB2 datasource registered in DMS.
SqlWorkbenchService.convertDBType: add explicit"DB2" -> "DB2"mapping aligned with ODCConnectType.DB2literal (compat-RISK-2 align).SqlWorkbenchService.buildDatasourceBaseInfo: extract purefillDatasourceBaseInfohelper (no IO) to make DBType-branch logic unit-testable; add DB2 branch passingAdditionalParams.database_name→baseInfo.DefaultSchema; fail-fast with error containingdatabase_namewhen missing (compat-RISK-5 decision A).Test_convertDBType: addDB2row + regression coverage for existing types.Test_buildDatasourceBaseInfo_DB2: 4 sub-cases (DB2 happy path / DB2 missing database_name negative / MySQL regression / Oracle regression).Test_SupportDBType: addDB2 unsupportedreverse-locking case per compat-RISK-1 decision A — DB2 stays out ofSupportDBType(sql_workbench EE side) until EE follow-up wires audit / approval.sql_workbench_service_test.goreference to the renamed constantpkgConst.DBTypePolarDBForMySQL(typo in PR #816 baseline that was blocking the test package from building).Design / compat doc lives in EE workspace (actiontech/dms-ee#839 description, docs/spec/design.md §4, docs/spec/compat_risks.md RISK-1 / RISK-2 / RISK-5).
Test plan
go vet ./internal/sql_workbench/...PASS (golang:1.24.1)go test ./internal/sql_workbench/service/...—Test_convertDBType12 sub-cases /Test_SupportDBType11 sub-cases /Test_buildDatasourceBaseInfo_DB24 sub-cases — all PASSConnectType=DB2+defaultSchema=<database_name>Fixes actiontech/dms-ee#839
Related: actiontech/odc PR #24, actiontech/odc-client PR #34
Description
添加填充数据源信息的辅助函数,支持无 IO 分支逻辑
增加 DB2 特殊处理,校验 AdditionalParams 中的 database_name
在 convertDBType 中新增 DB2 映射
增加单元测试覆盖 DB2 正例与负例
Diagram Walkthrough
File Walkthrough
sql_workbench_service.go
支持 DB2 数据源逻辑添加与重构internal/sql_workbench/service/sql_workbench_service.go
sql_workbench_service_test.go
扩展 DB2 测试用例与回归验证internal/sql_workbench/service/sql_workbench_service_test.go