Add support for prepared statements in JDBC #3116
Open
+435
−53
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 enables support for prepared statements on the JDBC server.
Specifically, support for PreparedStatement
setObject()
andsetArray()
.Also,
JDBCRelationalConnection
needed support for array creation.A slew of type conversion utilities were added in support of these features.
In general, we have 3 models that we are dealing with:
And because of the way the API is structured, we may need to perform conversions between all 3. Specifically, we support the following:
Connection.createArrayOf
, where the type of array elements is also providedArray
andStruct
are assumed in all cases of nesting. That is, an array of elements would be assumed to have SQLArray
if there is any nested array. The reasoning is that we would need the additional type information in these casesSome cleanup and restructuring of that code may be warranted, in addition to null, error and edge case testing.
The protobuf for the
Array
definition was changed in order to support the extra type information. This causes version incompatibility with the previous version so multi-server tests for arrays needed to be excluded. Another option would have been to replicate the array definition for backwards compatibility but that would have added tech debt to the system.