Skip to content

Commit 223f167

Browse files
feat: Add the last statement option to ExecuteSqlRequest and ExecuteBatchDmlRequest (#2196)
* feat: Add the last statement option to ExecuteSqlRequest and ExecuteBatchDmlRequest PiperOrigin-RevId: 699218836 Source-Link: googleapis/googleapis@97da65f Source-Link: googleapis/googleapis-gen@d134e8d Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZDEzNGU4ZGE4MDQ4MzkzYjAxOWRhMzk4NjY5NzZkMmM0MTNhYzVlMSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 7299a43 commit 223f167

File tree

5 files changed

+124
-0
lines changed

5 files changed

+124
-0
lines changed

protos/google/spanner/v1/spanner.proto

+22
Original file line numberDiff line numberDiff line change
@@ -792,6 +792,17 @@ message ExecuteSqlRequest {
792792
// If the field is set to `true` but the request does not set
793793
// `partition_token`, the API returns an `INVALID_ARGUMENT` error.
794794
bool data_boost_enabled = 16;
795+
796+
// Optional. If set to true, this statement marks the end of the transaction.
797+
// The transaction should be committed or aborted after this statement
798+
// executes, and attempts to execute any other requests against this
799+
// transaction (including reads and queries) will be rejected.
800+
//
801+
// For DML statements, setting this option may cause some error reporting to
802+
// be deferred until commit time (e.g. validation of unique constraints).
803+
// Given this, successful execution of a DML statement should not be assumed
804+
// until a subsequent Commit call completes successfully.
805+
bool last_statement = 17 [(google.api.field_behavior) = OPTIONAL];
795806
}
796807

797808
// The request for [ExecuteBatchDml][google.spanner.v1.Spanner.ExecuteBatchDml].
@@ -861,6 +872,17 @@ message ExecuteBatchDmlRequest {
861872

862873
// Common options for this request.
863874
RequestOptions request_options = 5;
875+
876+
// Optional. If set to true, this request marks the end of the transaction.
877+
// The transaction should be committed or aborted after these statements
878+
// execute, and attempts to execute any other requests against this
879+
// transaction (including reads and queries) will be rejected.
880+
//
881+
// Setting this option may cause some error reporting to be deferred until
882+
// commit time (e.g. validation of unique constraints). Given this, successful
883+
// execution of statements should not be assumed until a subsequent Commit
884+
// call completes successfully.
885+
bool last_statements = 6 [(google.api.field_behavior) = OPTIONAL];
864886
}
865887

866888
// The response for

protos/protos.d.ts

+12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

protos/protos.js

+46
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

protos/protos.json

+14
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/v1/spanner_client.ts

+30
Original file line numberDiff line numberDiff line change
@@ -895,6 +895,16 @@ export class SpannerClient {
895895
*
896896
* If the field is set to `true` but the request does not set
897897
* `partition_token`, the API returns an `INVALID_ARGUMENT` error.
898+
* @param {boolean} [request.lastStatement]
899+
* Optional. If set to true, this statement marks the end of the transaction.
900+
* The transaction should be committed or aborted after this statement
901+
* executes, and attempts to execute any other requests against this
902+
* transaction (including reads and queries) will be rejected.
903+
*
904+
* For DML statements, setting this option may cause some error reporting to
905+
* be deferred until commit time (e.g. validation of unique constraints).
906+
* Given this, successful execution of a DML statement should not be assumed
907+
* until a subsequent Commit call completes successfully.
898908
* @param {object} [options]
899909
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
900910
* @returns {Promise} - The promise which resolves to an array.
@@ -1010,6 +1020,16 @@ export class SpannerClient {
10101020
* handled requests will yield the same response as the first execution.
10111021
* @param {google.spanner.v1.RequestOptions} request.requestOptions
10121022
* Common options for this request.
1023+
* @param {boolean} [request.lastStatements]
1024+
* Optional. If set to true, this request marks the end of the transaction.
1025+
* The transaction should be committed or aborted after these statements
1026+
* execute, and attempts to execute any other requests against this
1027+
* transaction (including reads and queries) will be rejected.
1028+
*
1029+
* Setting this option may cause some error reporting to be deferred until
1030+
* commit time (e.g. validation of unique constraints). Given this, successful
1031+
* execution of statements should not be assumed until a subsequent Commit
1032+
* call completes successfully.
10131033
* @param {object} [options]
10141034
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
10151035
* @returns {Promise} - The promise which resolves to an array.
@@ -1906,6 +1926,16 @@ export class SpannerClient {
19061926
*
19071927
* If the field is set to `true` but the request does not set
19081928
* `partition_token`, the API returns an `INVALID_ARGUMENT` error.
1929+
* @param {boolean} [request.lastStatement]
1930+
* Optional. If set to true, this statement marks the end of the transaction.
1931+
* The transaction should be committed or aborted after this statement
1932+
* executes, and attempts to execute any other requests against this
1933+
* transaction (including reads and queries) will be rejected.
1934+
*
1935+
* For DML statements, setting this option may cause some error reporting to
1936+
* be deferred until commit time (e.g. validation of unique constraints).
1937+
* Given this, successful execution of a DML statement should not be assumed
1938+
* until a subsequent Commit call completes successfully.
19091939
* @param {object} [options]
19101940
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
19111941
* @returns {Stream}

0 commit comments

Comments
 (0)