auto commit_result = client.Commit(
[&client,
auto update = client.ProfileDml(
std::move(txn),
"UPDATE Albums SET MarketingBudget = MarketingBudget * 2"
" WHERE SingerId = 1 AND AlbumId = 1"));
if (!update) return std::move(update).status();
dml_result = *std::move(update);
});
if (!commit_result) throw std::move(commit_result).status();
std::cout <<
"Rows modified: " << dml_result.
RowsModified();
if (execution_stats) {
for (auto const& stat : *execution_stats) {
std::cout << stat.first << ":\t" << stat.second << "\n";
}
}
Represents the result and profile stats of a data modifying operation using spanner::Client::ProfileD...
Definition: results.h:244
absl::optional< std::unordered_map< std::string, std::string > > ExecutionStats() const
Returns a collection of key value pair statistics for the SQL statement execution.
std::int64_t RowsModified() const
Returns the number of rows modified by the DML statement.
Represents a potentially parameterized SQL statement.
Definition: sql_statement.h:51
The representation of a Cloud Spanner transaction.
Definition: transaction.h:58
std::vector< Mutation > Mutations
An ordered sequence of mutations to pass to Client::Commit() or return from the Client::Commit() muta...
Definition: mutations.h:99