Skip to content

Commit a7b93f5

Browse files
committed
use columnIndexToName in getTimestamp
1 parent a7c3e03 commit a7b93f5

File tree

1 file changed

+1
-17
lines changed

1 file changed

+1
-17
lines changed

jdbc-v2/src/main/java/com/clickhouse/jdbc/ResultSetImpl.java

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,23 +1092,7 @@ public Time getTime(String columnLabel, Calendar cal) throws SQLException {
10921092

10931093
@Override
10941094
public Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException {
1095-
checkClosed();
1096-
try {
1097-
LocalDateTime localDateTime = reader.getLocalDateTime(columnIndex);
1098-
if (localDateTime == null) {
1099-
wasNull = true;
1100-
return null;
1101-
}
1102-
Calendar c = (Calendar) (cal != null ? cal : defaultCalendar).clone();
1103-
c.set(localDateTime.getYear(), localDateTime.getMonthValue() - 1, localDateTime.getDayOfMonth(), localDateTime.getHour(), localDateTime.getMinute(),
1104-
localDateTime.getSecond());
1105-
Timestamp timestamp = new Timestamp(c.getTimeInMillis());
1106-
timestamp.setNanos(localDateTime.getNano());
1107-
wasNull = false;
1108-
return timestamp;
1109-
} catch (Exception e) {
1110-
throw ExceptionUtils.toSqlState(String.format("SQL: [%s]; Method: getTimestamp(%s)", parentStatement.getLastSql(), columnIndex), e);
1111-
}
1095+
return getTimestamp(columnIndexToName(columnIndex), cal);
11121096
}
11131097

11141098
@Override

0 commit comments

Comments
 (0)