refactor sql parser. improved db2 sql support. bug fixed for issue #2033

This commit is contained in:
wenshao
2017-10-09 15:47:16 +08:00
parent 08cc982f2e
commit f4d3310734
26 changed files with 583 additions and 186 deletions
@@ -19,22 +19,9 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
public class SQLPartitionByHash extends SQLPartitionBy {
protected SQLExpr expr;
// for aliyun ads
protected boolean key;
public SQLExpr getExpr() {
return expr;
}
public void setExpr(SQLExpr expr) {
if (expr != null) {
expr.setParent(this);
}
this.expr = expr;
}
public boolean isKey() {
return key;
}
@@ -46,7 +33,6 @@ public class SQLPartitionByHash extends SQLPartitionBy {
@Override
protected void accept0(SQLASTVisitor visitor) {
if (visitor.visit(this)) {
acceptChild(visitor, expr);
acceptChild(visitor, partitionsCount);
acceptChild(visitor, getPartitions());
acceptChild(visitor, subPartitionBy);
@@ -57,12 +43,14 @@ public class SQLPartitionByHash extends SQLPartitionBy {
public SQLPartitionByHash clone() {
SQLPartitionByHash x = new SQLPartitionByHash();
if (expr != null) {
x.setExpr(expr.clone());
}
x.key = key;
for (SQLExpr column : columns) {
SQLExpr c2 = column.clone();
c2.setParent(x);
x.columns.add(c2);
}
return x;
}
}