package com.alibaba.druid.sql.dialect.mariadb.ast.statement;

import com.alibaba.druid.sql.ast.SQLName;
import com.alibaba.druid.sql.ast.expr.SQLPropertyExpr;
import com.alibaba.druid.sql.dialect.mariadb.visitor.MariadbASTVisitor;

public class MariadbShowHMSMetaStatement extends MariadbStatementImpl implements MariadbShowStatement {
   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(MariadbASTVisitor visitor) {
      if (visitor.visit(this)) {
         this.acceptChild(visitor, this.name);
      }

      visitor.endVisit(this);
   }
}
