Skip to content

Commit

Permalink
fix: invalid dml statement can still return tx id
Browse files Browse the repository at this point in the history
  • Loading branch information
olavloite committed Jul 8, 2020
1 parent 333cb25 commit 1308aec
Showing 1 changed file with 3 additions and 3 deletions.
Expand Up @@ -484,13 +484,13 @@ public long executeUpdate(Statement statement) {
try {
com.google.spanner.v1.ResultSet resultSet =
rpc.executeQuery(builder.build(), session.getOptions());
if (resultSet.getMetadata().hasTransaction()) {
onTransactionMetadata(resultSet.getMetadata().getTransaction());
}
if (!resultSet.hasStats()) {
throw new IllegalArgumentException(
"DML response missing stats possibly due to non-DML statement as input");
}
if (resultSet.getMetadata().hasTransaction()) {
onTransactionMetadata(resultSet.getMetadata().getTransaction());
}
// For standard DML, using the exact row count.
return resultSet.getStats().getRowCountExact();
} catch (SpannerException e) {
Expand Down

0 comments on commit 1308aec

Please sign in to comment.