For convenience, callers may wrap instances in a StreamOf<std::tuple<...>> object, which will automatically parse each Row into a std::tuple with the specified types.
Example:
namespace spanner = ::google::cloud::spanner;
spanner::SqlStatement select(
"SELECT AlbumId, AlbumTitle, MarketingBudget"
" FROM Albums"
" WHERE AlbumTitle >= 'Aardvark' AND AlbumTitle < 'Goo'");
auto profile_query_result = client.ProfileQuery(std::move(select));
for (auto& row : profile_query_result) {
if (!row) throw std::move(row).status();
// Discard rows for brevity in this example.
}
// Stats are only available after all rows from the result have been read.
auto execution_stats = profile_query_result.ExecutionStats();
if (execution_stats) {
for (auto const& 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 document outlines the `ProfileQueryResult` class in the Google Cloud Spanner C++ library, which handles results from `spanner::Client::ProfileQuery()`."],["`ProfileQueryResult` represents a stream of `Rows` and their profile statistics, accessible via input iterators returned by `begin()` and `end()`."],["Callers can directly iterate through the `ProfileQueryResult` to get a sequence of `StatusOr\u003cRow\u003e` objects or utilize a `StreamOf\u003cstd::tuple\u003c...\u003e\u003e` wrapper for automatic parsing."],["After reading all rows, you can access execution statistics via `ExecutionStats()` or the execution plan via `ExecutionPlan()`."],["The document provides links to the different versions of the library, ranging from 2.11.0 up to the most recent release candidate 2.37.0-rc, allowing you to see the documentation for those specific versions of the Spanner library."]]],[]]