Package com.glyart.asql.common.functions
Interface BatchPreparedStatementSetter
-
- All Known Implementing Classes:
DefaultBatchSetter
public interface BatchPreparedStatementSetter
Represents a batch update callback interface used by theDataTemplate
class.Implementations set values on a
PreparedStatement
provided by The DataTemplate 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 by aSQL DataTemplate and passed to a CompletableFuture for further analysis by the user.
A default implementation called DefaultBatchSetter is already provided.
- See Also:
DefaultBatchSetter
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description int
getBatchSize()
Gets the size of the batch.void
setValues(PreparedStatement ps, int i)
Sets parameter values on the given PreparedStatement.
-
-
-
Method Detail
-
setValues
void setValues(@NotNull PreparedStatement ps, int i) throws SQLException
Sets parameter values on the given PreparedStatement.- Parameters:
ps
- an active PreparedStatement for invoking setter methodsi
- index of the statement inside the batch, starting from 0- Throws:
SQLException
- if an SQLException is encountered while trying to set values (no need to catch)
-
getBatchSize
int getBatchSize()
Gets the size of the batch.- Returns:
- the number of statements in the batch
-
-