Skip to content
This repository was archived by the owner on Mar 26, 2026. It is now read-only.

fix: support DDL/ClientSideStatement through (Statement/PreparedStatement).executeUpdate API#1152

Closed
rajatbhatta wants to merge 2 commits into
googleapis:mainfrom
rajatbhatta:fix-stmt-execute-update
Closed

fix: support DDL/ClientSideStatement through (Statement/PreparedStatement).executeUpdate API#1152
rajatbhatta wants to merge 2 commits into
googleapis:mainfrom
rajatbhatta:fix-stmt-execute-update

Conversation

@rajatbhatta

@rajatbhatta rajatbhatta commented Mar 8, 2023

Copy link
Copy Markdown
Contributor

DDL statements and ClientSideStatements which return no result are now supported through PreparedStatement.executeUpdate and Statement.executeUpdate APIs in ConnectionImpl and should return 0L in that case.

Exceptions are thrown for cases where the statement is expected to return a ResultSet (for example, DML Returning statements, ClientSideStatements which return ResultSet).

These changes are made on top of changes in googleapis/java-spanner#2324. So, integration tests may not pass until those changes are merged and released.

…ment).executeUpdate API

DDL statements and ClientSideStatements which return no result are now supported through PreparedStatement.executeUpdate and Statement.executeUpdate APIs in ConnectionImpl and should return 0L in that case. Exceptions are thrown for cases where the statement is expected to return a ResultSet (for example, DML Returning statements, ClientSideStatements which return ResultSet).
@product-auto-label product-auto-label Bot added size: m Pull request size is medium. api: spanner Issues related to the googleapis/java-spanner-jdbc API. labels Mar 8, 2023
@rajatbhatta rajatbhatta requested a review from olavloite March 9, 2023 00:01

@olavloite olavloite left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks generally good to me, but I'll wait with final approval until we can actually run the tests on the updated Connection API.

* statements to be executed. It assumes that the user knows what kind of statement is being
* executed, and the method will therefore return 0 for non-returning DML statements that
* changed 0 rows and for all statements that return no result. The method throws a
* SQLException for Returning DML statements.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:

Suggested change
* SQLException for Returning DML statements.
* SQLException for DML statements with a THEN RETURN / RETURNING clause.

* statements to be executed. It assumes that the user knows what kind of statement is being
* executed, and the method will therefore return 0 for non-returning DML statements that
* changed 0 rows and for all statements that return no result. The method throws a
* SQLException for Returning DML statements.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* SQLException for Returning DML statements.
* SQLException for DML statements with a THEN RETURN / RETURNING clause.

olavloite added a commit that referenced this pull request Jan 25, 2024
Verifies that client-side statements can now also be executed using
the executeQuery and executeUpdate methods.

Replaces #1152
@olavloite

Copy link
Copy Markdown
Collaborator

Replaced by #1473

@olavloite olavloite closed this Jan 25, 2024
olavloite added a commit that referenced this pull request Feb 12, 2024
Verifies that client-side statements can now also be executed using
the executeQuery and executeUpdate methods.

Replaces #1152
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

api: spanner Issues related to the googleapis/java-spanner-jdbc API. size: m Pull request size is medium.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants