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