spanner-jdbc: Fix and add tests for JdbcTypeConverter #6150
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.
This PR adds tests for
JdbcTypeConverterwhich is used by theJdbcResultSetclass to convert data in the database to a different type than the base type (i.e. returning data from an INT64 column as an Integer instead of a Long). The file also contains convert methods for dates, timestamps and time values.The conversion of values from one type to another has been slightly changed to support all conversions that are specified as required by JDBC, in addition to removing conversion that would loose data, such as from FLOAT64 to Integer.
The method for getting a Timestamp column as a
java.sql.Timehas been changed to reuse the logic of thegetAsSqlTimestampto correctly handle timezones.