Send feedback
Class DmlResult (2.32.0)
Stay organized with collections
Save and categorize content based on your preferences.
Version 2.32.0 keyboard_arrow_down
This class encapsulates the result of a Cloud Spanner DML operation, i.e., INSERT
, UPDATE
, or DELETE
.
Note:
ExecuteDmlResult
returns the number of rows modified.
Example:
using ::google::cloud::StatusOr;
namespace spanner = ::google::cloud::spanner;
std::int64_t rows_inserted;
auto commit_result = client.Commit(
[&client, &rows_inserted](
spanner::Transaction txn) -> StatusOr<spanner::Mutations> {
auto insert = client.ExecuteDml(
std::move(txn),
spanner::SqlStatement(
"INSERT INTO Singers (SingerId, FirstName, LastName)"
" VALUES (10, 'Virginia', 'Watson')"));
if (!insert) return std::move(insert).status();
rows_inserted = insert->RowsModified();
return spanner::Mutations{};
});
if (!commit_result) throw std::move(commit_result).status();
std::cout << "Rows inserted: " << rows_inserted;
Constructors
DmlResult()
DmlResult(std::unique_ptr< ResultSourceInterface >)
Parameter
Name
Description
source
std::unique_ptr< ResultSourceInterface >
DmlResult(DmlResult &&)
Parameter
Name
Description
DmlResult &&
Operators
operator=(DmlResult &&)
Parameter
Name
Description
DmlResult &&
Returns
Type
Description
DmlResult &
Functions
RowsModified() const
Returns the number of rows modified by the DML statement.
Note:
Partitioned DML only provides a lower bound of the rows modified, all other DML statements provide an exact count.
Returns
Type
Description
std::int64_t
Send feedback
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-12-19 UTC.
Need to tell us more?
[[["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-12-19 UTC."],[],[]]