/** Release all database resources. OK to call more than once. */ @Override public void close() { super.close(); value = null; if (result_set != null) { try { result_set.close(); } catch (Exception ex) { // Ignore } result_set = null; } if (sel_samples != null) { reader.removeFromCancellation(sel_samples); try { sel_samples.close(); } catch (Exception ex) { // Ignore } sel_samples = null; } if (reader.getDialect() == Dialect.PostgreSQL) { // Restore default auto-commit on result set close try { reader.getConnection().setAutoCommit(true); } catch (Exception e) { // Ignore } } }
/** * @param reader RDBArchiveReader * @param channel_id ID of channel * @throws Exception on error */ AbstractRDBValueIterator(final RDBArchiveReader reader, final int channel_id) throws Exception { this.reader = reader; this.channel_id = channel_id; try { this.display = determineDisplay(); this.labels = determineLabels(); } catch (final Exception ex) { // Set iterator to empty close(); if (!RDBArchiveReader.isCancellation(ex)) throw ex; // Else: Not a real error, return empty iterator } if (labels == null && display == null) display = ValueFactory.newDisplay( 0.0, 0.0, 0.0, "", NumberFormats.format(0), 0.0, 0.0, 10.0, 0.0, 10.0); }
/** Release all database resources. OK to call more than once. */ @Override public void close() { super.close(); value = null; if (result_set != null) { try { result_set.close(); } catch (Exception ex) { // Ignore } result_set = null; } if (sel_samples != null) { reader.removeFromCancellation(sel_samples); try { sel_samples.close(); } catch (Exception ex) { // Ignore } sel_samples = null; } }