mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
improved sql parser.
This commit is contained in:
@@ -58,4 +58,21 @@ public class SQLServerOutput extends SQLServerObjectImpl {
|
||||
return selectList;
|
||||
}
|
||||
|
||||
public SQLServerOutput clone() {
|
||||
SQLServerOutput x = new SQLServerOutput();
|
||||
if (into != null) {
|
||||
x.setInto(into.clone());
|
||||
}
|
||||
for (SQLExpr c : columns) {
|
||||
SQLExpr c2 = c.clone();
|
||||
c2.setParent(x);
|
||||
x.columns.add(c2);
|
||||
}
|
||||
for (SQLSelectItem item : selectList) {
|
||||
SQLSelectItem item2 = item.clone();
|
||||
item2.setParent(x);
|
||||
x.selectList.add(item2);
|
||||
}
|
||||
return x;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,4 +65,13 @@ public class SQLServerTop extends SQLServerObjectImpl {
|
||||
visitor.endVisit(this);
|
||||
}
|
||||
|
||||
public SQLServerTop clone() {
|
||||
SQLServerTop x = new SQLServerTop();
|
||||
if (expr != null) {
|
||||
x.setExpr(expr.clone());
|
||||
}
|
||||
x.percent = percent;
|
||||
x.withTies = withTies;
|
||||
return x;
|
||||
}
|
||||
}
|
||||
|
||||
+16
@@ -33,6 +33,17 @@ public class SQLServerInsertStatement extends SQLInsertStatement implements SQLS
|
||||
|
||||
private SQLServerOutput output;
|
||||
|
||||
public void cloneTo(SQLServerInsertStatement x) {
|
||||
super.cloneTo(x);
|
||||
x.defaultValues = defaultValues;
|
||||
if (top != null) {
|
||||
x.setTop(top.clone());
|
||||
}
|
||||
if (output != null) {
|
||||
x.setOutput(output.clone());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void accept0(SQLASTVisitor visitor) {
|
||||
this.accept0((SQLServerASTVisitor) visitor);
|
||||
@@ -76,4 +87,9 @@ public class SQLServerInsertStatement extends SQLInsertStatement implements SQLS
|
||||
this.top = top;
|
||||
}
|
||||
|
||||
public SQLServerInsertStatement clone() {
|
||||
SQLServerInsertStatement x = new SQLServerInsertStatement();
|
||||
cloneTo(x);
|
||||
return x;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user