[odb-users] odb::query problem

luca paganotti luca.paganotti at gmail.com
Mon May 3 12:17:20 EDT 2021


thanks for your reply.

Ok for the details directory, however I need to specify each single profile
on odb command line and I get this error "odb: error: unable to locate
options file for profile 'boost'" when I specify -p boost only, but I think
it's a minor problem, better not a problem at all.

As to my source code, I'm afraid I trusted too much the bug icon in
eclipse, it was steady there and went away when I added the second template
parameter so I went on ..., you're right it's not in the docs, my mistake
As off today I think the indexer has done its job and the bug icon it's not
on that line anymore, sorry for the noise, my fault.

Now the code is

odb::transaction t (mydb->begin());

typedef odb::query<myclass> myquery;

mykey kf;
mykey kt;
kf.s = kt.s = strval;
kf.i = kt.i = intval;
kf.t    = from;  // start timestamp
kt.t    = to;    // end timestamp

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>’}

I overloaded >, >=, <=  operators like this one

bool operator < (const mykey& k) const

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

Have a nice day

-- Dott. Ing. Luca Paganotti
-- luca.paganotti at gmail.com
-- https://github.com/lucapaganotti
-- sourceforge email:
-- lucapaganotti at users.sourceforge.net
-- skype name: luca.paganotti
[image: http://it.linkedin.com/in/lucapaganotti]
-- ---------------------------------------------------------------
-- Mistakes are portals of discovery - JAAJ
--- --------------------------------------------------------------

On Mon, May 3, 2021 at 1:01 PM Boris Kolpackov <boris at codesynthesis.com>

> luca paganotti <luca.paganotti at gmail.com> writes:
> > I've tried to use the complete boost profile but odb complains so I
> specify
> > each single profile on the odb command line, more: I'm unable to use the
> > details boost profile as odb compiler complains because it can't find a
> > details.options file.
> > I'm using debian buster which delivers a 2.4 release of odb.
> > I checked in /usr/include/odb/boost/details and the details.options file
> > it's not present meanwhile are present all the other options files.
> Missing
> > something?
> There is no such profile (the details/ subdirectory you are seeing in
> libodb-boost is the library's own implementation details).
> > typedef odb::query<myclass, mykey> myquery;
> Why are you passing mykey as a second template argument to odb::query?
> Have you seen such an instruction anywhere in the documentation (because
> it's wrong and we would want to fix that)?

More information about the odb-users mailing list