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:
@@ -0,0 +1,80 @@
|
||||
package com.alibaba.druid.sql.ast.expr;
|
||||
|
||||
import com.alibaba.druid.sql.ast.SQLExpr;
|
||||
import com.alibaba.druid.sql.ast.SQLExprImpl;
|
||||
import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
/**
|
||||
* Created by wenshao on 14/06/2017.
|
||||
*/
|
||||
public class SQLFlashbackExpr extends SQLExprImpl {
|
||||
private Type type;
|
||||
private SQLExpr expr;
|
||||
|
||||
public SQLFlashbackExpr() {
|
||||
|
||||
}
|
||||
|
||||
public SQLFlashbackExpr(Type type, SQLExpr expr) {
|
||||
this.type = type;
|
||||
this.setExpr(expr);
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(Type type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public SQLExpr getExpr() {
|
||||
return expr;
|
||||
}
|
||||
|
||||
public void setExpr(SQLExpr expr) {
|
||||
if (expr != null) {
|
||||
expr.setParent(this);
|
||||
}
|
||||
this.expr = expr;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void accept0(SQLASTVisitor visitor) {
|
||||
if (visitor.visit(this)) {
|
||||
acceptChild(visitor, expr);
|
||||
}
|
||||
visitor.endVisit(this);
|
||||
}
|
||||
|
||||
public SQLFlashbackExpr clone() {
|
||||
SQLFlashbackExpr x = new SQLFlashbackExpr();
|
||||
x.type = this.type;
|
||||
if (expr != null) {
|
||||
x.setExpr(expr.clone());
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
SQLFlashbackExpr that = (SQLFlashbackExpr) o;
|
||||
|
||||
if (type != that.type) return false;
|
||||
return expr != null ? expr.equals(that.expr) : that.expr == null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = type != null ? type.hashCode() : 0;
|
||||
result = 31 * result + (expr != null ? expr.hashCode() : 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static enum Type {
|
||||
SCN, TIMESTAMP
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,7 @@ package com.alibaba.druid.sql.ast.statement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.alibaba.druid.sql.ast.SQLExpr;
|
||||
import com.alibaba.druid.sql.ast.SQLHint;
|
||||
import com.alibaba.druid.sql.ast.SQLObjectImpl;
|
||||
|
||||
@@ -27,6 +28,8 @@ public abstract class SQLTableSourceImpl extends SQLObjectImpl implements SQLTab
|
||||
|
||||
protected List<SQLHint> hints;
|
||||
|
||||
protected SQLExpr flashback;
|
||||
|
||||
public SQLTableSourceImpl(){
|
||||
|
||||
}
|
||||
@@ -71,4 +74,14 @@ public abstract class SQLTableSourceImpl extends SQLObjectImpl implements SQLTab
|
||||
return alias;
|
||||
}
|
||||
|
||||
public SQLExpr getFlashback() {
|
||||
return flashback;
|
||||
}
|
||||
|
||||
public void setFlashback(SQLExpr flashback) {
|
||||
if (flashback != null) {
|
||||
flashback.setParent(this);
|
||||
}
|
||||
this.flashback = flashback;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user