mirror of
https://github.com/scylladb/scylladb.git
synced 2026-06-09 16:33:35 +00:00
result_set: Store schema pointer with result_set
This commit is contained in:
@@ -49,7 +49,7 @@ result_set_builder::result_set_builder(schema_ptr schema)
|
||||
{ }
|
||||
|
||||
result_set result_set_builder::build() const {
|
||||
return { _rows };
|
||||
return { _schema, _rows };
|
||||
}
|
||||
|
||||
void result_set_builder::accept_new_partition(const partition_key& key, uint32_t row_count)
|
||||
|
||||
@@ -79,11 +79,12 @@ inline bool operator!=(const result_set_row& x, const result_set_row& y) {
|
||||
// deserialized format. To obtain a result set, use the result_set_builder
|
||||
// class as a visitor to query_result::consume() function.
|
||||
class result_set {
|
||||
schema_ptr _schema;
|
||||
std::vector<result_set_row> _rows;
|
||||
public:
|
||||
static result_set from_raw_result(schema_ptr, const partition_slice&, const result&);
|
||||
result_set(const std::vector<result_set_row>& rows)
|
||||
: _rows{std::move(rows)}
|
||||
result_set(schema_ptr s, const std::vector<result_set_row>& rows)
|
||||
: _schema(std::move(s)), _rows{std::move(rows)}
|
||||
{ }
|
||||
bool empty() const {
|
||||
return _rows.empty();
|
||||
@@ -97,6 +98,9 @@ public:
|
||||
const std::vector<result_set_row>& rows() const {
|
||||
return _rows;
|
||||
}
|
||||
const schema_ptr& schema() const {
|
||||
return _schema;
|
||||
}
|
||||
friend inline bool operator==(const result_set& x, const result_set& y);
|
||||
friend std::ostream& operator<<(std::ostream& out, const result_set& rs);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user