refactor sql parser.

This commit is contained in:
wenshao
2017-06-02 15:47:57 +08:00
parent 82d691365a
commit 4ea81bca69
78 changed files with 965 additions and 653 deletions
@@ -176,4 +176,29 @@ public class SQLAggregateExpr extends SQLExprImpl implements Serializable {
return true;
}
public SQLAggregateExpr clone() {
SQLAggregateExpr x = new SQLAggregateExpr(methodName);
x.option = option;
for (SQLExpr arg : arguments) {
x.addArgument(arg.clone());
}
if (keep != null) {
x.setKeep(keep.clone());
}
if (over != null) {
x.setOver(over.clone());
}
if (withinGroup != null) {
x.setWithinGroup(withinGroup.clone());
}
x.ignoreNulls = ignoreNulls;
return x;
}
}
@@ -144,4 +144,24 @@ public class SQLMethodInvokeExpr extends SQLExprImpl implements Serializable {
result = 31 * result + (from != null ? from.hashCode() : 0);
return result;
}
public SQLMethodInvokeExpr clone() {
SQLMethodInvokeExpr x = new SQLMethodInvokeExpr();
x.methodName = methodName;
if (owner != null) {
x.setOwner(owner.clone());
}
for (SQLExpr param : parameters) {
x.addParameter(param.clone());
}
if (from != null) {
x.setFrom(from.clone());
}
return x;
}
}
@@ -26,6 +26,10 @@ public class SQLPropertyExpr extends SQLExprImpl implements SQLName {
private SQLExpr owner;
private String name;
public SQLPropertyExpr(String owner, String name){
this(new SQLIdentifierExpr(owner), name);
}
public SQLPropertyExpr(SQLExpr owner, String name){
setOwner(owner);
this.name = name;