java.lang.Object
io.github.projectunified.craftdatabase.client.sql.BatchBuilder

public class BatchBuilder extends Object
A builder for batch execution
  • Method Details

    • create

      public static BatchBuilder create(Connection connection, @Language("SQL") String statement)
      Create a new builder
      Parameters:
      connection - the connection
      statement - the statement
      Returns:
      the builder
    • addValues

      public BatchBuilder addValues(Object... values)
      Add values to the batch
      Parameters:
      values - the values
      Returns:
      this builder for chaining
    • addValues

      public BatchBuilder addValues(List<Object> values)
      Add values to the batch
      Parameters:
      values - the values
      Returns:
      this builder for chaining
    • execute

      public int[] execute() throws SQLException
      Execute the batch
      Returns:
      the result of the batch
      Throws:
      SQLException - if a SQL error occurs
    • executeUnsafe

      public int[] executeUnsafe()
      Execute the batch
      Returns:
      the result of the batch
      Throws:
      IllegalStateException - if a SQL error occurs