Skip to content
Open
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 @@ -48,6 +48,7 @@
import java.sql.Statement;
import java.sql.Time;
import java.sql.Timestamp;
import java.time.ZoneId;
import java.util.Calendar;
import java.util.List;

Expand Down Expand Up @@ -551,22 +552,40 @@ public InputStream getBinaryStream(int columnIndex) throws SQLException {
@Override
public Date getDate(int columnIndex, Calendar cal) throws SQLException {
LOG.finestTrace("getDate");
Date date = getDate(columnIndex);
return BigQueryTypeCoercionUtility.convertDateWithCalendar(date, cal);
try {
Object value = getObject(columnIndex);
StandardSQLTypeName bqType = getStandardSQLTypeName(columnIndex);
ZoneId zone = (cal == null) ? null : cal.getTimeZone().toZoneId();
return BigQueryTypeRegistry.convert(value, bqType, Date.class, zone);
} catch (BigQueryJdbcException e) {
throw createCoercionException(columnIndex, Date.class, e);
}
}

@Override
public Time getTime(int columnIndex, Calendar cal) throws SQLException {
LOG.finestTrace("getTime");
Time time = getTime(columnIndex);
return BigQueryTypeCoercionUtility.convertTimeWithCalendar(time, cal);
try {
Object value = getObject(columnIndex);
StandardSQLTypeName bqType = getStandardSQLTypeName(columnIndex);
ZoneId zone = (cal == null) ? null : cal.getTimeZone().toZoneId();
return BigQueryTypeRegistry.convert(value, bqType, Time.class, zone);
} catch (BigQueryJdbcException e) {
throw createCoercionException(columnIndex, Time.class, e);
}
}

@Override
public Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException {
LOG.finestTrace("getTimestamp");
Timestamp timestamp = getTimestamp(columnIndex);
return BigQueryTypeCoercionUtility.convertTimestampWithCalendar(timestamp, cal);
try {
Object value = getObject(columnIndex);
StandardSQLTypeName bqType = getStandardSQLTypeName(columnIndex);
ZoneId zone = (cal == null) ? null : cal.getTimeZone().toZoneId();
return BigQueryTypeRegistry.convert(value, bqType, Timestamp.class, zone);
} catch (BigQueryJdbcException e) {
throw createCoercionException(columnIndex, Timestamp.class, e);
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,13 @@ public Date getDate(String parameterName) throws SQLException {
@Override
public Date getDate(int parameterIndex, Calendar calendar) throws SQLException {
Date date = getDate(parameterIndex);
return BigQueryTypeCoercionUtility.convertDateWithCalendar(date, calendar);
return BigQueryTemporalUtility.convertDateWithCalendar(date, calendar);
}

@Override
public Date getDate(String parameterName, Calendar calendar) throws SQLException {
Date date = getDate(parameterName);
return BigQueryTypeCoercionUtility.convertDateWithCalendar(date, calendar);
return BigQueryTemporalUtility.convertDateWithCalendar(date, calendar);
}

@Override
Expand Down Expand Up @@ -459,13 +459,13 @@ public Time getTime(String parameterName) throws SQLException {
@Override
public Time getTime(int parameterIndex, Calendar calendar) throws SQLException {
Time time = getTime(parameterIndex);
return BigQueryTypeCoercionUtility.convertTimeWithCalendar(time, calendar);
return BigQueryTemporalUtility.convertTimeWithCalendar(time, calendar);
}

@Override
public Time getTime(String parameterName, Calendar calendar) throws SQLException {
Time time = getTime(parameterName);
return BigQueryTypeCoercionUtility.convertTimeWithCalendar(time, calendar);
return BigQueryTemporalUtility.convertTimeWithCalendar(time, calendar);
}

@Override
Expand All @@ -481,13 +481,13 @@ public Timestamp getTimestamp(String parameterName) throws SQLException {
@Override
public Timestamp getTimestamp(int parameterIndex, Calendar calendar) throws SQLException {
Timestamp ts = getTimestamp(parameterIndex);
return BigQueryTypeCoercionUtility.convertTimestampWithCalendar(ts, calendar);
return BigQueryTemporalUtility.convertTimestampWithCalendar(ts, calendar);
}

@Override
public Timestamp getTimestamp(String parameterName, Calendar calendar) throws SQLException {
Timestamp ts = getTimestamp(parameterName);
return BigQueryTypeCoercionUtility.convertTimestampWithCalendar(ts, calendar);
return BigQueryTemporalUtility.convertTimestampWithCalendar(ts, calendar);
}

@Override
Expand Down Expand Up @@ -708,7 +708,7 @@ public void setDate(String parameterName, Date value, Calendar calendar) throws
checkClosed();
this.parameterHandler.setParameter(
parameterName,
BigQueryTypeCoercionUtility.convertDateToCalendar(value, calendar),
BigQueryTemporalUtility.convertDateToCalendar(value, calendar),
Date.class,
BigQueryStatementParameterType.IN,
0);
Expand Down Expand Up @@ -860,7 +860,7 @@ public void setTime(String parameterName, Time value, Calendar calendar) throws
checkClosed();
this.parameterHandler.setParameter(
parameterName,
value == null ? null : BigQueryTypeCoercionUtility.convertTimeWithCalendar(value, calendar),
value == null ? null : BigQueryTemporalUtility.convertTimeWithCalendar(value, calendar),
Time.class,
BigQueryStatementParameterType.IN,
0);
Expand All @@ -879,7 +879,7 @@ public void setTimestamp(String parameterName, Timestamp value, Calendar calenda
checkClosed();
this.parameterHandler.setParameter(
parameterName,
BigQueryTypeCoercionUtility.convertTimestampWithCalendar(value, calendar),
BigQueryTemporalUtility.convertTimestampWithCalendar(value, calendar),
Timestamp.class,
BigQueryStatementParameterType.IN,
0);
Expand Down

This file was deleted.

This file was deleted.

Loading
Loading