Google Cloud Spanner C++ Client  2.4.0
A C++ Client Library for Google Cloud Spanner
batch_dml_result.h
Go to the documentation of this file.
1 // Copyright 2019 Google LLC
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // https://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_SPANNER_BATCH_DML_RESULT_H
16 #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_SPANNER_BATCH_DML_RESULT_H
17 
18 #include "google/cloud/spanner/version.h"
19 #include "google/cloud/status.h"
20 #include <cstdint>
21 #include <vector>
22 
23 namespace google {
24 namespace cloud {
25 namespace spanner {
27 
28 /**
29  * The result of executing a batch of DML statements.
30  *
31  * Batch DML statements are executed in order using the
32  * `Client::ExecuteBatchDml` method, which accepts a vector of `SqlStatement`
33  * objects. The returned `BatchDmlResult` will contain one entry in
34  * `BatchDmlResult::stats` for each `SqlStatement` that was executed
35  * successfully. If execution of any `SqlStatement` fails, all subsequent
36  * statements will not be run and `BatchDmlResult::status` will contain
37  * information about the failed statement.
38  */
40  /// The stats for each successfully executed `SqlStatement`.
41  struct Stats {
42  /// The number of rows modified by a DML statement.
43  std::int64_t row_count;
44  };
45 
46  /// The stats for each successfully executed `SqlStatement`. The order of
47  /// the `SqlStatements` matches the order of the `Stats` in this vector.
48  std::vector<Stats> stats;
49 
50  /// Either OK or the error Status of the `SqlStatement` that failed.
52 };
53 
55 } // namespace spanner
56 } // namespace cloud
57 } // namespace google
58 
59 #endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_SPANNER_BATCH_DML_RESULT_H