package com.alibaba.druid.sql.dialect.oracle.ast.stmt;

import com.alibaba.druid.sql.ast.SQLArgument;
import com.alibaba.druid.sql.ast.SQLExpr;
import com.alibaba.druid.sql.ast.expr.SQLCharExpr;
import com.alibaba.druid.sql.dialect.oracle.visitor.OracleASTVisitor;
import java.util.ArrayList;
import java.util.List;

public class OracleExecuteImmediateStatement extends OracleStatementImpl {
   private SQLExpr dynamicSql;
   private final List<SQLArgument> arguments = new ArrayList();
   private final List<SQLExpr> into = new ArrayList();
   private final List<SQLExpr> returnInto = new ArrayList();

   public OracleExecuteImmediateStatement() {
   }

   public OracleExecuteImmediateStatement(String dynamicSql) {
      this.setDynamicSql(dynamicSql);
   }

   public void accept0(OracleASTVisitor visitor) {
      if (visitor.visit(this)) {
      }

      visitor.endVisit(this);
   }

   public OracleExecuteImmediateStatement clone() {
      OracleExecuteImmediateStatement x = new OracleExecuteImmediateStatement();
      if (this.dynamicSql != null) {
         x.setDynamicSql(this.dynamicSql.clone());
      }

      for(SQLArgument arg : this.arguments) {
         SQLArgument a2 = arg.clone();
         a2.setParent(x);
         x.arguments.add(a2);
      }

      for(SQLExpr e : this.into) {
         SQLExpr e2 = e.clone();
         e2.setParent(x);
         x.into.add(e2);
      }

      for(SQLExpr e : this.returnInto) {
         SQLExpr e2 = e.clone();
         e2.setParent(x);
         x.returnInto.add(e2);
      }

      return x;
   }

   public SQLExpr getDynamicSql() {
      return this.dynamicSql;
   }

   public void setDynamicSql(SQLExpr dynamicSql) {
      if (dynamicSql != null) {
         dynamicSql.setParent(this);
      }

      this.dynamicSql = dynamicSql;
   }

   public void setDynamicSql(String dynamicSql) {
      this.setDynamicSql((SQLExpr)(new SQLCharExpr(dynamicSql)));
   }

   public List<SQLArgument> getArguments() {
      return this.arguments;
   }

   public List<SQLExpr> getInto() {
      return this.into;
   }

   public List<SQLExpr> getReturnInto() {
      return this.returnInto;
   }
}
