Package org.dbunit.database.statement
Class SimplePreparedStatement
java.lang.Object
org.dbunit.database.statement.AbstractPreparedBatchStatement
org.dbunit.database.statement.SimplePreparedStatement
- All Implemented Interfaces:
IPreparedBatchStatement
IPreparedBatchStatement that binds values to a single, reusable
PreparedStatement.- Since:
- Mar 16, 2002
- Version:
- $Revision$
- Author:
- Manuel Laflamme
-
Field Summary
Fields inherited from class org.dbunit.database.statement.AbstractPreparedBatchStatement
_statement -
Constructor Summary
ConstructorsConstructorDescriptionSimplePreparedStatement(String sql, Connection connection) Creates a newSimplePreparedStatement. -
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.intExecutes all batched rows.Methods inherited from class org.dbunit.database.statement.AbstractPreparedBatchStatement
close
-
Constructor Details
-
SimplePreparedStatement
Creates a newSimplePreparedStatement.- Parameters:
sql- the SQL statement to prepare.connection- the JDBC connection to prepare the statement on.- Throws:
SQLException- if preparing the statement fails.
-
-
Method Details
-
addValue
Description copied from interface:IPreparedBatchStatementBinds the given value, cast using the given data type, to the next parameter of the statement.- 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.- Throws:
SQLException- if adding the batch row fails.
-
executeBatch
Description copied from interface:IPreparedBatchStatementExecutes all batched rows.- 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.- Throws:
SQLException- if clearing the batch fails.
-