@Test public void testgetTotalExecAndFetchTimeNanos() { final StatementLog stmtLog = insert1Log(); final StatementExecutedLog statementExecutedLog = new StatementExecutedLog(stmtLog.getLogId(), 123, 567L, "myexception"); repositoryUpdate.updateLogAfterExecution(statementExecutedLog); final ResultSetLog resultSetLog = new ResultSetLog(stmtLog.getLogId(), 321L, 300L, 765); repositoryUpdate.updateLogWithResultSetLog(resultSetLog); assertEquals(statementExecutedLog.getExecutionTimeNanos() + resultSetLog.getResultSetUsageDurationNanos(), repositoryRead.getTotalExecAndFetchTimeNanos()); { final LogSearchCriteria searchCriteria = new LogSearchCriteria(); assertEquals(statementExecutedLog.getExecutionTimeNanos() + resultSetLog.getResultSetUsageDurationNanos(), repositoryRead.getTotalExecAndFetchTimeNanos(searchCriteria)); } { final LogSearchCriteria searchCriteria = new LogSearchCriteria(); searchCriteria.setSqlPassThroughFilter("error is null"); assertEquals(0, repositoryRead.getTotalExecAndFetchTimeNanos(searchCriteria)); } { final LogSearchCriteria searchCriteria = new LogSearchCriteria(); searchCriteria.setFilter("myrawsql"); assertEquals(statementExecutedLog.getExecutionTimeNanos() + resultSetLog.getResultSetUsageDurationNanos(), repositoryRead.getTotalExecAndFetchTimeNanos(searchCriteria)); searchCriteria.setFilter("myrawsql2"); assertEquals(0, repositoryRead.getTotalExecAndFetchTimeNanos(searchCriteria)); } { final LogSearchCriteria searchCriteria = new LogSearchCriteria(); searchCriteria.setMinDurationNanos(123L + 321L - 1); assertEquals(statementExecutedLog.getExecutionTimeNanos() + resultSetLog.getResultSetUsageDurationNanos(), repositoryRead.getTotalExecAndFetchTimeNanos(searchCriteria)); searchCriteria.setMinDurationNanos(123L + 321L); assertEquals(0, repositoryRead.getTotalExecAndFetchTimeNanos(searchCriteria)); } }
@Override public long getTotalExecAndFetchTimeNanos() { try (PreparedStatement statement = connectionRead .prepareStatement("select sum(exec_plus_rset_usage_time) from v_statement_log")) { try (ResultSet resultSet = statement.executeQuery()) { resultSet.next(); return resultSet.getLong(1); } } catch (final SQLException e) { throw new RuntimeException(e); } }
LogRepositoryReadJdbc implements LogRepositoryRead { @Override public long getTotalExecAndFetchTimeNanos() { try (PreparedStatement statement = connectionRead .prepareStatement("select sum(exec_plus_rset_usage_time) from v_statement_log")) { try (ResultSet resultSet = statement.executeQuery()) { resultSet.next(); return resultSet.getLong(1); } } catch (final SQLException e) { throw new RuntimeException(e); } } }
LogRepositoryReadJdbc implements LogRepositoryRead { @Override public long getTotalExecAndFetchTimeNanos() { try (PreparedStatement statement = connectionRead .prepareStatement("select sum(exec_plus_rset_usage_time) from v_statement_log")) { try (ResultSet resultSet = statement.executeQuery()) { resultSet.next(); return resultSet.getLong(1); } } catch (final SQLException e) { throw new RuntimeException(e); } } LogRepositoryReadJdbc(final String dbName); }
LogRepositoryReadJdbc implements LogRepositoryRead { @Override public long getTotalExecAndFetchTimeNanos() { try (PreparedStatement statement = connectionRead .prepareStatement("select sum(exec_plus_rset_usage_time) from v_statement_log")) { try (ResultSet resultSet = statement.executeQuery()) { resultSet.next(); return resultSet.getLong(1); } } catch (final SQLException e) { throw new RuntimeException(e); } } LogRepositoryReadJdbc(final String dbName); @Override void dispose(); @Override void getStatements(final LogSearchCriteria searchCriteria, final ResultSetAnalyzer analyzer,
            final boolean withFilledSql); @Override void getStatementsGroupByRawSQL(final LogSearchCriteria searchCriteria, final ResultSetAnalyzer analyzer); @Override void getStatementsGroupByFilledSQL(final LogSearchCriteria searchCriteria,
            final ResultSetAnalyzer analyzer); @Nullable @Override DetailedViewStatementLog getStatementLog(final long id); @Override int countStatements(); @Override long getTotalExecAndFetchTimeNanos(); @Override long getTotalExecAndFetchTimeNanos(final LogSearchCriteria searchCriteria); @Override void getBatchStatementExecutions(final UUID logId, final ResultSetAnalyzer analyzer); }
LogRepositoryReadJdbc implements LogRepositoryRead { @Override public long getTotalExecAndFetchTimeNanos() { try (PreparedStatement statement = connectionRead .prepareStatement("select sum(exec_plus_rset_usage_time) from v_statement_log")) { try (ResultSet resultSet = statement.executeQuery()) { resultSet.next(); return resultSet.getLong(1); } } catch (final SQLException e) { throw new RuntimeException(e); } } LogRepositoryReadJdbc(final String dbName); @Override void dispose(); @Override void getStatements(final LogSearchCriteria searchCriteria, final ResultSetAnalyzer analyzer,
            final boolean withFilledSql); @Override void getStatementsGroupByRawSQL(final LogSearchCriteria searchCriteria, final ResultSetAnalyzer analyzer); @Override void getStatementsGroupByFilledSQL(final LogSearchCriteria searchCriteria,
            final ResultSetAnalyzer analyzer); @Nullable @Override DetailedViewStatementLog getStatementLog(final long id); @Override int countStatements(); @Override long getTotalExecAndFetchTimeNanos(); @Override long getTotalExecAndFetchTimeNanos(final LogSearchCriteria searchCriteria); @Override void getBatchStatementExecutions(final UUID logId, final ResultSetAnalyzer analyzer);  }