15 #include "google/cloud/spanner/sql_statement.h"
20 namespace spanner_internal {
23 ::
google::spanner::v1::ExecuteBatchDmlRequest::Statement statement_proto;
24 statement_proto.set_sql(std::move(s.statement_));
25 if (!s.params_.empty()) {
26 auto& values = *statement_proto.mutable_params()->mutable_fields();
27 auto& types = *statement_proto.mutable_param_types();
28 for (
auto& param : s.params_) {
29 auto type_and_value = spanner_internal::ToProto(std::move(param.second));
30 values[param.first] = std::move(type_and_value.second);
31 types[param.first] = std::move(type_and_value.first);
34 return statement_proto;
43 std::vector<std::string> keys;
44 keys.reserve(params_.size());
45 for (
auto const& p : params_) {
46 keys.push_back(p.first);
52 std::string
const& parameter_name)
const {
53 auto iter = params_.find(parameter_name);
54 if (iter != params_.end()) {
60 std::ostream& operator<<(std::ostream& os,
SqlStatement const& stmt) {
61 os << stmt.statement_;
62 for (
auto const& param : stmt.params_) {
63 os <<
"\n[param]: {" << param.first <<
"=" << param.second <<
"}";