Package io.codemine.java.postgresql.jdbc
Class StatementBatch<R>
java.lang.Object
io.codemine.java.postgresql.jdbc.StatementBatch<R>
Helper for executing statements in batches. All statements must be of the same type (i.e. have
the same SQL text and result type) and must not return rows.
-
Constructor Summary
ConstructorsConstructorDescriptionStatementBatch(Iterable<? extends Statement<R>> statements) Create a batch of statements to execute together. -
Method Summary
Modifier and TypeMethodDescriptionexecute(Connection connection) Execute the batch of statements using the provided JDBC connection.static <T> StatementBatch<T> Convenience varargs factory method.
-
Constructor Details
-
StatementBatch
Create a batch of statements to execute together. All statements must be of the same type (i.e. have the same SQL text and result type) and must not return rows.- Parameters:
statements- the statements to execute in batch
-
-
Method Details
-
of
Convenience varargs factory method.- Type Parameters:
T- the result type- Parameters:
statements- the statements to execute in batch- Returns:
- a new
StatementBatchcontaining the provided statements
-
execute
Execute the batch of statements using the provided JDBC connection. Returns a list of decoded affected-row results, in the same order as the input statements.- Parameters:
connection- the JDBC connection to use for batch execution- Returns:
- a list of decoded results corresponding to each statement in the batch
- Throws:
SQLException- if a database access error occurs during execution
-