001package gudusoft.gsqlparser.nodes.oceanbase;
002
003import gudusoft.gsqlparser.EDbObjectType;
004import gudusoft.gsqlparser.nodes.TObjectName;
005import gudusoft.gsqlparser.nodes.TParseTreeNode;
006import gudusoft.gsqlparser.nodes.TParseTreeVisitor;
007
008/**
009 * AST node for OceanBase {@code DROP DBLINK} (US-005 Round 3).
010 *
011 * <p>Supports {@code DROP DBLINK [IF EXISTS] name}.
012 *
013 * @since 4.0.1.4
014 */
015public class TOceanbaseDropDblinkSqlNode extends TParseTreeNode {
016
017    private TObjectName dblinkName;
018    private boolean ifExists;
019
020    public TObjectName getDblinkName() {
021        return dblinkName;
022    }
023
024    public void setDblinkName(TObjectName dblinkName) {
025        this.dblinkName = dblinkName;
026        if (dblinkName != null) {
027            dblinkName.setDbObjectType(EDbObjectType.database);
028        }
029    }
030
031    public boolean isIfExists() {
032        return ifExists;
033    }
034
035    public void setIfExists(boolean ifExists) {
036        this.ifExists = ifExists;
037    }
038
039    @Override
040    public void init(Object arg1) {
041        setDblinkName((TObjectName) arg1);
042    }
043
044    @Override
045    public void accept(TParseTreeVisitor v) {
046        v.preVisit(this);
047        v.postVisit(this);
048    }
049
050    @Override
051    public void acceptChildren(TParseTreeVisitor v) {
052        v.preVisit(this);
053        if (dblinkName != null) {
054            dblinkName.acceptChildren(v);
055        }
056        v.postVisit(this);
057    }
058}