fix: ResultSet#get(...) methods should auto convert values #143
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.
Methods like
ResultSet#getString(int)
andResultSet#getInt(int)
would only allow data to be fetched if the underlying data type matched the method that was invoked, i.e. callingResultSet#getString(int)
for a column containing anINT64
value would always fail. According to the JDBC specification it should however be allowed to call certainget...
methods that automatically convert the underlying value to the requested type. The supported conversions will in some cases always be supported (e.g.INT64
toSTRING
), and in some cases the method may throw an exception if the actual value cannot be converted to the requested type (e.g.STRING
toINT64
).This PR adds support for all implicit conversions for
ResultSet#get...
methods that according to the JDBC specification should be allowed. This also enables the use of the JDBC driver with frameworks that rely on these automatic conversions, such as MyBatis.