[odb-users] Problem building query with multiple shared objects

Boris Kolpackov boris at codesynthesis.com
Tue Jun 24 08:33:27 EDT 2014


Hi Quentin,

Quentin Deldycke <quentindeldycke at gmail.com> writes:

> odb::query<C> qry(odb::query<C>::objb->obja->valuea == "Test");

ODB only supports one level of indirection in object queries. If
you need to do several levels, then you will have to use a view.
Views allow you to create an arbitrary-long custom JOIN chain
based on object relationships:

#pragma db view object(C) object(B) object(A)
struct C_View
{
  ...
};

odb::query<C_View> qry(odb::query<C_View>::A::valuea == "Test");

Boris



More information about the odb-users mailing list