alibaba / druid

阿里云计算平台DataWorks(https://help.aliyun.com/document_detail/137663.html) 团队出品,为监控而生的数据库连接池
https://github.com/alibaba/druid/wiki
Apache License 2.0
27.89k stars 8.57k forks source link

MysqlOutputVistor 对 SQLVariantRefExp 的处理,对单引号做了转义 #5472

Closed Oxeag closed 4 months ago

Oxeag commented 10 months ago

使用 SQLUtils.toSQLString(sqlStatements, JdbcConstants.MYSQL),相同的 sqlStatements 在 mysql 环境 和 oralce 环境生成的 sql 语句不同;

dae561e9e288de5098cf5352f2cff3e6

chuan'r传入参数为mysql时,将 in 后面的条件进行了转义,导致生成的sql无法执行;分析发现是 MysqlOutputVistor 对 SQLVariantRefExp 的处理做了转义的操作,而其他 dbType 则没有处理,想请问为什么 mysql 要做一个转义的额外处理,我想要自己重写这段方法,是否可以去掉 image

lizongbo commented 10 months ago

发完整的可重现bug的示例代码来,这样只发截图,很不方便重现bug。