Package org.dbunit.operation
Class DatabaseOperation
java.lang.Object
org.dbunit.operation.DatabaseOperation
- Direct Known Subclasses:
AbstractOperation,CloseConnectionOperation,CompositeOperation,TransactionOperation
Defines the interface contract for operations performed on the database.
- Since:
- Feb 18, 2002
- Version:
- $Revision$
- Author:
- Manuel Laflamme
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final DatabaseOperationDeletes all rows of the dataset's tables, then inserts the dataset's rows.static final DatabaseOperationDeletes rows matching the dataset's primary keys.static final DatabaseOperationDeletes all rows of the dataset's tables.static final DatabaseOperationInserts the dataset's rows.static final DatabaseOperationNo-op that does nothing to the database.static final DatabaseOperationUpdates existing rows and inserts rows that do not yet exist (upsert).static final DatabaseOperationTruncates the dataset's tables.static final DatabaseOperationUpdates existing rows matching the dataset's primary keys. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic final DatabaseOperationCLOSE_CONNECTION(DatabaseOperation operation) Wraps the given operation so it closes the connection after executing.abstract voidexecute(IDatabaseConnection connection, IDataSet dataSet) Executes this operation on the specified database using the specified dataset contents.static final DatabaseOperationTRANSACTION(DatabaseOperation operation) Wraps the given operation so it runs within its own transaction.
-
Field Details
-
NONE
No-op that does nothing to the database.- See Also:
-
UPDATE
Updates existing rows matching the dataset's primary keys.- See Also:
-
INSERT
Inserts the dataset's rows.- See Also:
-
REFRESH
Updates existing rows and inserts rows that do not yet exist (upsert).- See Also:
-
DELETE
Deletes rows matching the dataset's primary keys.- See Also:
-
DELETE_ALL
Deletes all rows of the dataset's tables.- See Also:
-
TRUNCATE_TABLE
Truncates the dataset's tables.- See Also:
-
CLEAN_INSERT
Deletes all rows of the dataset's tables, then inserts the dataset's rows.- See Also:
-
-
Constructor Details
-
DatabaseOperation
public DatabaseOperation()
-
-
Method Details
-
TRANSACTION
Wraps the given operation so it runs within its own transaction.- Parameters:
operation- the operation to wrap.- Returns:
- the wrapped, transactional operation.
- See Also:
-
CLOSE_CONNECTION
Wraps the given operation so it closes the connection after executing.- Parameters:
operation- the operation to wrap.- Returns:
- the wrapped operation.
- See Also:
-
execute
public abstract void execute(IDatabaseConnection connection, IDataSet dataSet) throws DatabaseUnitException, SQLException Executes this operation on the specified database using the specified dataset contents.- 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.
-