Class BatchBuilder

java.lang.Object
me.hsgamer.hscore.database.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
    • executeSafe

      public int[] executeSafe()
      Execute the batch but ignore the exception
      Returns:
      the result of the batch