Skip to content

Conversation

@iwanghc
Copy link
Collaborator

@iwanghc iwanghc commented Mar 24, 2025

User description

关联的 issue

#2962

描述你的变更

mysql审核时删除sql语句的注释信息

确认项(pr提交后操作)

Tip

请在指定复审人之前,确认并完成以下事项,完成后✅


  • 我已完成自测
  • 我已记录完整日志方便进行诊断
  • 我已在关联的issue里补充了实现方案
  • 我已在关联的issue里补充了测试影响面
  • 我已确认了变更的兼容性,如果不兼容则在issue里标记 not_compatible
  • 我已确认了是否要更新文档,如果要更新则在issue里标记 need_update_doc


Description

  • 修复审核SQL以注释结尾时报错

  • 优化日志输出,添加错误行信息

  • 引入清除SQL注释的功能

  • 增加相关单元测试


Changes walkthrough 📝

Relevant files
Enhancement
comment_cleaner.go
引入SQL注释清理功能                                                                                           

sqle/driver/mysql/splitter/comment_cleaner.go

  • 添加清除SQL注释的函数
  • 处理单行和块注释
  • 保留Hint和条件注释
+102/-0 
Bug fix
splitter.go
修改分割器以支持注释清理                                                                                         

sqle/driver/mysql/splitter/splitter.go

  • 修改分割器以移除SQL注释
  • 添加注释清理逻辑
  • 确保空SQL被跳过
+4/-0     
Tests
splitter_test.go
增加SQL注释清理的测试                                                                                         

sqle/driver/mysql/splitter/splitter_test.go

  • 增加清除SQL注释的单元测试
  • 覆盖多种注释场景
  • 测试Hint和条件注释保留
+152/-3 

Need help?
  • Type /help how to ... in the comments thread for any questions about PR-Agent usage.
  • Check out the documentation for more information.
  • @github-actions
    Copy link

    github-actions bot commented Mar 24, 2025

    PR Reviewer Guide 🔍

    (Review updated until commit b20a0ed)

    🎫 Ticket compliance analysis 🔶

    2962 - Partially compliant

    Compliant requirements:

    • 修复审核SQL以注释结尾时报错的问题

    Non-compliant requirements:

    • 优化日志输出,增加错误行或具体SQL信息
    ⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
    🧪 PR contains tests
    🔒 No security concerns identified
    ⚡ No major issues detected

    @github-actions
    Copy link

    PR Code Suggestions ✨

    No code suggestions found for the PR.

    @github-actions
    Copy link

    Persistent review updated to latest commit b4a9779

    @github-actions
    Copy link

    PR Code Suggestions ✨

    No code suggestions found for the PR.

    @github-actions
    Copy link

    Persistent review updated to latest commit 37b1753

    @github-actions
    Copy link

    PR Code Suggestions ✨

    No code suggestions found for the PR.

    @github-actions
    Copy link

    Persistent review updated to latest commit b20a0ed

    @github-actions
    Copy link

    PR Code Suggestions ✨

    No code suggestions found for the PR.

    @LordofAvernus LordofAvernus merged commit 6d3722c into main Mar 25, 2025
    4 checks passed
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Labels

    None yet

    Projects

    None yet

    Development

    Successfully merging this pull request may close these issues.

    3 participants