Class SimplePreparedStatement

java.lang.Object
org.dbunit.database.statement.AbstractPreparedBatchStatement
org.dbunit.database.statement.SimplePreparedStatement
All Implemented Interfaces:
IPreparedBatchStatement

public class SimplePreparedStatement extends AbstractPreparedBatchStatement
IPreparedBatchStatement that binds values to a single, reusable PreparedStatement.
Since:
Mar 16, 2002
Version:
$Revision$
Author:
Manuel Laflamme
  • Constructor Details

    • SimplePreparedStatement

      public SimplePreparedStatement(String sql, Connection connection) throws SQLException
      Creates a new SimplePreparedStatement.
      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

      public void addValue(Object value, DataType dataType) throws TypeCastException, SQLException
      Description copied from interface: IPreparedBatchStatement
      Binds 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

      public void addBatch() throws SQLException
      Description copied from interface: IPreparedBatchStatement
      Adds the currently bound parameters as a new row to the batch.
      Throws:
      SQLException - if adding the batch row fails.
    • executeBatch

      public int executeBatch() throws SQLException
      Description copied from interface: IPreparedBatchStatement
      Executes all batched rows.
      Returns:
      the number of rows affected by each batched statement.
      Throws:
      SQLException - if executing the batch fails.
    • clearBatch

      public void clearBatch() throws SQLException
      Description copied from interface: IPreparedBatchStatement
      Clears all batched rows.
      Throws:
      SQLException - if clearing the batch fails.