oracle sql parser support keep

This commit is contained in:
高铁
2016-03-11 22:08:13 +08:00
parent b66c366f93
commit 9dc9c808f6
9 changed files with 217 additions and 11 deletions
@@ -0,0 +1,42 @@
package com.alibaba.druid.sql.ast;
import com.alibaba.druid.sql.visitor.SQLASTVisitor;
public class SQLKeep extends SQLObjectImpl {
protected DenseRank denseRank;
protected SQLOrderBy orderBy;
@Override
protected void accept0(SQLASTVisitor visitor) {
if (visitor.visit(this)) {
acceptChild(visitor, this.orderBy);
}
visitor.endVisit(this);
}
public DenseRank getDenseRank() {
return denseRank;
}
public void setDenseRank(DenseRank denseRank) {
this.denseRank = denseRank;
}
public SQLOrderBy getOrderBy() {
return orderBy;
}
public void setOrderBy(SQLOrderBy orderBy) {
if (orderBy != null) {
orderBy.setParent(this);
}
this.orderBy = orderBy;
}
public static enum DenseRank {
FIRST, //
LAST
}
}
@@ -21,6 +21,7 @@ import java.util.List;
import com.alibaba.druid.sql.ast.SQLExpr;
import com.alibaba.druid.sql.ast.SQLExprImpl;
import com.alibaba.druid.sql.ast.SQLKeep;
import com.alibaba.druid.sql.ast.SQLOrderBy;
import com.alibaba.druid.sql.ast.SQLOver;
import com.alibaba.druid.sql.visitor.SQLASTVisitor;
@@ -31,6 +32,7 @@ public class SQLAggregateExpr extends SQLExprImpl implements Serializable {
protected String methodName;
protected SQLAggregateOption option;
protected final List<SQLExpr> arguments = new ArrayList<SQLExpr>();
protected SQLKeep keep;
protected SQLOver over;
protected SQLOrderBy withinGroup;
protected boolean ignoreNulls = false;
@@ -88,9 +90,23 @@ public class SQLAggregateExpr extends SQLExprImpl implements Serializable {
}
public void setOver(SQLOver over) {
if (over != null) {
over.setParent(this);
}
this.over = over;
}
public SQLKeep getKeep() {
return keep;
}
public void setKeep(SQLKeep keep) {
if (keep != null) {
keep.setParent(this);
}
this.keep = keep;
}
public boolean isIgnoreNulls() {
return this.ignoreNulls;
}