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

Quentin Deldycke quentindeldycke at gmail.com
Tue Jun 24 09:08:32 EDT 2014

Hi Boris,

Firstly, thanks for your fast and helpfull answer.
Sadly, this solution is not the best for me, but i think it will be ok.

I will create a view containing only the members of my query (3-4 out of
25+ fields) + the id of the "root" object. Then, I will be able to use this
id to regenerate a complete object if needed.

Thanks for your help!

Deldycke Quentin

On 24 June 2014 14:33, Boris Kolpackov <boris at codesynthesis.com> wrote:

> 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