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
@@ -48,4 +48,15 @@ public class PGWithClause extends PGSQLObjectImpl {
}
visitor.endVisit(this);
}
public PGWithClause clone() {
PGWithClause x = new PGWithClause();
x.recursive = recursive;
for (PGWithQuery w : withQuery) {
PGWithQuery w2 = w.clone();
w2.setParent(x);
x.withQuery.add(w2);
}
return x;
}
}
@@ -64,4 +64,22 @@ public class PGWithQuery extends PGSQLObjectImpl {
}
visitor.endVisit(this);
}
public PGWithQuery clone() {
PGWithQuery x = new PGWithQuery();
if (name != null) {
x.setName(name.clone());
}
for (SQLExpr c : columns) {
SQLExpr c2 = c.clone();
c2.setParent(x);
x.columns.add(c);
}
if (query != null) {
x.setQuery(query.clone());
}
return x;
}
}
@@ -65,4 +65,12 @@ public class PGIntervalExpr extends SQLExprImpl implements SQLLiteralExpr,PGExpr
protected void accept0(SQLASTVisitor visitor) {
this.accept0((PGASTVisitor) visitor);
}
public PGIntervalExpr clone() {
PGIntervalExpr x = new PGIntervalExpr();
if (value != null) {
x.setValue(value.clone());
}
return x;
}
}
@@ -31,6 +31,22 @@ public class PGInsertStatement extends SQLInsertStatement implements PGSQLStatem
private SQLExpr returning;
private boolean defaultValues = false;
public void cloneTo(PGInsertStatement x) {
super.cloneTo(x);
if (with != null) {
x.setWith(with.clone());
}
for (ValuesClause v : valuesList) {
ValuesClause v2 = v.clone();
v2.setParent(x);
x.valuesList.add(v2);
}
if (returning != null) {
x.setReturning(returning.clone());
}
x.defaultValues = defaultValues;
}
public SQLExpr getReturning() {
return returning;
}
@@ -96,4 +112,10 @@ public class PGInsertStatement extends SQLInsertStatement implements PGSQLStatem
visitor.endVisit(this);
}
public PGInsertStatement clone() {
PGInsertStatement x = new PGInsertStatement();
cloneTo(x);
return x;
}
}