@Test public void testLoadPathsCache() throws SQLException { store.store(createMetricRecord()); }
@SuppressFBWarnings("SQL_NONCONSTANT_STRING_PASSED_TO_EXECUTE") public void store(TSDRMetricRecord mr) throws SQLException { String tsdrKey = FormatUtil.getTSDRMetricKey(mr); TSDRCacheEntry cacheEntry = cache.getCacheEntry(tsdrKey); if (cacheEntry == null) { cacheEntry = cache.addTSDRCacheEntry(tsdrKey); } StringBuilder buf = new StringBuilder(); buf.append("insert into " + METRIC_TABLE + " (KeyA,KeyB,Time,value) values("); buf.append(cacheEntry.getMd5ID().getMd5Long1()).append(","); buf.append(cacheEntry.getMd5ID().getMd5Long2()).append(","); buf.append(mr.getTimeStamp()).append(","); buf.append(mr.getMetricValue()).append(")"); String sql = buf.toString(); try (Statement st = this.connection.createStatement()) { st.execute(sql); } }
HsqlDBStore implements AutoCloseable { @SuppressFBWarnings("SQL_NONCONSTANT_STRING_PASSED_TO_EXECUTE") public void store(TSDRMetricRecord mr) throws SQLException { String tsdrKey = FormatUtil.getTSDRMetricKey(mr); TSDRCacheEntry cacheEntry = cache.getCacheEntry(tsdrKey); if (cacheEntry == null) { cacheEntry = cache.addTSDRCacheEntry(tsdrKey); } StringBuilder buf = new StringBuilder(); buf.append("insert into " + METRIC_TABLE + " (KeyA,KeyB,Time,value) values("); buf.append(cacheEntry.getMd5ID().getMd5Long1()).append(","); buf.append(cacheEntry.getMd5ID().getMd5Long2()).append(","); buf.append(mr.getTimeStamp()).append(","); buf.append(mr.getMetricValue()).append(")"); String sql = buf.toString(); try (Statement st = this.connection.createStatement()) { st.execute(sql); } } }
HsqlDBStore implements AutoCloseable { @SuppressFBWarnings("SQL_NONCONSTANT_STRING_PASSED_TO_EXECUTE") public void store(TSDRMetricRecord mr) throws SQLException { String tsdrKey = FormatUtil.getTSDRMetricKey(mr); TSDRCacheEntry cacheEntry = cache.getCacheEntry(tsdrKey); if (cacheEntry == null) { cacheEntry = cache.addTSDRCacheEntry(tsdrKey); } StringBuilder buf = new StringBuilder(); buf.append("insert into " + METRIC_TABLE + " (KeyA,KeyB,Time,value) values("); buf.append(cacheEntry.getMd5ID().getMd5Long1()).append(","); buf.append(cacheEntry.getMd5ID().getMd5Long2()).append(","); buf.append(mr.getTimeStamp()).append(","); buf.append(mr.getMetricValue()).append(")"); String sql = buf.toString(); try (Statement st = this.connection.createStatement()) { st.execute(sql); } } @Inject  HsqlDBStore(); @VisibleForTesting  HsqlDBStore(Connection connection); }
HsqlDBStore implements AutoCloseable { @SuppressFBWarnings("SQL_NONCONSTANT_STRING_PASSED_TO_EXECUTE") public void store(TSDRMetricRecord mr) throws SQLException { String tsdrKey = FormatUtil.getTSDRMetricKey(mr); TSDRCacheEntry cacheEntry = cache.getCacheEntry(tsdrKey); if (cacheEntry == null) { cacheEntry = cache.addTSDRCacheEntry(tsdrKey); } StringBuilder buf = new StringBuilder(); buf.append("insert into " + METRIC_TABLE + " (KeyA,KeyB,Time,value) values("); buf.append(cacheEntry.getMd5ID().getMd5Long1()).append(","); buf.append(cacheEntry.getMd5ID().getMd5Long2()).append(","); buf.append(mr.getTimeStamp()).append(","); buf.append(mr.getMetricValue()).append(")"); String sql = buf.toString(); try (Statement st = this.connection.createStatement()) { st.execute(sql); } } @Inject  HsqlDBStore(); @VisibleForTesting  HsqlDBStore(Connection connection); void createTSDRTables(); @SuppressFBWarnings("SQL_NONCONSTANT_STRING_PASSED_TO_EXECUTE") void store(TSDRMetricRecord mr); @SuppressFBWarnings("SQL_NONCONSTANT_STRING_PASSED_TO_EXECUTE") void store(TSDRLogRecord lr); List<TSDRMetricRecord> getTSDRMetricRecords(String tsdrMetricKey, long startDateTime, long endDateTime,
            int recordLimit); List<TSDRLogRecord> getTSDRLogRecords(String tsdrLogKey, long startDateTime, long endDateTime,
            int recordLimit); @Override @PreDestroy void close(); void purge(DataCategory category, long retentionTime); }
HsqlDBStore implements AutoCloseable { @SuppressFBWarnings("SQL_NONCONSTANT_STRING_PASSED_TO_EXECUTE") public void store(TSDRMetricRecord mr) throws SQLException { String tsdrKey = FormatUtil.getTSDRMetricKey(mr); TSDRCacheEntry cacheEntry = cache.getCacheEntry(tsdrKey); if (cacheEntry == null) { cacheEntry = cache.addTSDRCacheEntry(tsdrKey); } StringBuilder buf = new StringBuilder(); buf.append("insert into " + METRIC_TABLE + " (KeyA,KeyB,Time,value) values("); buf.append(cacheEntry.getMd5ID().getMd5Long1()).append(","); buf.append(cacheEntry.getMd5ID().getMd5Long2()).append(","); buf.append(mr.getTimeStamp()).append(","); buf.append(mr.getMetricValue()).append(")"); String sql = buf.toString(); try (Statement st = this.connection.createStatement()) { st.execute(sql); } } @Inject  HsqlDBStore(); @VisibleForTesting  HsqlDBStore(Connection connection); void createTSDRTables(); @SuppressFBWarnings("SQL_NONCONSTANT_STRING_PASSED_TO_EXECUTE") void store(TSDRMetricRecord mr); @SuppressFBWarnings("SQL_NONCONSTANT_STRING_PASSED_TO_EXECUTE") void store(TSDRLogRecord lr); List<TSDRMetricRecord> getTSDRMetricRecords(String tsdrMetricKey, long startDateTime, long endDateTime,
            int recordLimit); List<TSDRLogRecord> getTSDRLogRecords(String tsdrLogKey, long startDateTime, long endDateTime,
            int recordLimit); @Override @PreDestroy void close(); void purge(DataCategory category, long retentionTime);  }