diff --git a/db/legacy_schema_tables.cc b/db/legacy_schema_tables.cc index 1cc65aaa2a..6531c30183 100644 --- a/db/legacy_schema_tables.cc +++ b/db/legacy_schema_tables.cc @@ -403,7 +403,7 @@ std::vector ALL { KEYSPACES, COLUMNFAMILIES, COLUMNS, TRIGGERS, USE auto schema = proxy.get_db().local().find_schema(system_keyspace::NAME, schema_table_name); auto map = [&proxy, schema_table_name] (sstring keyspace_name) { return read_schema_partition_for_keyspace(proxy, schema_table_name, keyspace_name); }; auto insert = [] (schema_result&& result, auto&& schema_entity) { - if (schema_entity.second) { + if (!schema_entity.second->empty()) { result.insert(std::move(schema_entity)); } return std::move(result); diff --git a/query-result-set.cc b/query-result-set.cc index 04d173bb22..0e62fb6ddc 100644 --- a/query-result-set.cc +++ b/query-result-set.cc @@ -6,6 +6,22 @@ namespace query { +std::ostream& operator<<(std::ostream& out, const result_set_row& row) { + for (auto&& cell : row._cells) { + auto&& type = cell.second.type(); + auto&& value = cell.second.value(); + out << cell.first << "=\"" << type->decompose(value) << "\" "; + } + return out; +} + +std::ostream& operator<<(std::ostream& out, const result_set& rs) { + for (auto&& row : rs._rows) { + out << row << std::endl; + } + return out; +} + result_set_builder::result_set_builder(schema_ptr schema) : _schema{schema} { } diff --git a/query-result-set.hh b/query-result-set.hh index b06dc9e328..8ba8835fb3 100644 --- a/query-result-set.hh +++ b/query-result-set.hh @@ -59,6 +59,7 @@ public: } friend inline bool operator==(const result_set_row& x, const result_set_row& y); friend inline bool operator!=(const result_set_row& x, const result_set_row& y); + friend std::ostream& operator<<(std::ostream& out, const result_set_row& row); }; inline bool operator==(const result_set_row& x, const result_set_row& y) { @@ -88,6 +89,7 @@ public: return _rows[idx]; } friend inline bool operator==(const result_set& x, const result_set& y); + friend std::ostream& operator<<(std::ostream& out, const result_set& rs); }; inline bool operator==(const result_set& x, const result_set& y) { diff --git a/types.hh b/types.hh index d990fa0584..e7b19710df 100644 --- a/types.hh +++ b/types.hh @@ -308,7 +308,7 @@ public: inline bool operator==(const data_value& x, const data_value& y) { - return x._type == y._type && x._type->equal(x._type->decompose(x._value), y._type->decompose(y._value)); + return x._type->equals(y._type) && x._type->equal(x._type->decompose(x._value), y._type->decompose(y._value)); } inline bool operator!=(const data_value& x, const data_value& y)