[odb-users] [Feature Request] odb::query operator== and operator!=
Boris Kolpackov
boris at codesynthesis.com
Fri Nov 6 09:58:01 EST 2015
Hi Markus,
Markus Klemm <markus at markusklemm.net> writes:
> please correct me if I'm wrong, but there seem to be no equality e.g.
> inequality operator defined for odb::query.
You are correct, these operators are not provided for odb::query.
> This would be very helpful, to for instance, decide if loading of
> data is necessary.
While I can see how this can be useful, implementing these operators
properly will be non-trivial, to say the least. For example, would
you expect these two queries to compare equal?
(query::name == "John" && query::age == 18)
(query::age == 18 && query::name == "John")
What about these two:
!(query::name == "John" || query::name == "Jane")
(query::name != "John" && query::name != "Jane")
At the same time, it should be pretty easy to keep the data for
your queries in some "canonical" form/order so that it is easy
to decide whether the two queries are equivalent.
Boris
More information about the odb-users
mailing list