mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
refactor sql parser. improved db2 sql support. bug fixed for issue #2033
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user