This class encapsulates the result of a Cloud Spanner DML operation, i.e., INSERT, UPDATE, or DELETE.
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); return spanner::Mutations{}; }); if(!commit_result)throw std::move(commit_result).status();
// Stats only available after statement has been executed. std::cout <<"Rows modified: "<< dml_result.RowsModified(); auto execution_stats = dml_result.ExecutionStats(); if(execution_stats){ for(autoconst& stat :*execution_stats){ std::cout << stat.first <<":\t"<< stat.second <<"\n"; } }
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-03-14 UTC."],[[["This webpage provides documentation for the `ProfileDmlResult` class in the Google Cloud Spanner C++ client library, specifically for version 2.29.0 and other versions ranging from 2.11.0 to 2.37.0-rc."],["The `ProfileDmlResult` class represents the outcome of a Data Manipulation Language (DML) operation (like `INSERT`, `UPDATE`, or `DELETE`) performed in Cloud Spanner, allowing access to the number of rows affected, execution stats, and the query plan."],["The class offers methods like `RowsModified()`, `ExecutionStats()`, and `ExecutionPlan()` to retrieve the rows modified count, a map of execution statistics, and the execution plan, respectively."],["The documentation includes examples on how to interact with the `ProfileDmlResult` class when committing transactions and showing how to print out rows modified, along with execution stats."],["The page also lists previous versions of the documentations, with 2.37.0-rc being the latest and 2.11.0 being the oldest version covered in the list."]]],[]]