Package dev.demeng.pluginbase.sql
Class BatchBuilder
java.lang.Object
dev.demeng.pluginbase.sql.BatchBuilder
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@NotNull BatchBuilderbatch(@NotNull be.bendem.sqlstreams.util.SqlConsumer<PreparedStatement> handler) Adds a handler which will be used on the statement.voidexecute()Executes the statement for this batch, with the handlers used to prepare it.@NotNull BatchBuilderreset()Resets this BatchBuilder's handlers, making it possible to be reused.
-
Constructor Details
-
BatchBuilder
-
-
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
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
Resets this BatchBuilder's handlers, making it possible to be reused.- Returns:
- this
-