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

import com.chenyang.druid.sql.ast.SQLExpr;
import com.chenyang.druid.sql.ast.SQLStatementImpl;
import com.chenyang.druid.sql.visitor.SQLASTVisitor;

public class SQLCommitStatement extends SQLStatementImpl {
   private boolean write;
   private Boolean wait;
   private Boolean immediate;
   private boolean work = false;
   private Boolean chain;
   private Boolean release;
   private boolean transaction;
   private SQLExpr transactionName;
   private SQLExpr delayedDurability;

   public SQLCommitStatement clone() {
      SQLCommitStatement x = new SQLCommitStatement();
      x.write = this.write;
      x.wait = this.wait;
      x.immediate = this.immediate;
      x.work = this.work;
      x.chain = this.chain;
      x.release = this.release;
      if (this.transactionName != null) {
         x.setTransactionName(this.transactionName.clone());
      }

      if (this.delayedDurability != null) {
         x.setDelayedDurability(this.delayedDurability.clone());
      }

      return x;
   }

   public void accept0(SQLASTVisitor visitor) {
      if (visitor.visit(this)) {
         if (this.transactionName != null) {
            this.transactionName.accept(visitor);
         }

         if (this.delayedDurability != null) {
            this.delayedDurability.accept(visitor);
         }
      }

      visitor.endVisit(this);
   }

   public boolean isWrite() {
      return this.write;
   }

   public void setWrite(boolean write) {
      this.write = write;
   }

   public Boolean getWait() {
      return this.wait;
   }

   public void setWait(Boolean wait) {
      this.wait = wait;
   }

   public Boolean getImmediate() {
      return this.immediate;
   }

   public void setImmediate(Boolean immediate) {
      this.immediate = immediate;
   }

   public Boolean getChain() {
      return this.chain;
   }

   public void setChain(Boolean chain) {
      this.chain = chain;
   }

   public Boolean getRelease() {
      return this.release;
   }

   public void setRelease(Boolean release) {
      this.release = release;
   }

   public boolean isWork() {
      return this.work;
   }

   public void setWork(boolean work) {
      this.work = work;
   }

   public SQLExpr getTransactionName() {
      return this.transactionName;
   }

   public void setTransactionName(SQLExpr transactionName) {
      if (transactionName != null) {
         transactionName.setParent(this);
      }

      this.transactionName = transactionName;
   }

   public SQLExpr getDelayedDurability() {
      return this.delayedDurability;
   }

   public void setDelayedDurability(SQLExpr delayedDurability) {
      if (delayedDurability != null) {
         delayedDurability.setParent(this);
      }

      this.delayedDurability = delayedDurability;
   }

   public boolean isTransaction() {
      return this.transaction;
   }

   public void setTransaction(boolean transaction) {
      this.transaction = transaction;
   }
}
