All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.scalar.db.sql.statement.SetModeStatement Maven / Gradle / Ivy

The newest version!
package com.scalar.db.sql.statement;

import com.scalar.db.sql.TransactionMode;
import java.util.Objects;
import javax.annotation.concurrent.Immutable;

@Immutable
public class SetModeStatement implements CommandStatement {

  public final TransactionMode transactionMode;

  private SetModeStatement(TransactionMode transactionMode) {
    this.transactionMode = Objects.requireNonNull(transactionMode);
  }

  @Override
  public String toSql() {
    return "SET MODE " + transactionMode;
  }

  @Override
  public  R accept(CommandStatementVisitor visitor, C context) {
    return visitor.visit(this, context);
  }

  @Override
  public  R accept(StatementVisitor visitor, C context) {
    return visitor.visit(this, context);
  }

  @Override
  public String toString() {
    return toSql();
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (!(o instanceof SetModeStatement)) {
      return false;
    }
    SetModeStatement that = (SetModeStatement) o;
    return transactionMode == that.transactionMode;
  }

  @Override
  public int hashCode() {
    return Objects.hash(transactionMode);
  }

  public static SetModeStatement create(TransactionMode mode) {
    return new SetModeStatement(mode);
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy