Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix JDBC type of TIMESTAMP WITH TIME ZONE #439

Merged
merged 1 commit into from Jan 22, 2017

Conversation

marschall
Copy link
Contributor

@marschall marschall commented Jan 18, 2017

Currently the JDBC type of TIMESTAMP WITH TIME ZONE is Types.OTHER.
JDBC 4.2 has a dedicated type for this Types.TIMESTAMP_WITH_TIMEZONE.

Unfortunately this type is only available in JDBC 4.2/Java 1.8 so I
hard code the constant value instead of the constant reference.

@grandinj
Copy link
Contributor

we have required Java7 for a couple versions now, so no need to hard-code the constant

@marschall
Copy link
Contributor Author

I made a typo JDBC 4.2 is Java 1.8 and it's only available there. See
https://docs.oracle.com/javase/8/docs/api/java/sql/Types.html#TIME_WITH_TIMEZONE

@@ -315,7 +315,8 @@
// 24 for ValueTimestamp, 32 for java.sql.Timestamp
56
);
add(Value.TIMESTAMP_TZ, Types.OTHER, "TimestampTimeZone",
// TIMESTAMP_WITH_TIMEZONE = 2014
add(Value.TIMESTAMP_TZ, 2014, "TimestampTimeZone",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please a comment here why we are doing this (I don't like to look in git history to figure out things like that)

@grandinj
Copy link
Contributor

also please update the changelog.html file and add a big fat [API CHANGE] to your entry

Currently the JDBC type of TIMESTAMP WITH TIME ZONE is Types.OTHER.
JDBC 4.2 has a dedicated type for this Types.TIMESTAMP_WITH_TIMEZONE.

Unfortunately this type is only available in JDBC 4.2/Java 1.8 so I
hard code the constant value instead of the constant reference.
@marschall
Copy link
Contributor Author

marschall commented Jan 21, 2017

I added the comments, updated the changelog and created #441 to track clean ups that can be done once Java 8 is required.

@grandinj grandinj merged commit 7c1478a into h2database:master Jan 22, 2017
@grandinj
Copy link
Contributor

Great. thanks!

@ghusta
Copy link

ghusta commented Apr 7, 2017

I find it strange that "TIMESTAMP WITH TIME ZONE" was mapped to JDBC Types.OTHER.
In Postgres JDBC driver for example, it was mapped to Types.TIMESTAMP.

See there (Java 8 / JDBC 4.2 / master) : https://github.com/pgjdbc/pgjdbc/blob/master/pgjdbc/src/main/java/org/postgresql/jdbc/TypeInfoCache.java#L88
Same thing before Java 8 :
https://github.com/pgjdbc/pgjdbc/blob/REL9.4.1212/pgjdbc/src/main/java/org/postgresql/jdbc/TypeInfoCache.java#L88
But in Postgres driver, Types.TIMESTAMP_WITH_TIMEZONE is still not managed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants