-
Notifications
You must be signed in to change notification settings - Fork 203
Closed
Labels
bugSomething isn't workingSomething isn't workingverifiedthe issue all pr is verifiedthe issue all pr is verified
Milestone
Description
版本信息(Version)
v4.2506 (同时需要修在05版本上)
问题描述(Describe)
当使用工单上线MySQL存储过程时,过程在上线前提交审核时报错
截图或日志(Log)
如何复现(To Reproduce)
审核如下存储过程
DELIMITER $$
CREATE PROCEDURE test_proc()
BEGIN
DECLARE result VARCHAR(10);
SET result = CASE
WHEN 1 = 1 THEN 'one'
ELSE 'other'
END;
SELECT result;
END$$
DELIMITER ;
问题原因
问题1: 出现报错的原因
在获取SQL指纹时,由于解析器无法正确的切分SQL,导致获取指纹出现报错
问题2:
使用Splitter ParseSqlText对SQL进行解析后,没有正确的获取到结束符,导致下发到MySQL服务器的sql带有DELIMITER ;
关键字,致使上线报错(在begin end块中出现case...when...then...else...end, 无法正确匹配到CaseEndCaseBlock结束块)
解决方案
修复MySQL存储过程上线审核报错,使用Splitter Parse来获取SQL指纹
增强MySQL 拆分器中的 CASE 块匹配逻辑以处理嵌套控制流语句
变更影响面
受影响的模块或功能
MySQL审核
外部引用的潜在问题或风险
无
版本兼容性
兼容
测试建议
测试多种类型多种情况的MySQL语句,参考问题原因
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingverifiedthe issue all pr is verifiedthe issue all pr is verified