-
Notifications
You must be signed in to change notification settings - Fork 110
Add support for prepared statements in JDBC #3116
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
Add support for prepared statements in JDBC #3116
Conversation
# Conflicts: # yaml-tests/src/test/java/JDBCYamlIntegrationTests.java
…t type mismatch in array.
case Types.DOUBLE: | ||
return column.getDouble(); | ||
default: | ||
// TODO: NULL? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"enum" is also missing from this, but enum support in general is awaiting: #3074
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is #3074 going to be merged in soon? If so, I can add support here after it was merged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#3074 merged, but I don't know that we need to add support here, now.
fdb-relational-grpc/src/main/java/com/apple/foundationdb/relational/jdbc/TypeConversion.java
Show resolved
Hide resolved
fdb-relational-grpc/src/main/java/com/apple/foundationdb/relational/jdbc/TypeConversion.java
Show resolved
Hide resolved
fdb-relational-grpc/src/main/java/com/apple/foundationdb/relational/jdbc/TypeConversion.java
Outdated
Show resolved
Hide resolved
fdb-relational-grpc/src/main/java/com/apple/foundationdb/relational/jdbc/TypeConversion.java
Outdated
Show resolved
Hide resolved
fdb-relational-jdbc/src/main/java/com/apple/foundationdb/relational/jdbc/JDBCArrayImpl.java
Show resolved
Hide resolved
fdb-relational-jdbc/src/main/java/com/apple/foundationdb/relational/jdbc/JDBCArrayImpl.java
Show resolved
Hide resolved
fdb-relational-jdbc/src/main/java/com/apple/foundationdb/relational/jdbc/ParameterHelper.java
Outdated
Show resolved
Hide resolved
fdb-relational-jdbc/src/main/java/com/apple/foundationdb/relational/jdbc/ParameterHelper.java
Show resolved
Hide resolved
# Conflicts: # yaml-tests/src/test/java/YamlIntegrationTests.java
…here needed for old server support
fdb-relational-grpc/src/main/java/com/apple/foundationdb/relational/jdbc/TypeConversion.java
Show resolved
Hide resolved
case Types.DOUBLE: | ||
return column.getDouble(); | ||
default: | ||
// TODO: NULL? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#3074 merged, but I don't know that we need to add support here, now.
@@ -58,6 +58,7 @@ test_block: | |||
- | |||
# correlation are allowed in from-subquery. | |||
- query: select x, sq.idr, sq.nr from a, (select * from r where r.idr = a.x) sq; | |||
- supported_version: !current_version # changes in Proto definition for arrays |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, sorry.
fdb-relational-jdbc/src/main/java/com/apple/foundationdb/relational/jdbc/JDBCArrayImpl.java
Show resolved
Hide resolved
|
…tement multi-version tests to run against the 4.0.459 release
|
2 similar comments
|
|
|
1 similar comment
|
Backport parts of PR #3116 in order to allow prepared statement multi-version tests to run against the 4.0.459 release. This only takes in the JDBC server pieces that are required to allow prepared statement to run on JDBC, so that newer versions of the project can test against this server to prove backwards compatibility. The original PR had additional changes to the client side that are not required for this purpose and so were left out of this PR. Co-authored-by: Pranjal Gupta <[email protected]>
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.The change was made to be backwards compatible at the protobuf level but the old server (before this change) cannot handle arrays in parameters. In order to facilitate multi-version testing against the older servers we may be able to cherry-pick these commits to the server's branch.