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

import com.chenyang.druid.sql.ast.SQLExpr;
import com.chenyang.druid.sql.ast.SQLName;
import com.chenyang.druid.sql.ast.SQLObject;
import com.chenyang.druid.sql.dialect.mysql.visitor.MySqlASTVisitor;
import java.util.ArrayList;
import java.util.List;

public class MySqlPrepareStatement extends MySqlStatementImpl {
   private SQLName name;
   private SQLExpr from;

   public MySqlPrepareStatement() {
   }

   public MySqlPrepareStatement(SQLName name, SQLExpr from) {
      this.name = name;
      this.from = from;
   }

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

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

   public SQLExpr getFrom() {
      return this.from;
   }

   public void setFrom(SQLExpr from) {
      this.from = from;
   }

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

      visitor.endVisit(this);
   }

   public List<SQLObject> getChildren() {
      List<SQLObject> children = new ArrayList();
      if (this.name != null) {
         children.add(this.name);
      }

      if (this.from != null) {
         children.add(this.from);
      }

      return children;
   }
}
