[odb-users] recursive loading

MM finjulhich at gmail.com
Fri Jun 22 09:38:52 EDT 2018


On 20 June 2018 at 13:51, MM <finjulhich at gmail.com> wrote:

> On 18 June 2018 at 13:37, Boris Kolpackov <boris at codesynthesis.com> wrote:
>
> > MM <finjulhich at gmail.com> writes:
> >
> > > Is it possible to have the pre-load c++ callback of myclass issue
> > > another db.load<myclass>( another_id )
> >
> > Yes.
> >
> >
> > > I'm having a core dump in this situation.
> >
> > Must be a bug somewhere.
>
>
> Sorry, it's not in the pre-load. I have it in the post-load callback.
> In fact, I see that in the post-load cb:
>     db.load<myclass>(another_id)
> instantiates a object, but it is empty. It appears it calls in the
> generated odb code:
>
>        sts.delay_load (id, obj, ig.position ());
>
> Apparently, the auto_lock is not locked.
>
> Does any of this make sense?
>

An update here.
In the post-load callback, I've replaced the call to
     db.load<myclass>(another_id)
     //// returns an object but it remains empty
     //// tracer shows that a SELECT query is issued indeed

with
     auto res = db.query<myclass>(  query::id == another_id);
     for (auto& obj: res)
        //// obj is correctly populated here

It seems db.load() inside of post-load callback of the 1st db.load()
doesn't work. But db.query does.

MM


More information about the odb-users mailing list