package com.chenyang.druid.sql.dialect.mariadb.ast.clause;

import com.chenyang.druid.sql.ast.SQLName;
import com.chenyang.druid.sql.ast.expr.SQLIdentifierExpr;
import com.chenyang.druid.sql.ast.statement.SQLSelect;
import com.chenyang.druid.sql.dialect.mariadb.ast.statement.MariadbStatementImpl;
import com.chenyang.druid.sql.dialect.mariadb.visitor.MariadbASTVisitor;

public class MariadbCursorDeclareStatement extends MariadbStatementImpl {
   private SQLName cursorName;
   private SQLSelect select;

   public SQLName getCursorName() {
      return this.cursorName;
   }

   public void setCursorName(SQLName cursorName) {
      if (cursorName != null) {
         cursorName.setParent(this);
      }

      this.cursorName = cursorName;
   }

   public void setCursorName(String cursorName) {
      this.setCursorName((SQLName)(new SQLIdentifierExpr(cursorName)));
   }

   public SQLSelect getSelect() {
      return this.select;
   }

   public void setSelect(SQLSelect select) {
      if (select != null) {
         select.setParent(this);
      }

      this.select = select;
   }

   public void accept0(MariadbASTVisitor visitor) {
      if (visitor.visit(this)) {
         this.acceptChild(visitor, this.select);
      }

      visitor.endVisit(this);
   }
}
