mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
修正运算符优先级别处理不当的问题
git-svn-id: http://code.alibabatech.com/svn/druid/trunk@160 b9813039-fb51-4c41-a8b9-e21c2acb5095
This commit is contained in:
@@ -41,35 +41,45 @@ public class SQLParser {
|
||||
}
|
||||
}
|
||||
|
||||
protected final String as() throws ParserException {
|
||||
String rtnValue = null;
|
||||
protected String as() throws ParserException {
|
||||
String alias = null;
|
||||
|
||||
if (lexer.token() == Token.AS) {
|
||||
lexer.nextToken();
|
||||
|
||||
if (lexer.token() == Token.LITERAL_ALIAS) {
|
||||
rtnValue = lexer.stringVal();
|
||||
alias = '"' + lexer.stringVal() + '"';
|
||||
lexer.nextToken();
|
||||
return rtnValue;
|
||||
return alias;
|
||||
}
|
||||
|
||||
if (lexer.token() == Token.IDENTIFIER) {
|
||||
rtnValue = lexer.stringVal();
|
||||
alias = lexer.stringVal();
|
||||
lexer.nextToken();
|
||||
return rtnValue;
|
||||
return alias;
|
||||
}
|
||||
|
||||
if (lexer.token() == Token.KEY) {
|
||||
lexer.nextToken();
|
||||
alias = "KEY";
|
||||
return alias;
|
||||
}
|
||||
|
||||
throw new ParserException("Error", 0, 0);
|
||||
}
|
||||
|
||||
if (lexer.token() == Token.LITERAL_ALIAS) {
|
||||
rtnValue = lexer.stringVal();
|
||||
alias = '"' + lexer.stringVal() + '"';
|
||||
lexer.nextToken();
|
||||
} else if (lexer.token() == Token.IDENTIFIER) {
|
||||
rtnValue = lexer.stringVal();
|
||||
alias = lexer.stringVal();
|
||||
lexer.nextToken();
|
||||
} else if (lexer.token() == Token.KEY) {
|
||||
lexer.nextToken();
|
||||
alias = "KEY";
|
||||
return alias;
|
||||
}
|
||||
return rtnValue;
|
||||
return alias;
|
||||
}
|
||||
|
||||
public void accept(Token token) {
|
||||
|
||||
Reference in New Issue
Block a user