org.dbmaintain.structure.clean.impl
Class DefaultDBCleaner
java.lang.Object
org.dbmaintain.structure.clean.impl.DefaultDBCleaner
- All Implemented Interfaces:
- DBCleaner
public class DefaultDBCleaner
- extends Object
- implements DBCleaner
Implementation of DBCleaner
. This implementation will delete all data from a database, except for the tables
that are configured as tables to preserve.
- Author:
- Tim Ducheyne, Filip Neven
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
itemsToPreserve
protected Set<DbItemIdentifier> itemsToPreserve
databases
protected Databases databases
sqlHandler
protected SQLHandler sqlHandler
DefaultDBCleaner
public DefaultDBCleaner(Databases databases,
Set<DbItemIdentifier> itemsToPreserve,
SQLHandler sqlHandler)
- Constructor for DefaultDBCleaner.
- Parameters:
databases
- The db support instances, not nullitemsToPreserve
- The schema's and tables that should not be cleaned, not nullsqlHandler
- The sql handler that will execute the statements, not null
cleanDatabase
public void cleanDatabase()
- Deletes all data from the database, except for the tables that have been
configured as tablesToPreserve , and the table in which the database version is stored
- Specified by:
cleanDatabase
in interface DBCleaner
cleanTable
protected void cleanTable(Database database,
String schemaName,
String tableName)
- Deletes the data in the table with the given name.
Note: the table name is surrounded with quotes, to make sure that
case-sensitive table names are also deleted correctly.
- Parameters:
database
- The database support, not nullschemaName
- The schema name, not nulltableName
- The name of the table that need to be cleared, not null
assertItemsToPreserveExist
protected void assertItemsToPreserveExist(Set<DbItemIdentifier> itemsToPreserve)
toDbItemIdentifiers
protected Set<DbItemIdentifier> toDbItemIdentifiers(Database database,
String schemaName,
Set<String> itemNames)
Copyright © 2011. All Rights Reserved.