Class ProfileDmlResult (2.30.0)
Stay organized with collections
Save and categorize content based on your preferences.
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 (auto const& stat : *execution_stats) {
std::cout << stat.first << ":\t" << stat.second << "\n";
}
}
Constructors
ProfileDmlResult()
ProfileDmlResult(std::unique_ptr< ResultSourceInterface >)
Parameter |
Name |
Description |
source |
std::unique_ptr< ResultSourceInterface >
|
ProfileDmlResult(ProfileDmlResult &&)
Parameter |
Name |
Description |
|
ProfileDmlResult &&
|
Operators
operator=(ProfileDmlResult &&)
Parameter |
Name |
Description |
|
ProfileDmlResult &&
|
Returns |
Type |
Description |
ProfileDmlResult & |
|
Functions
RowsModified() const
Returns the number of rows modified by the DML statement.
Returns |
Type |
Description |
std::int64_t |
|
ExecutionStats() const
Returns a collection of key value pair statistics for the SQL statement execution.
Returns |
Type |
Description |
absl::optional< std::unordered_map< std::string, std::string > > |
|
ExecutionPlan() const
Returns the plan of execution for the SQL statement.
Returns |
Type |
Description |
absl::optional< spanner::ExecutionPlan > |
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-04 UTC.
[{
"type": "thumb-down",
"id": "hardToUnderstand",
"label":"Hard to understand"
},{
"type": "thumb-down",
"id": "incorrectInformationOrSampleCode",
"label":"Incorrect information or sample code"
},{
"type": "thumb-down",
"id": "missingTheInformationSamplesINeed",
"label":"Missing the information/samples I need"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
{"lastModified": "Last updated 2024-10-04 UTC."}
[[["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 2024-10-04 UTC."]]