Map<String, String> tableAliasMap =new HashMap<String, String>();
tableAliasMap.put("a", "u");
System.out.println(SQLUtils.refactor("a.username","mysql", tableAliasMap));
数据库类型mysql、odps报错,oracle成功
报错:
com.alibaba.druid.sql.parser.ParserException: syntax error, error in :'a.username', expect IDENTIFIER, actual IDENTIFIER pos 1, line 1, column 2, token IDENTIFIER a
at com.alibaba.druid.sql.parser.SQLParser.printError(SQLParser.java:287)
at com.alibaba.druid.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:532)
1条答案
按热度按时间guykilcj1#
解决方法:修改类SQLStatementParser的parseStatementList方法
public void parseStatementList(List statementList, int max, SQLObject parent) {
添加 case IDENTIFIER: {
String strVal = lexer.stringVal();