mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
refactor sql parser. sqlite support limit clause. #1556
This commit is contained in:
@@ -31,8 +31,6 @@ public class OdpsSelectQueryBlock extends SQLSelectQueryBlock {
|
||||
|
||||
private SQLOrderBy orderBy;
|
||||
|
||||
private SQLExpr limit;
|
||||
|
||||
protected List<SQLHint> hints;
|
||||
|
||||
protected List<SQLExpr> distributeBy = new ArrayList<SQLExpr>();
|
||||
@@ -58,17 +56,6 @@ public class OdpsSelectQueryBlock extends SQLSelectQueryBlock {
|
||||
return sortBy;
|
||||
}
|
||||
|
||||
public SQLExpr getLimit() {
|
||||
return limit;
|
||||
}
|
||||
|
||||
public void setLimit(SQLExpr limit) {
|
||||
if (limit != null) {
|
||||
limit.setParent(this);
|
||||
}
|
||||
this.limit = limit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.alibaba.druid.sql.dialect.odps.parser;
|
||||
|
||||
import com.alibaba.druid.sql.ast.SQLExpr;
|
||||
import com.alibaba.druid.sql.ast.SQLLimit;
|
||||
import com.alibaba.druid.sql.ast.SQLOrderingSpecification;
|
||||
import com.alibaba.druid.sql.ast.SQLSetQuantifier;
|
||||
import com.alibaba.druid.sql.ast.expr.SQLMethodInvokeExpr;
|
||||
@@ -117,7 +118,7 @@ public class OdpsSelectParser extends SQLSelectParser {
|
||||
|
||||
if (lexer.token() == Token.LIMIT) {
|
||||
lexer.nextToken();
|
||||
queryBlock.setLimit(this.expr());
|
||||
queryBlock.setLimit(new SQLLimit(this.expr()));
|
||||
}
|
||||
|
||||
return queryRest(queryBlock);
|
||||
|
||||
@@ -526,7 +526,6 @@ public class OdpsOutputVisitor extends SQLASTOutputVisitor implements OdpsASTVis
|
||||
|
||||
if (x.getLimit() != null) {
|
||||
println();
|
||||
print0(ucase ? "LIMIT " : "limit ");
|
||||
x.getLimit().accept(this);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user