Google Cloud Spanner C++ Client 2.13.0
A C++ Client Library for Google Cloud Spanner
|
Represents a potentially parameterized SQL statement. More...
#include <google/cloud/spanner/sql_statement.h>
Public Types | |
using | ParamType = std::unordered_map< std::string, Value > |
Type alias for parameter collection. More... | |
Public Member Functions | |
SqlStatement ()=default | |
SqlStatement (std::string statement) | |
Constructs a SqlStatement without parameters. More... | |
SqlStatement (std::string statement, ParamType params) | |
Constructs a SqlStatement with specified parameters. More... | |
SqlStatement (SqlStatement const &)=default | |
Copy and move. More... | |
SqlStatement (SqlStatement &&)=default | |
SqlStatement & | operator= (SqlStatement const &)=default |
SqlStatement & | operator= (SqlStatement &&)=default |
std::string const & | sql () const |
Returns the SQL statement. More... | |
ParamType const & | params () const |
Returns the collection of parameters. More... | |
std::vector< std::string > | ParameterNames () const |
Returns the names of all the parameters. More... | |
google::cloud::StatusOr< Value > | GetParameter (std::string const ¶meter_name) const |
Returns the value of the requested parameter. More... | |
Friends | |
bool | operator== (SqlStatement const &a, SqlStatement const &b) |
bool | operator!= (SqlStatement const &a, SqlStatement const &b) |
std::ostream & | operator<< (std::ostream &os, SqlStatement const &stmt) |
Outputs a string representation of the given stmt to the given os . More... | |
Represents a potentially parameterized SQL statement.
Details on case sensitivity for SQL statements and string values can be found here: Case Sensitivity
SqlStatement
equality comparisons are case-sensitive.Parameter placeholders are specified by @<param name>
in the SQL string. Values for parameters are a collection of std::pair<std::string const, google::cloud:spanner::Value>
.
using google::cloud::spanner::SqlStatement::ParamType = std::unordered_map<std::string, Value> |
Type alias for parameter collection.
|
default |
|
inlineexplicit |
Constructs a SqlStatement without parameters.
|
inline |
Constructs a SqlStatement with specified parameters.
|
default |
Copy and move.
|
default |
google::cloud::StatusOr< Value > google::cloud::spanner::SqlStatement::GetParameter | ( | std::string const & | parameter_name | ) | const |
Returns the value of the requested parameter.
parameter_name | name of requested parameter. |
StatusCode::kNotFound
returned for invalid names.
|
default |
|
default |
std::vector< std::string > google::cloud::spanner::SqlStatement::ParameterNames | ( | ) | const |
Returns the names of all the parameters.
|
inline |
Returns the collection of parameters.
|
inline |
Returns the SQL statement.
No parameter substitution is performed in the statement string.
|
friend |
|
friend |
Outputs a string representation of the given stmt
to the given os
.
|
friend |