-
Notifications
You must be signed in to change notification settings - Fork 50
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: support getShort for DATA_TYPE in TypeInfo #1691
Merged
Merged
Conversation
This file contains 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
The ResultSet that is returned by DatabaseMetadata#getTypeInfo has a column at index 2 with the name DATA_TYPE. This field should contain one of the java.sql.Types constants, or a vendor-specific type code. The JDBC specification states that this column should be a `short` (although the constants in java.sql.Types are of type `int`). Cloud Spanner (at the time of writing) does not support any int16 fields. The type code is therefore returned as an int64. The codes that are used for vendor-specific types by Spanner exceed the max value of a `short`, and therefore resulted in an OUT_OF_RANGE exception if you tried to call `ResultSet#getShort(int)` on this column for any of the Spanner-specific types (e.g. JSON). This change fixes that by adding an additional vendor type code for these types that does fit in a `short`. This value is returned when `getShort(int)` is called on the ResultSet. Fixes #1688
product-auto-label
bot
added
size: m
Pull request size is medium.
api: spanner
Issues related to the googleapis/java-spanner-jdbc API.
labels
Jul 25, 2024
gcf-merge-on-green bot
pushed a commit
that referenced
this pull request
Aug 7, 2024
🤖 I have created a release *beep* *boop* --- ## [2.20.2](https://togithub.com/googleapis/java-spanner-jdbc/compare/v2.20.1...v2.20.2) (2024-08-07) ### Bug Fixes * Support getShort for DATA_TYPE in TypeInfo ([#1691](https://togithub.com/googleapis/java-spanner-jdbc/issues/1691)) ([828aff6](https://togithub.com/googleapis/java-spanner-jdbc/commit/828aff6f7015b5f91ebbc2ad54aeeecf5515a9bd)) ### Dependencies * Bump Spanner to 6.72.0 ([#1698](https://togithub.com/googleapis/java-spanner-jdbc/issues/1698)) ([ce00b17](https://togithub.com/googleapis/java-spanner-jdbc/commit/ce00b176d39fe728eadd386d4e9794dc1fc0fbca)) * Update dependency com.google.api.grpc:proto-google-cloud-trace-v1 to v2.47.0 ([#1695](https://togithub.com/googleapis/java-spanner-jdbc/issues/1695)) ([148c655](https://togithub.com/googleapis/java-spanner-jdbc/commit/148c655a8bd1309250b5158d0f20a167e89bd9fe)) * Update dependency com.google.cloud:google-cloud-trace to v2.47.0 ([#1696](https://togithub.com/googleapis/java-spanner-jdbc/issues/1696)) ([c6a54f7](https://togithub.com/googleapis/java-spanner-jdbc/commit/c6a54f7a3045fc711fcad8d16294c67aa8eb8810)) * Update dependency com.google.cloud:sdk-platform-java-config to v3.33.0 ([#1693](https://togithub.com/googleapis/java-spanner-jdbc/issues/1693)) ([08011a5](https://togithub.com/googleapis/java-spanner-jdbc/commit/08011a520a2fb14d06614da5e2c7b9ae47d6c6f1)) * Update dependency com.google.cloud.opentelemetry:exporter-trace to v0.31.0 ([#1679](https://togithub.com/googleapis/java-spanner-jdbc/issues/1679)) ([ddf47f4](https://togithub.com/googleapis/java-spanner-jdbc/commit/ddf47f4fc7e1c05e6e3086ada0ff3b2c1efeb2af)) * Update dependency io.opentelemetry:opentelemetry-bom to v1.40.0 ([#1676](https://togithub.com/googleapis/java-spanner-jdbc/issues/1676)) ([faf7c49](https://togithub.com/googleapis/java-spanner-jdbc/commit/faf7c4908a926cd7a10ea0b860babcaa97c4c7e1)) * Update dependency org.hamcrest:hamcrest to v3 ([#1697](https://togithub.com/googleapis/java-spanner-jdbc/issues/1697)) ([3933cf2](https://togithub.com/googleapis/java-spanner-jdbc/commit/3933cf2c4099e0d06c1dc4e4583c11ba5e4eae19)) * Update dependency org.springframework.boot:spring-boot-starter-data-jdbc to v3.3.2 ([#1685](https://togithub.com/googleapis/java-spanner-jdbc/issues/1685)) ([6a57b49](https://togithub.com/googleapis/java-spanner-jdbc/commit/6a57b49a34f2b44f42f6c07eaf5da063a1d648d0)) * Update dependency org.springframework.boot:spring-boot-starter-parent to v3.3.2 ([#1686](https://togithub.com/googleapis/java-spanner-jdbc/issues/1686)) ([2be70c7](https://togithub.com/googleapis/java-spanner-jdbc/commit/2be70c74f673c796d7b366b56644b6d00038bc07)) * Update dependency org.springframework.data:spring-data-bom to v2024.0.2 ([#1680](https://togithub.com/googleapis/java-spanner-jdbc/issues/1680)) ([23934f7](https://togithub.com/googleapis/java-spanner-jdbc/commit/23934f7f38f5c99b7a6859ab69525ce368317128)) --- This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
api: spanner
Issues related to the googleapis/java-spanner-jdbc API.
size: m
Pull request size is medium.
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.
The ResultSet that is returned by DatabaseMetadata#getTypeInfo has a column at index 2 with the name DATA_TYPE. This field should contain one of the java.sql.Types constants, or a vendor-specific type code. The JDBC specification states that this column should be a
short
(although the constants in java.sql.Types are of typeint
).Cloud Spanner (at the time of writing) does not support any int16 fields. The type code is therefore returned as an int64. The codes that are used for vendor-specific types by Spanner exceed the max value of a
short
, and therefore resulted in an OUT_OF_RANGE exception if you tried to callResultSet#getShort(int)
on this column for any of the Spanner-specific types (e.g. JSON).This change fixes that by adding an additional vendor type code for these types that does fit in a
short
. This value is returned whengetShort(int)
is called on the ResultSet.Fixes #1688