Part 1: Fix read/write/query LocalTime values (when time zone configured to be used) - #2708
Merged
Merged
Conversation
rPraml
reviewed
Jun 1, 2022
| @Override | ||
| public final void setTime(Time v) throws SQLException { | ||
| Calendar timeZone = dataTimeZone.getTimeZone(); | ||
| Calendar timeZone = dataTimeZone.getTimeComponentTimeZone(); |
rPraml
reviewed
Jun 1, 2022
| @Override | ||
| public final Time getTime() throws SQLException { | ||
| Calendar cal = dataTimeZone.getTimeZone(); | ||
| Calendar cal = dataTimeZone.getTimeComponentTimeZone(); |
Contributor
There was a problem hiding this comment.
... and here is the fix. I suggested to @nPraml to rename that method.
rPraml
reviewed
Jun 1, 2022
| * The test checks the write and read of LocalTime values. The database is in GMT time zone. | ||
| * In order to verify the test in different java time zones (where the application runs), | ||
| * use the <code>-Duser.timezone</code> as JVM argument, | ||
| * e.g. <code>-Duser.timezone="America/New_York"</code> or <code>-Duser.timezone="PST"</code>> |
Contributor
There was a problem hiding this comment.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hello @rbygrave ,
we decided to split our big refactoring PR #2443 in smaller ones.
This PR would be the first which tests the write & read & query of the LocalTime values.
In the Javadoc I noticed how it can be tested in different java time zones with -Duser.timezone.
Can you take a look at this PR?
Kind regards
Noemi
Summary of this change
This changes how
Timetype is read (ResultSet) and bound (PreparedStatement) when there is a time zone set viaDatabaseConfig.Previously,
Timewas using the time zone method forTimestamp typesrather thanDate typesand this changes it to use the method forDate types(which is actually null for everything apart from MySql).Effectively no change for MySql.
Effectively for non-MySql, the
Timetypes where incorrectly using the timezone if specified and this change means they no longer use that configured time zone.