[odb-users] odb::query problem

Boris Kolpackov boris at codesynthesis.com
Tue May 4 09:25:25 EDT 2021


luca paganotti <luca.paganotti at gmail.com> writes:

> mydb->erase_query<myclass>(myquery::key_ >= kf && myquery::key_ <= kt);
> 
> anyway g++ complains this way on the last statement:
> 
> error: ‘key_’ is not a member of ‘myquery’ {aka ‘odb::query<myclass>’}

Right, but query::key is, as described in the documentation (ODB
removes data member decorations like `m_` and trailing `_` for
query members).


> So it seems, key_ it's not a member of myquery that instead has a key
> member, using that g++ gives tons of errors mainly saying that operands for
> the overloaded operators are not of the same type
> the first operand is of type
> 
> const odb::query_columns<myclass, (odb::database_id)2,
> odb::access::object_traits_impl<myclass, (odb::database_id)2> >::key_class_
> 
> and the second one is of type mykey.
> 
> As an additional info, I'm able to use the query functions that get a
> std::string as parameter, but it will be nice to be able to use also the
> others.

Key is a composite value (it contains multiple members) so you need
to pick the member you want to compare to, as in, query::key.member.



More information about the odb-users mailing list