Represents the result and profile stats of a data modifying operation using spanner::Client::ProfileDml()
.
This class encapsulates the result of a Cloud Spanner DML operation, i.e., INSERT
, UPDATE
, or DELETE
.
- Note
ProfileDmlResult
returns the number of rows modified, execution statistics, and query plan.
- Example:
spanner::ProfileDmlResult dml_result;
auto commit_result = client.Commit(
[&client,
&dml_result](spanner::Transaction txn) -> StatusOr<spanner::Mutations> {
auto update = client.ProfileDml(
std::move(txn),
spanner::SqlStatement(
"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();
auto execution_stats = dml_result.ExecutionStats();
if (execution_stats) {
for (auto const& stat : *execution_stats) {
std::cout << stat.first << ":\t" << stat.second << "\n";
}
}
std::vector< Mutation > Mutations
An ordered sequence of mutations to pass to Client::Commit() or return from the Client::Commit() muta...
Definition at line 220 of file results.h.