Re: Bug in JDBC-Driver?
От | Oliver Jowett |
---|---|
Тема | Re: Bug in JDBC-Driver? |
Дата | |
Msg-id | 41AD0C45.2090002@opencloud.com обсуждение исходный текст |
Ответ на | Re: Bug in JDBC-Driver? (Dave Cramer <pg@fastcrypt.com>) |
Ответы |
Postgresql driver Question
|
Список | pgsql-jdbc |
Dave Cramer wrote: > Well, I'm not going to defend the spec, as it's broken in a few places. Only a few? ;) > However there is no setTimestamp without timezone. java.sql.Timestamp stores UTC milliseconds-since-epoch. It also stores a timezone offset (in minutes?!) and has YMD/HMS accessors -- but all the timezone functionality is deprecated since JDK1.1 in favor of passing the timestamp to an appropriate Calendar object (that has timezone info plus locale-specific formatting logic). So it seems like Timestamp itself is essentially "without timezone". There is PreparedStatement.setTimestamp(column, timestamp) vs. PreparedStatement.setTimestamp(column, timestamp, calendar). It's not clear whether this is meant to do without-timezone vs. with-timezone, though. The javadoc for the second variant talks about using the provided calendar to construct a SQL DATE value, but does that mean "store timestamp with calendar's timezone" or "convert timestamp to local time in the given calendar and store without timezone" or something else again? And the first variant says nothing at all about timezones! ResultSet has getTimestamp(column) and getTimestamp(column, calendar). The second variant claims to do conversion of timestamp without timezone to UTC milliseconds using the given calendar, but only for the "without timezone" case. If you have "with timezone" the conversion to UTC just happens automatically, and there seems to be no way to retrieve the stored timezone information separately. Perhaps the driver is meant to setTimezone() on the supplied calendar, but the javadoc says nothing about this. My head hurts.. How do other JDBC drivers handle this? -O
В списке pgsql-jdbc по дате отправления: