public int getErrorCount ( ) { try { // Ensure any outstanding inserts are committed so that count is accurate. this . commit ( ) ; Statement statement = connection . createStatement ( ) ; statement . execute ( String . format ( "select count(*) from %serrors" , tablePrefix ) ) ; ResultSet resultSet = statement . getResultSet ( ) ; resultSet . next ( ) ; int count = resultSet . getInt ( 1 ) ; return count ; } catch ( SQLException ex ) { throw new StorageException ( ex ) ; } }
Commits any outstanding error inserts and returns the error count via a SQL query .