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:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
+22
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user