query-result-set.hh: Add comparison operators

Schema merging code needs to be able to compare two result sets to
determine if a keyspace, for example, has changed. Add comparison
operators for that.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
This commit is contained in:
Pekka Enberg
2015-05-26 13:41:05 +03:00
parent 446555f2de
commit 6ed0d8c0e4

View File

@@ -57,8 +57,18 @@ public:
}
throw null_column_value(column_name);
}
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);
};
inline bool operator==(const result_set_row& x, const result_set_row& y) {
return x._schema == y._schema && x._cells == y._cells;
}
inline bool operator!=(const result_set_row& x, const result_set_row& y) {
return !(x == y);
}
// Result set is an in-memory representation of query results in
// deserialized format. To obtain a result set, use the result_set_builder
// class as a visitor to query_result::consume() function.
@@ -77,8 +87,13 @@ public:
}
return _rows[idx];
}
friend inline bool operator==(const result_set& x, const result_set& y);
};
inline bool operator==(const result_set& x, const result_set& y) {
return x._rows == y._rows;
}
// Result set builder is passed as a visitor to query_result::consume()
// function. You can call the build() method to obtain a result set that
// contains cells from the visited results.