Skip to content

Commit

Permalink
Bug#35097429 compile error with borrowed StmtExecute
Browse files Browse the repository at this point in the history
Codec<borrowed::message::client::StmtExecute>::decode() fails to
compile as construction of std::string from string-view fails.

Change
------

- use std::string_view for strings if the message is borrowed.

Change-Id: I55ed20bb0c84a9571e4caff183189178912cb10d
  • Loading branch information
weigon committed Feb 20, 2023
1 parent 9c762d3 commit 59ee789
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2106,7 +2106,7 @@ class Codec<borrowable::message::client::StmtExecute<Borrowed>>
if (!accu.result()) return stdx::make_unexpected(accu.result().error());

std::vector<classic_protocol::field_type::value_type> types;
std::vector<std::optional<std::string>> values;
std::vector<std::optional<typename value_type::string_type>> values;

if (new_params_bound_res->value()) {
const auto nullbits = nullbits_res->value();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1054,7 +1054,7 @@ class StmtExecute {
using string_type =
std::conditional_t<Borrowed, std::string_view, std::string>;

using value_type = std::optional<std::string>;
using value_type = std::optional<string_type>;

/**
* construct a ExecuteStmt message.
Expand Down

0 comments on commit 59ee789

Please sign in to comment.