getTiIme/Timestamp with TimeZone inconsistency

Поиск
Список
Период
Сортировка
От John Lister
Тема getTiIme/Timestamp with TimeZone inconsistency
Дата
Msg-id 49FC495F.1020302@kickstone.com
обсуждение исходный текст
Ответы Re: getTiIme/Timestamp with TimeZone inconsistency
Список pgsql-jdbc
Looking at getTime and getTimestamp in TimestampUtils as used by the
getTime(int, Calendar) and getTimestamp(int, Calendar) functions in
AbstractJDBC2ResultSet there seems to be an inconsistency:

The API docs for these state "This method uses the given calendar to
construct an appropriate millisecond value for the time if the
underlying database does not store timezone information. "

and in TimestampUtils .getTimestamp if the server returns a timezone, it
is used instead of the supplied calendar.

However in TimestampUtils.getTime, this is initially done, but then
reversed further down and the supplied timezone is used as follows:

        if (ts.hasDate) {
            // Rotate it into the requested timezone before we zero out
the date
            .....
            cal.setTime(new Date(useCal.getTime().getTime()));
            useCal = cal;
        }

is there a reason for this as it seems inconsistent with getTimestamp
and the api docs?

Removing this makes the unit test TimezoneTest.testTime more consistent
(the first group of tests all return the same value - instead of the
last one being negative)


I ask as i'm playing with the adding binary wire transfer and Mikko
Tiihonen original patch omitted time/dates as he reported they failed
the unit tests.


Thanks


В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Adam B
Дата:
Сообщение: Re: A basic Statement.getGeneratedKeys() implementation (patch attached)
Следующее
От: Oliver Jowett
Дата:
Сообщение: Re: getTiIme/Timestamp with TimeZone inconsistency