Skip to content

Commit 4840580

Browse files
rajatbhattaolavloitegcf-owl-bot[bot]
authored
test: add integration tests in client for DML Returning (#1910)
* test: add integration tests for DML Returning. Co-authored-by: Knut Olav Løite <[email protected]> Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent dd24b89 commit 4840580

File tree

3 files changed

+422
-8
lines changed

3 files changed

+422
-8
lines changed

google-cloud-spanner/src/main/java/com/google/cloud/spanner/ReadContext.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,8 @@ ApiFuture<Struct> readRowUsingIndexAsync(
160160
String table, String index, Key key, Iterable<String> columns);
161161

162162
/**
163-
* Executes a query against the database.
163+
* Executes a query against the database. Can also execute a DML statement with returning clause
164+
* in a read/write transaction.
164165
*
165166
* <p>Implementations may or may not block in the initial {@code executeQuery(...)} call; for
166167
* those that do not, the remote call will be initiated immediately but blocking on the response

google-cloud-spanner/src/main/java/com/google/cloud/spanner/TransactionContext.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,10 @@ default ApiFuture<Void> bufferAsync(Iterable<Mutation> mutations) {
110110
}
111111

112112
/**
113-
* Executes the DML statement(s) and returns the number of rows modified. For non-DML statements,
114-
* it will result in an {@code IllegalArgumentException}. The effects of the DML statement will be
115-
* visible to subsequent operations in the transaction.
113+
* Executes the DML statement (which can be a simple DML statement or DML statement with a
114+
* returning clause) and returns the number of rows modified. For non-DML statements, it will
115+
* result in an {@code IllegalArgumentException}. The effects of the DML statement will be visible
116+
* to subsequent operations in the transaction.
116117
*/
117118
long executeUpdate(Statement statement, UpdateOption... options);
118119

@@ -141,10 +142,11 @@ default ResultSetStats analyzeUpdate(
141142
}
142143

143144
/**
144-
* Executes a list of DML statements in a single request. The statements will be executed in order
145-
* and the semantics is the same as if each statement is executed by {@code executeUpdate} in a
146-
* loop. This method returns an array of long integers, each representing the number of rows
147-
* modified by each statement.
145+
* Executes a list of DML statements (which can include simple DML statements or DML statements
146+
* with returning clause) in a single request. The statements will be executed in order and the
147+
* semantics is the same as if each statement is executed by {@code executeUpdate} in a loop. This
148+
* method returns an array of long integers, each representing the number of rows modified by each
149+
* statement.
148150
*
149151
* <p>If an individual statement fails, execution stops and a {@code SpannerBatchUpdateException}
150152
* is returned, which includes the error and the number of rows affected by the statements that

0 commit comments

Comments
 (0)