-
Notifications
You must be signed in to change notification settings - Fork 346
Open
Description
现象
当SQL中使用##拼接sql字符串时,如果sql语句中使用了in的sql语法,就会导致解析错误
查看源码
ReplacementIntercepter中的##解析的正则表达式有问题
final Pattern PATTERN = Pattern.compile("\{([a-zA-Z0-9_\.\:]+)\}|##\((.+)\)");
这个正则表达式采用的是贪婪模式
如下sql
update ##(:1) set status=:2 where id in (:3)
源码
while (matcher.find(start)) {
String group = matcher.group();
String key = null;
if (group.startsWith("{")) {
key = matcher.group(1);
} else if (group.startsWith("##(")) {
key = matcher.group(2); //key = :1) set status=:2 where id in (:3
}
Activity
xuemengchaojiushiwo commentedon Jul 12, 2018
我也发现这个问题了,有什么可以变通的方法吗?