Package org.dbunit.database.statement
Class AutomaticPreparedBatchStatement
java.lang.Object
org.dbunit.database.statement.AutomaticPreparedBatchStatement
- All Implemented Interfaces:
IPreparedBatchStatement
Decorator around an
IPreparedBatchStatement that automatically executes
the accumulated batch once a configured row-count threshold is reached.- Since:
- Jun 12, 2003
- Version:
- $Revision$
- Author:
- Manuel Laflamme
-
Constructor Summary
ConstructorsConstructorDescriptionAutomaticPreparedBatchStatement(IPreparedBatchStatement statement, int threshold) Creates a statement that automatically executes the batch once the given threshold is reached. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBatch()Adds the currently bound parameters as a new row to the batch.voidBinds the given value, cast using the given data type, to the next parameter of the statement.voidClears all batched rows.voidclose()Closes this statement.intExecutes all batched rows.
-
Constructor Details
-
AutomaticPreparedBatchStatement
Creates a statement that automatically executes the batch once the given threshold is reached.- Parameters:
statement- the decorated statement to which batching is delegated.threshold- the number of batched rows that triggers an automatic execution.
-
-
Method Details
-
addValue
Description copied from interface:IPreparedBatchStatementBinds the given value, cast using the given data type, to the next parameter of the statement.- Specified by:
addValuein interfaceIPreparedBatchStatement- Parameters:
value- the value to bind.dataType- the data type used to cast the value.- Throws:
TypeCastException- if the value cannot be cast to the given data type.SQLException- if binding the value to the statement fails.
-
addBatch
Description copied from interface:IPreparedBatchStatementAdds the currently bound parameters as a new row to the batch.- Specified by:
addBatchin interfaceIPreparedBatchStatement- Throws:
SQLException- if adding the batch row fails.
-
executeBatch
Description copied from interface:IPreparedBatchStatementExecutes all batched rows.- Specified by:
executeBatchin interfaceIPreparedBatchStatement- Returns:
- the number of rows affected by each batched statement.
- Throws:
SQLException- if executing the batch fails.
-
clearBatch
Description copied from interface:IPreparedBatchStatementClears all batched rows.- Specified by:
clearBatchin interfaceIPreparedBatchStatement- Throws:
SQLException- if clearing the batch fails.
-
close
Description copied from interface:IPreparedBatchStatementCloses this statement.- Specified by:
closein interfaceIPreparedBatchStatement- Throws:
SQLException- if closing the statement fails.
-