package com.chenyang.druid.sql.dialect.mysql.ast.statement;

import com.chenyang.druid.sql.ast.SQLName;
import com.chenyang.druid.sql.ast.expr.SQLPropertyExpr;
import com.chenyang.druid.sql.dialect.mysql.visitor.MySqlASTVisitor;

public class MySqlShowHMSMetaStatement extends MySqlStatementImpl implements MySqlShowStatement {
   private SQLName name;

   public SQLName getName() {
      return this.name;
   }

   public void setName(SQLName name) {
      this.name = name;
   }

   public String getSchema() {
      return this.name instanceof SQLPropertyExpr ? ((SQLPropertyExpr)this.name).getOwnernName() : null;
   }

   public String getTableName() {
      return this.name.getSimpleName();
   }

   public void accept0(MySqlASTVisitor visitor) {
      if (visitor.visit(this)) {
         this.acceptChild(visitor, this.name);
      }

      visitor.endVisit(this);
   }
}
