[odb-users] Querying on Containers

Lukas Obermann obermann.lukas at gmail.com
Sun Oct 9 10:43:24 EDT 2016


Hi Boris,

so, object loading works like a charm on the vectors. Thanks! But still
can't figure out how to access the element in ClassC in the query. Can you
help on that?

Thanks,
Lukas

Lukas Obermann <obermann.lukas at gmail.com> schrieb am Fr., 7. Okt. 2016 um
17:21 Uhr:

> Thanks,
>
> about the distinct, do I have to place this once at the end or after each
> object?
>
>
>
> Boris Kolpackov <boris at codesynthesis.com> schrieb am Fr., 7. Okt. 2016 um
> 17:07 Uhr:
>
> Hi Lukas,
>
> Lukas Obermann <obermann.lukas at gmail.com> writes:
>
> > class main
> > {
> >   odb::lazy_shared_ptr<ClassA> ptr_a;
> >   std::vector< odb::lazy_shared_ptr<ClassA> > list_a;
> >   std::vector< odb::lazy_shared_ptr<ClassB> > ptr_b
> > }
> >
> > class ClassA
> > {
> >   std::string iNeedToBeQueried;
> > }
> >
> > class ClassB
> > {
> >   std::string iNeedToBeQueried;
> >   odb::lazy_shared_ptr<ClassC> ptr_c;
> > }
> >
> > class ClassC
> > {
> >   std::string iNeedToBeQueried;
> > }
>
> So you have containers of pointers -- this is even easier.
>
>
> > So, ptr_a is no issue, but I am not able to figure out how to add the two
> > vectors to the view and also access ClassC, all at the same time.
>
> You just add their classes to the view. Check this earlier thread, it
> is exactly the same problem:
>
> http://codesynthesis.com/pipermail/odb-users/2016-August/003412.html
>
> Boris
>
>


More information about the odb-users mailing list