Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
feat: add support for fetching 'TIMESTAMP(6) WITHOUT TIME ZONE' as Lo…
…calDate to getObject() (#1083)
- Loading branch information
|
@@ -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(); |
|
|
} |
|
|