druid SQLUtils.refactor,参数是mysql数据库if表达式报错

z8dt9xmd  于 2021-11-27  发布在  Java
关注(0)|答案(0)|浏览(146)

例子:IF(A.NAME='张三','是','否')
Map<String, String> tableMapping =new HashMap<String, String>();
tableMapping.put("A","t2");
String sql ="IF(A.NAME='张三','是','否') ";
SQLUtils.refactor(sql,"mysql", tableMapping);
报错:
Exception in thread "main" com.alibaba.druid.sql.parser.ParserException: syntax error, error in :'NAME='张三','是','否') ', expect THEN, actual EOF pos 24, line 1, column 24, token EOF
at com.alibaba.druid.sql.parser.SQLParser.printError(SQLParser.java:287)
at com.alibaba.druid.sql.parser.SQLParser.printError(SQLParser.java:287)
at com.alibaba.druid.sql.parser.SQLParser.accept(SQLParser.java:295)
at com.alibaba.druid.sql.dialect.mysql.parser.MySqlStatementParser.parseIf(MySqlStatementParser.java:5002)
需要修改MySqlStatementParser类中parseIf方法

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题