Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ final class JdbcTypeMapper {
m.put(Types.DOUBLE, BestFitColumnType.DOUBLE);
m.put(Types.FLOAT, BestFitColumnType.DOUBLE);
m.put(Types.BIGINT, BestFitColumnType.DOUBLE);
// temporal columns are read with their own getter, not getObject: the class getObject returns is the driver's
// choice. Oracle reports its DATE as TIMESTAMP (it carries a time of day) and keeps it so: read as a date it
// would lose the time, and its members and segment predicates would miss the rows
m.put(Types.DATE, BestFitColumnType.DATE);
m.put(Types.TIMESTAMP, BestFitColumnType.TIMESTAMP);
DEFAULT_TYPE_MAP = Collections.unmodifiableMap(m);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ void testNumericPrecisionFiveScaleZeroMapsToInt() throws SQLException {
assertEquals(BestFitColumnType.INT, dialect.getType(rs, 0));
}

/** A date and a timestamp are read with their getters; getObject returns whatever class the driver picks. */
@Test
void temporalColumnsAreReadAsDateAndTimestamp() throws SQLException {
ResultSetMetaData rs = mock(ResultSetMetaData.class);
when(rs.getColumnType(1)).thenReturn(Types.DATE);
when(rs.getColumnType(2)).thenReturn(Types.TIMESTAMP);
assertEquals(BestFitColumnType.DATE, dialect.getType(rs, 0));
assertEquals(BestFitColumnType.TIMESTAMP, dialect.getType(rs, 1));
}

@Test
void testDecimalPrecisionFiveScaleZeroMapsToInt() throws SQLException {
ResultSetMetaData rs = mock(ResultSetMetaData.class);
Expand Down
Loading