feat(java): implement getDate() in JDBC4ResultSet

This commit is contained in:
kimminseok
2025-10-07 14:22:13 +09:00
parent fb370c63a6
commit 6adc272d75
2 changed files with 71 additions and 11 deletions

View File

@@ -812,15 +812,24 @@ public final class JDBC4ResultSet implements ResultSet, ResultSetMetaData {
@Override
@Nullable
public Date getDate(int columnIndex, Calendar cal) throws SQLException {
// TODO: Properly handle timezone conversion with Calendar
return getDate(columnIndex);
final Date date = getDate(columnIndex);
if (date == null || cal == null) {
return date;
}
final Calendar localCal = Calendar.getInstance();
localCal.setTime(date);
final long offset = cal.getTimeZone().getOffset(date.getTime()) -
localCal.getTimeZone().getOffset(date.getTime());
return new Date(date.getTime() + offset);
}
@Override
@Nullable
public Date getDate(String columnLabel, Calendar cal) throws SQLException {
// TODO: Properly handle timezone conversion with Calendar
return getDate(columnLabel);
return getDate(findColumn(columnLabel), cal);
}
@Override