mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
bug fixed for postgresql parser
This commit is contained in:
@@ -38,7 +38,7 @@ public class PGSelectParser extends SQLSelectParser {
|
||||
super(exprParser);
|
||||
}
|
||||
|
||||
public PGSelectParser(String sql) {
|
||||
public PGSelectParser(String sql){
|
||||
this(new PGExprParser(sql));
|
||||
}
|
||||
|
||||
@@ -129,24 +129,26 @@ public class PGSelectParser extends SQLSelectParser {
|
||||
|
||||
queryBlock.setOrderBy(this.createExprParser().parseOrderBy());
|
||||
|
||||
if (lexer.token() == Token.LIMIT) {
|
||||
lexer.nextToken();
|
||||
if (lexer.token() == Token.ALL) {
|
||||
queryBlock.setLimit(new SQLIdentifierExpr("ALL"));
|
||||
for (;;) {
|
||||
if (lexer.token() == Token.LIMIT) {
|
||||
lexer.nextToken();
|
||||
if (lexer.token() == Token.ALL) {
|
||||
queryBlock.setLimit(new SQLIdentifierExpr("ALL"));
|
||||
lexer.nextToken();
|
||||
} else {
|
||||
SQLExpr limit = expr();
|
||||
queryBlock.setLimit(limit);
|
||||
}
|
||||
} else if (lexer.token() == Token.OFFSET) {
|
||||
lexer.nextToken();
|
||||
SQLExpr offset = expr();
|
||||
queryBlock.setOffset(offset);
|
||||
|
||||
if (lexer.token() == Token.ROW || lexer.token() == Token.ROWS) {
|
||||
lexer.nextToken();
|
||||
}
|
||||
} else {
|
||||
SQLExpr limit = expr();
|
||||
queryBlock.setLimit(limit);
|
||||
}
|
||||
}
|
||||
|
||||
if (lexer.token() == Token.OFFSET) {
|
||||
lexer.nextToken();
|
||||
SQLExpr offset = expr();
|
||||
queryBlock.setOffset(offset);
|
||||
|
||||
if (lexer.token() == Token.ROW || lexer.token() == Token.ROWS) {
|
||||
lexer.nextToken();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user