Class BatchBuilder

java.lang.Object
dev.demeng.pluginbase.sql.BatchBuilder

public class BatchBuilder extends Object
Represents a statement meant to be executed more than a single time. It will be executed all at once, using a single database connection.
  • Constructor Details

    • BatchBuilder

      public BatchBuilder(@NotNull @NotNull Sql owner, @NotNull @Language("SQL") @NotNull String statement)
  • Method Details

    • batch

      @NotNull public @NotNull BatchBuilder batch(@NotNull @NotNull be.bendem.sqlstreams.util.SqlConsumer<PreparedStatement> handler)
      Adds a handler which will be used on the statement.
      Parameters:
      handler - A new statement handler
      Returns:
      this
    • execute

      public void execute() throws SQLException
      Executes the statement for this batch, with the handlers used to prepare it.
      Throws:
      SQLException - If there is an SQL issue executing the batch
    • reset

      @NotNull public @NotNull BatchBuilder reset()
      Resets this BatchBuilder's handlers, making it possible to be reused.
      Returns:
      this