19 int main(
int argc,
char* argv[])
try {
21 std::cerr <<
"Usage: " << argv[0]
22 <<
" project-id instance-id database-id\n";
26 namespace spanner = ::google::cloud::spanner;
27 spanner::Client client(
31 client.ExecuteQuery(spanner::SqlStatement(
"SELECT 'Hello World'"));
34 if (!row)
throw std::runtime_error(row.status().message());
35 std::cout << std::get<0>(*row) <<
"\n";
39 }
catch (std::exception
const& ex) {
40 std::cerr <<
"Standard exception raised: " << ex.what() <<
"\n";
std::shared_ptr< Connection > MakeConnection(Database const &db, ConnectionOptions const &connection_options, SessionPoolOptions session_pool_options)
Returns a Connection object that can be used for interacting with Spanner.
TupleStream< Tuple > StreamOf(RowRange &&range)
A factory that creates a TupleStream<Tuple> by wrapping the given range.
Contains all the Cloud Spanner C++ client types and functions.
int main(int argc, char *argv[])