Skip to content

Commit

Permalink
test: add integration tests in client for DML Returning (#1910)
Browse files Browse the repository at this point in the history
* test: add integration tests for DML Returning.

Co-authored-by: Knut Olav Løite <koloite@gmail.com>
Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
3 people committed Nov 9, 2022
1 parent dd24b89 commit 4840580
Show file tree
Hide file tree
Showing 3 changed files with 422 additions and 8 deletions.
Expand Up @@ -160,7 +160,8 @@ ApiFuture<Struct> readRowUsingIndexAsync(
String table, String index, Key key, Iterable<String> columns);

/**
* Executes a query against the database.
* Executes a query against the database. Can also execute a DML statement with returning clause
* in a read/write transaction.
*
* <p>Implementations may or may not block in the initial {@code executeQuery(...)} call; for
* those that do not, the remote call will be initiated immediately but blocking on the response
Expand Down
Expand Up @@ -110,9 +110,10 @@ default ApiFuture<Void> bufferAsync(Iterable<Mutation> mutations) {
}

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

Expand Down Expand Up @@ -141,10 +142,11 @@ default ResultSetStats analyzeUpdate(
}

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

0 comments on commit 4840580

Please sign in to comment.