/** * Gets a value from a given column in a JDBC result set. * * @param i Ordinal of column (1-based, per JDBC) */ private Object value(int i) throws SQLException { // MySQL returns timestamps shifted into local time. Using // getTimestamp(int, Calendar) with a UTC calendar should prevent this, // but does not. So we shift explicitly. switch (types[i]) { case Types.TIMESTAMP: return shift(resultSet.getTimestamp(i + 1)); case Types.TIME: return shift(resultSet.getTime(i + 1)); case Types.DATE: return shift(resultSet.getDate(i + 1)); } return primitives[i].jdbcGet(resultSet, i + 1); }
public ObjectArrayRowBuilder(ResultSet resultSet, Primitive[] primitives, int[] types) throws SQLException { this.resultSet = resultSet; this.primitives = primitives; this.types = types; this.columnCount = resultSet.getMetaData().getColumnCount(); }