@Test public void testUpdateExecutionAfterInsert() { final StatementLog stmtLog = insert1Log(); final StatementExecutedLog statementExecutedLog = new StatementExecutedLog(stmtLog.getLogId(), 123, 567L, "myexception"); repositoryUpdate.updateLogAfterExecution(statementExecutedLog); final DetailedViewStatementLog readLog = repositoryRead.getStatementLog(1); assertEquals(statementExecutedLog.getSqlException(), readLog.getSqlException()); }
@Override public synchronized void updateLogAfterExecution(final StatementExecutedLog log) { LOGGER.debug("updateLogAfterExecution:{}", log); try { int i = 1; updateStatementLogAfterExecution.setLong(i++, log.getExecutionTimeNanos()); @Nullable final Long updateCount = log.getUpdateCount(); if (updateCount != null) { updateStatementLogAfterExecution.setLong(i++, updateCount); } else { updateStatementLogAfterExecution.setNull(i++, Types.BIGINT); } updateStatementLogAfterExecution.setString(i++, log.getSqlException()); updateStatementLogAfterExecution.setObject(i++, log.getLogId()); updateStatementLogAfterExecution.executeUpdate(); } catch (final SQLException e) { throw new RuntimeException(e); } lastModificationTime = System.currentTimeMillis(); }
LogRepositoryUpdateJdbc implements LogRepositoryUpdate { @Override public synchronized void updateLogAfterExecution(final StatementExecutedLog log) { LOGGER.debug("updateLogAfterExecution:{}", log); try { int i = 1; updateStatementLogAfterExecution.setLong(i++, log.getExecutionTimeNanos()); @Nullable final Long updateCount = log.getUpdateCount(); if (updateCount != null) { updateStatementLogAfterExecution.setLong(i++, updateCount); } else { updateStatementLogAfterExecution.setNull(i++, Types.BIGINT); } updateStatementLogAfterExecution.setString(i++, log.getSqlException()); updateStatementLogAfterExecution.setObject(i++, log.getLogId()); updateStatementLogAfterExecution.executeUpdate(); } catch (final SQLException e) { throw new RuntimeException(e); } lastModificationTime = System.currentTimeMillis(); } }
LogRepositoryUpdateJdbc implements LogRepositoryUpdate { @Override public synchronized void updateLogAfterExecution(final StatementExecutedLog log) { LOGGER.debug("updateLogAfterExecution:{}", log); try { int i = 1; updateStatementLogAfterExecution.setLong(i++, log.getExecutionTimeNanos()); @Nullable final Long updateCount = log.getUpdateCount(); if (updateCount != null) { updateStatementLogAfterExecution.setLong(i++, updateCount); } else { updateStatementLogAfterExecution.setNull(i++, Types.BIGINT); } updateStatementLogAfterExecution.setString(i++, log.getSqlException()); updateStatementLogAfterExecution.setObject(i++, log.getLogId()); updateStatementLogAfterExecution.executeUpdate(); } catch (final SQLException e) { throw new RuntimeException(e); } lastModificationTime = System.currentTimeMillis(); } LogRepositoryUpdateJdbc(final String name); }
LogRepositoryUpdateJdbc implements LogRepositoryUpdate { @Override public synchronized void updateLogAfterExecution(final StatementExecutedLog log) { LOGGER.debug("updateLogAfterExecution:{}", log); try { int i = 1; updateStatementLogAfterExecution.setLong(i++, log.getExecutionTimeNanos()); @Nullable final Long updateCount = log.getUpdateCount(); if (updateCount != null) { updateStatementLogAfterExecution.setLong(i++, updateCount); } else { updateStatementLogAfterExecution.setNull(i++, Types.BIGINT); } updateStatementLogAfterExecution.setString(i++, log.getSqlException()); updateStatementLogAfterExecution.setObject(i++, log.getLogId()); updateStatementLogAfterExecution.executeUpdate(); } catch (final SQLException e) { throw new RuntimeException(e); } lastModificationTime = System.currentTimeMillis(); } LogRepositoryUpdateJdbc(final String name); @Override void dispose(); @Override synchronized void addStatementLog(final StatementLog log); @Override synchronized void addStatementFullyExecutedLog(final Collection<StatementFullyExecutedLog> logs); @Override synchronized void updateLogAfterExecution(final StatementExecutedLog log); @Override synchronized void updateLogWithResultSetLog(final ResultSetLog log); @Override synchronized void addBatchedPreparedStatementsLog(final BatchedPreparedStatementsLog log); @Override synchronized void addBatchedNonPreparedStatementsLog(final BatchedNonPreparedStatementsLog log); @Override synchronized void addConnection(final ConnectionInfo connectionInfo); @Override synchronized void addTxCompletionLog(final TxCompleteLog log); @Override void clear(); @Override void deleteStatementLog(final long... logIds); void deleteOldRowsIfTooMany(); @Override synchronized long getLastModificationTime(); @Override void setLastLostMessageTime(@Nullable final Long timestamp); @Override @Nullable Long getLastLostMessageTime(); }
LogRepositoryUpdateJdbc implements LogRepositoryUpdate { @Override public synchronized void updateLogAfterExecution(final StatementExecutedLog log) { LOGGER.debug("updateLogAfterExecution:{}", log); try { int i = 1; updateStatementLogAfterExecution.setLong(i++, log.getExecutionTimeNanos()); @Nullable final Long updateCount = log.getUpdateCount(); if (updateCount != null) { updateStatementLogAfterExecution.setLong(i++, updateCount); } else { updateStatementLogAfterExecution.setNull(i++, Types.BIGINT); } updateStatementLogAfterExecution.setString(i++, log.getSqlException()); updateStatementLogAfterExecution.setObject(i++, log.getLogId()); updateStatementLogAfterExecution.executeUpdate(); } catch (final SQLException e) { throw new RuntimeException(e); } lastModificationTime = System.currentTimeMillis(); } LogRepositoryUpdateJdbc(final String name); @Override void dispose(); @Override synchronized void addStatementLog(final StatementLog log); @Override synchronized void addStatementFullyExecutedLog(final Collection<StatementFullyExecutedLog> logs); @Override synchronized void updateLogAfterExecution(final StatementExecutedLog log); @Override synchronized void updateLogWithResultSetLog(final ResultSetLog log); @Override synchronized void addBatchedPreparedStatementsLog(final BatchedPreparedStatementsLog log); @Override synchronized void addBatchedNonPreparedStatementsLog(final BatchedNonPreparedStatementsLog log); @Override synchronized void addConnection(final ConnectionInfo connectionInfo); @Override synchronized void addTxCompletionLog(final TxCompleteLog log); @Override void clear(); @Override void deleteStatementLog(final long... logIds); void deleteOldRowsIfTooMany(); @Override synchronized long getLastModificationTime(); @Override void setLastLostMessageTime(@Nullable final Long timestamp); @Override @Nullable Long getLastLostMessageTime(); static final int SCHEMA_VERSION; }