15#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_SPANNER_RESULTS_H
16#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_SPANNER_RESULTS_H
18#include "google/cloud/spanner/row.h"
19#include "google/cloud/spanner/timestamp.h"
20#include "google/cloud/spanner/version.h"
21#include "google/cloud/optional.h"
22#include "absl/types/optional.h"
23#include <google/spanner/v1/spanner.pb.h>
26#include <unordered_map>
30namespace spanner_internal {
31GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
33class ResultSourceInterface {
35 virtual ~ResultSourceInterface() =
default;
38 virtual absl::optional<
google::spanner::v1::ResultSetMetadata> Metadata() = 0;
39 virtual absl::optional<
google::spanner::v1::ResultSetStats> Stats()
const = 0;
42GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
46GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
49
50
51
52
53
54
55
56
57using ExecutionPlan = ::
google::spanner::v1::QueryPlan;
60
61
62
63
64
65
66
67
68
69
70
71
72
73
78 std::unique_ptr<spanner_internal::ResultSourceInterface> source)
79 : source_(std::move(source)) {}
98
99
100
101
105 std::unique_ptr<spanner_internal::ResultSourceInterface> source_;
109
110
111
112
113
114
115
116
117
118
119
124 std::unique_ptr<spanner_internal::ResultSourceInterface> source)
125 : source_(std::move(source)) {}
132
133
134
135
136
140 std::unique_ptr<spanner_internal::ResultSourceInterface> source_;
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
165 std::unique_ptr<spanner_internal::ResultSourceInterface> source)
166 : source_(std::move(source)) {}
182
183
184
185
189
190
191
192
193
194
195 absl::optional<std::unordered_map<std::string, std::string>>
ExecutionStats()
199
200
201 absl::optional<
spanner::ExecutionPlan> ExecutionPlan()
const;
204 std::unique_ptr<spanner_internal::ResultSourceInterface> source_;
208
209
210
211
212
213
214
215
216
217
218
219
224 std::unique_ptr<spanner_internal::ResultSourceInterface> source)
225 : source_(std::move(source)) {}
232
233
234
235
236
240
241
242
243
244
245 absl::optional<std::unordered_map<std::string, std::string>>
ExecutionStats()
249
250
251 absl::optional<
spanner::ExecutionPlan> ExecutionPlan()
const;
254 std::unique_ptr<spanner_internal::ResultSourceInterface> source_;
257GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
Represents the result of a data modifying operation using spanner::Client::ExecuteDml().
Definition: results.h:120
DmlResult(DmlResult &&)=default
DmlResult & operator=(DmlResult &&)=default
std::int64_t RowsModified() const
Returns the number of rows modified by the DML statement.
DmlResult(std::unique_ptr< spanner_internal::ResultSourceInterface > source)
Definition: results.h:123
Represents the result and profile stats of a data modifying operation using spanner::Client::ProfileD...
Definition: results.h:220
ProfileDmlResult()=default
absl::optional< std::unordered_map< std::string, std::string > > ExecutionStats() const
Returns a collection of key value pair statistics for the SQL statement execution.
std::int64_t RowsModified() const
Returns the number of rows modified by the DML statement.
ProfileDmlResult & operator=(ProfileDmlResult &&)=default
ProfileDmlResult(std::unique_ptr< spanner_internal::ResultSourceInterface > source)
Definition: results.h:223
ProfileDmlResult(ProfileDmlResult &&)=default
Represents the stream of Rows and profile stats returned from spanner::Client::ProfileQuery().
Definition: results.h:161
RowStreamIterator end()
Returns a RowStreamIterator defining the end of this result set.
Definition: results.h:179
ProfileQueryResult(ProfileQueryResult &&)=default
absl::optional< Timestamp > ReadTimestamp() const
Retrieves the timestamp at which the read occurred.
ProfileQueryResult(std::unique_ptr< spanner_internal::ResultSourceInterface > source)
Definition: results.h:164
ProfileQueryResult()=default
RowStreamIterator begin()
Returns a RowStreamIterator defining the beginning of this result set.
Definition: results.h:173
ProfileQueryResult & operator=(ProfileQueryResult &&)=default
absl::optional< std::unordered_map< std::string, std::string > > ExecutionStats() const
Returns a collection of key value pair statistics for the SQL statement execution.
A RowStreamIterator is an Input Iterator (see below) that returns a sequence of StatusOr<Row> objects...
Definition: row.h:251
RowStreamIterator()
Default constructs an "end" iterator.
RowStreamIterator(Source source)
Constructs a RowStreamIterator that will consume rows from the given source, which must not be nullpt...
Represents the stream of Rows returned from spanner::Client::Read() or spanner::Client::ExecuteQuery(...
Definition: results.h:74
RowStream & operator=(RowStream &&)=default
RowStreamIterator begin()
Returns a RowStreamIterator defining the beginning of this range.
Definition: results.h:86
RowStream(std::unique_ptr< spanner_internal::ResultSourceInterface > source)
Definition: results.h:77
absl::optional< Timestamp > ReadTimestamp() const
Retrieves the timestamp at which the read occurred.
std::int64_t RowsModified() const
Returns the number of rows modified by a DML statement.
RowStream(RowStream &&)=default
RowStreamIterator end()
Returns a RowStreamIterator defining the end of this range.
Definition: results.h:92
A Row is a sequence of columns each with a name and an associated Value.
Definition: row.h:84
A representation of the Spanner TIMESTAMP type: An instant in time.
Definition: timestamp.h:54
Contains all the Cloud Spanner C++ client types and functions.
Definition: backoff_policy.h:23