Class QueryPerTableRowCounter

java.lang.Object
org.dbunit.database.rowcount.QueryPerTableRowCounter
All Implemented Interfaces:
RowCounter

public class QueryPerTableRowCounter extends Object implements RowCounter
RowCounter that issues one SELECT COUNT(*) per table, by looping IDatabaseConnection.getRowCount(String). Already handles schema qualification and DatabaseConfig.PROPERTY_ESCAPE_PATTERN through QualifiedTableName, and is exercised across every supported database by that method's own tests.

This is the RowCountCheck v1 implementation, and the value DatabaseConfig.PROPERTY_ROW_COUNTER initialises to.

Since:
3.6.0
Author:
dbunit
  • Constructor Details

    • QueryPerTableRowCounter

      public QueryPerTableRowCounter()
  • Method Details

    • countRows

      public Map<String,Integer> countRows(IDatabaseConnection connection, List<String> tableNames) throws SQLException
      Counts the rows of every given table.
      Specified by:
      countRows in interface RowCounter
      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.