[odb-users] How to make a "lazy" QList?

Rene Jensen rene at catatonic.dk
Wed Aug 1 11:57:51 EDT 2012


>
> > Do you have any plans for making a similar way to postpone loading of
> > many-to-many keys and arrays?
>
> Yes, this is on our TODO list. There also doesn't seem to be any
> architectural/technical issues in supporting something like this.
> Container loading is already a separate statement execution so
> doing that at a later time shouldn't be a problem. Probably the
> biggest effort will be to implement lazy variants for all the
> standard, Boost, and Qt containers. Just need to find the time.
>
>
Hi Boris,

Excellent to hear. Now that I have pondered the ramifications of my own
suggestion, I think that making real lazy variants of lists, vectors etc.
might be overdoing it. What is needed is a (programmer-friendly) technique
to control loading of parts of an object. E.g.


  class Author
  { ...
    #pragma db lazyloaded
    QList <QLazySharedPointer<Book> >    authorsBooks;

    #pragma db lazyloaded
    vector<QLazySharedPointer<Article> >  authorsArticles;
    ...
  }

Author* A = ... some default load procedure ... will not load "lazyloaded"
members
A->authorsBooks.size() // 0 ... not loaded

db->load_lazymembers (A);

A->authorsBooks.size() // 34


Regards,
Rene


More information about the odb-users mailing list