private PreparedStatement select_range;
private static final String SELECT_RANGE =
"select min(date), max(date) from " + DB.VALUE_DOUBLE + " where series = ?";
@Override
public Range getRange(Series<Double> series) throws T2DBException {
Range range = null;
TimeDomain timeDomain = series.getTimeDomain();
try {
select_range = open(SELECT_RANGE, series, select_range);
select_range.setInt(1, getId(series));
ResultSet rs = select_range.executeQuery();
if (rs.next()) {
range = new Range(timeDomain.timeFromOffset(rs.getInt(1)), timeDomain.timeFromOffset(rs.getInt(2)));
if (rs.wasNull())
range = null;
}
} catch (Exception e) {
throw T2DBJMsg.exception(e, J.J50122, series.getName(true));
} finally {
select_range = close(select_range);
}
if (range == null)
range = new Range(series.getTimeDomain());
return range;
}