mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-22 01:20:39 +00:00
query: result_set_row: make noexcept
Remove const specifier from result_set_row._cells member to make the class nothrow_move_constructible and nothrow_move_assignable To be used later in query result_set and friends. Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
This commit is contained in:
@@ -19,6 +19,8 @@ namespace query {
|
||||
|
||||
static_assert(std::is_nothrow_move_constructible_v<non_null_data_value>);
|
||||
static_assert(std::is_nothrow_move_assignable_v<non_null_data_value>);
|
||||
static_assert(std::is_nothrow_move_constructible_v<result_set_row>);
|
||||
static_assert(std::is_nothrow_move_assignable_v<result_set_row>);
|
||||
|
||||
class deserialization_error : public std::runtime_error {
|
||||
public:
|
||||
@@ -50,7 +52,7 @@ private:
|
||||
};
|
||||
|
||||
std::ostream& operator<<(std::ostream& out, const result_set_row& row) {
|
||||
for (auto&& cell : row._cells) {
|
||||
for (auto&& cell : row.cells()) {
|
||||
auto&& type = static_cast<const data_value&>(cell.second).type();
|
||||
auto&& value = cell.second;
|
||||
out << cell.first << "=\"" << type->to_string(type->decompose(value)) << "\" ";
|
||||
|
||||
@@ -46,7 +46,7 @@ inline bool operator==(const non_null_data_value& x, const non_null_data_value&
|
||||
// including regular column cells, partition keys, as well as static values.
|
||||
class result_set_row {
|
||||
schema_ptr _schema;
|
||||
const std::unordered_map<sstring, non_null_data_value> _cells;
|
||||
std::unordered_map<sstring, non_null_data_value> _cells;
|
||||
public:
|
||||
result_set_row(schema_ptr schema, std::unordered_map<sstring, non_null_data_value>&& cells)
|
||||
: _schema{schema}
|
||||
@@ -54,15 +54,16 @@ public:
|
||||
{ }
|
||||
result_set_row(result_set_row&&) = default;
|
||||
result_set_row(const result_set_row&) = delete;
|
||||
result_set_row& operator=(result_set_row&&) = default;
|
||||
result_set_row& operator=(const result_set_row&) = delete;
|
||||
result_set_row copy() const {
|
||||
return {_schema, std::unordered_map{_cells}};
|
||||
return {_schema, std::unordered_map{cells()}};
|
||||
}
|
||||
// Look up a deserialized row cell value by column name
|
||||
const data_value*
|
||||
get_data_value(const sstring& column_name) const {
|
||||
auto it = _cells.find(column_name);
|
||||
if (it == _cells.end()) {
|
||||
auto it = cells().find(column_name);
|
||||
if (it == cells().end()) {
|
||||
return nullptr;
|
||||
}
|
||||
return &static_cast<const data_value&>(it->second);
|
||||
|
||||
Reference in New Issue
Block a user