private static int getRowCount ( String tableName , Connection connection ) throws SQLException { String rowCountSql = String . format ( "SELECT COUNT(*) FROM %s" , tableName ) ; LOG . info ( rowCountSql ) ; // Create statement for counting rows selected Statement statement = connection . createStatement ( ) ; ResultSet resultSet = statement . executeQuery ( rowCountSql ) ; if ( resultSet . next ( ) ) return resultSet . getInt ( 1 ) ; else return 0 ; }
Get number of rows for a table . This is currently just used to check the number of entities for the agency table .