Package org.dbunit.database.rowcount
Interface RowCounter
- All Known Implementing Classes:
QueryPerTableRowCounter
public interface RowCounter
Counts the rows of a set of database tables. The strategy behind
RowCountCheck, configured via
DatabaseConfig.PROPERTY_ROW_COUNTER; counting is the expensive part
of the row count check and the part most likely to be improved, so it is
the one seam the check opens.
An implementation's contract:
- Return an entry for every requested table name, keyed exactly as supplied.
- Return entries for no other tables.
- Counts must be exact. Estimates, such as vendor statistics views that lag asynchronously, are not acceptable however cheap they are, since they would produce false failures.
RowCountCheck
before this interface is ever consulted, so an implementation's whole job is
counting the list it is handed.- Since:
- 3.6.0
- Author:
- dbunit
-
Method Summary
-
Method Details
-
countRows
Map<String,Integer> countRows(IDatabaseConnection connection, List<String> tableNames) throws SQLException Counts the rows of every given table.- Parameters:
connection- the connection to count rows through.tableNames- the names of the tables to count; every name must appear as a key in the returned map, and no other keys may appear.- Returns:
- the row count of each requested table, keyed exactly as supplied.
- Throws:
SQLException- if counting a table's rows fails.
-