fix(sql_workbench): normalize SQL Server audit schema to catalog name#644
Open
LordofAvernus wants to merge 1 commit into
Open
fix(sql_workbench): normalize SQL Server audit schema to catalog name#644LordofAvernus wants to merge 1 commit into
LordofAvernus wants to merge 1 commit into
Conversation
ODC exposes SQL Server nodes as database.schema (e.g. TestDB.dbo). SQLE direct audit uses schema_name as the connection database, so pass only the catalog part to avoid "Cannot open database TestDB.dbo". Fixes actiontech/dms-ee#911
PR Reviewer Guide 🔍
|
PR Code Suggestions ✨No code suggestions found for the PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
User description
Summary
callSQLEAudit前对 SQL Server 的schemaName做库名归一化:TestDB.dbo→TestDBDefaultCatalog的行为对齐,避免 SQLE 直连审核将TestDB.dbo当作数据库名连库失败Fixes actiontech/dms-ee#911
Problem
ODC 资源树将 SQL Server 的
database.schema平铺为节点名(如TestDB.dbo)。DMS 原样传给 SQLE/v2/sql_audit的schema_name,SQLE 将其赋给连接 DSN 的DatabaseName,导致:Test plan
Test_normalizeSQLEAuditSchemaName覆盖 SQL Server / MySQL / OracleMade with Cursor
Description
新增 normalizeSQLEAuditSchemaName 方法归一化 SQL Server schema 名称
在 callSQLEAudit 中调用归一化方法确保传递正确数据库名
新增单元测试覆盖多种数据库类型的归一化逻辑
Diagram Walkthrough
File Walkthrough
sql_workbench_service.go
新增 SQL Server schema 归一化方法及调用更新internal/sql_workbench/service/sql_workbench_service.go
sql_workbench_service_test.go
添加 SQL Server schema 归一化单元测试internal/sql_workbench/service/sql_workbench_service_test.go