Class DeleteAllOperation

Direct Known Subclasses:
TruncateTableOperation

public class DeleteAllOperation extends AbstractOperation
Deletes all rows of tables present in the specified dataset. If the dataset does not contains a particular table, but that table exists in the database, the database table is not affected. Table are truncated in reverse sequence.

This operation has the same effect of as TruncateTableOperation. TruncateTableOperation is faster, and it is non-logged, meaning it cannot be rollback. DeleteAllOperation is more portable because not all database vendor support TRUNCATE_TABLE TABLE statement.

Since:
Feb 18, 2002
Version:
$Revision$
Author:
Manuel Laflamme
See Also:
  • Method Details

    • getDeleteAllCommand

      protected String getDeleteAllCommand()
      Returns the SQL command prefix used to delete all rows of a table.
      Returns:
      the SQL command prefix used to delete all rows of a table.
    • getDeleteAllCommandSuffix

      protected String getDeleteAllCommandSuffix(IDatabaseConnection connection) throws SQLException
      Returns a suffix appended to the delete-all SQL statement for the given connection. The default implementation returns an empty string.
      Parameters:
      connection - the database connection the statement will be executed on.
      Returns:
      the SQL statement suffix.
      Throws:
      SQLException - if determining the suffix requires a database access that fails.
    • execute

      public void execute(IDatabaseConnection connection, IDataSet dataSet) throws DatabaseUnitException, SQLException
      Description copied from class: DatabaseOperation
      Executes this operation on the specified database using the specified dataset contents.
      Specified by:
      execute in class DatabaseOperation
      Parameters:
      connection - the database connection.
      dataSet - the dataset to be used by this operation.
      Throws:
      DatabaseUnitException - if a DbUnit-specific error occurs while executing the operation.
      SQLException - if a database access error occurs while executing the operation.