public interface BatchSetter
Database
class.
Implementations set values on a PreparedStatement
provided by The Database class, for each
of a number of updates in a batch using the same SQL statement.
They are responsible for setting parameters: a SQL statement with placeholders (question marks) will already have been supplied.
Implementations don't need to worry about handling exceptions:
they will be handled internally by DataOperations
implementations.
If the handling is done in async context then implementations should make the details available in some way.
AsyncDataOperations
may place these details inside a never null CompletableFuture object.
Modifier and Type | Method and Description |
---|---|
int |
getBatchSize()
Gets the size of the batch.
|
void |
setValues(@NotNull PreparedStatement preparedStatement,
int i)
Sets parameter values on the given PreparedStatement.
|
void setValues(@NotNull @NotNull PreparedStatement preparedStatement, int i) throws SQLException
preparedStatement
- an active PreparedStatement for invoking setter methodsi
- index of the statement inside the batch, starting from 0SQLException
- if an SQLException is encountered while trying to set values (no need to catch)int getBatchSize()
Copyright © 2021. All rights reserved.