Permalink
Browse files

feat: add support for fetching 'TIMESTAMP(6) WITHOUT TIME ZONE' as Lo…

…calDate to getObject() (#1083)
  • Loading branch information...
alexanderkjall authored and vlsi committed Jan 21, 2018
1 parent e442db1 commit 09af4b23ad589e3691314e955c130a8755436e2d
@@ -3371,6 +3371,12 @@ public void updateArray(String columnName, Array x) throws SQLException {
return type.cast(LocalDate.MIN);
}
return type.cast(dateValue.toLocalDate());
} else if (sqlType == Types.TIMESTAMP) {
LocalDateTime localDateTimeValue = getLocalDateTime(columnIndex);
if (wasNull()) {
return null;
}
return type.cast(localDateTimeValue.toLocalDate());
} else {
throw new PSQLException(GT.tr("conversion to {0} from {1} not supported", type, sqlType),
PSQLState.INVALID_PARAMETER_VALUE);
@@ -214,6 +214,10 @@ public void localTimestamps(ZoneId zoneId, String timestamp) throws SQLException
LocalDateTime localDateTime = LocalDateTime.parse(timestamp);
assertEquals(localDateTime, rs.getObject("timestamp_without_time_zone_column", LocalDateTime.class));
assertEquals(localDateTime, rs.getObject(1, LocalDateTime.class));

//Also test that we get the correct values when retrieving the data as LocalDate objects
assertEquals(localDateTime.toLocalDate(), rs.getObject("timestamp_without_time_zone_column", LocalDate.class));
assertEquals(localDateTime.toLocalDate(), rs.getObject(1, LocalDate.class));
} finally {
rs.close();
}

0 comments on commit 09af4b2

Please sign in to comment.