improved sql parser.

This commit is contained in:
wenshao
2017-08-03 10:41:23 +08:00
parent 9df6894d83
commit b0c38aef68
70 changed files with 1091 additions and 109 deletions
@@ -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;
}
}
@@ -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;
}
}