[odb-users] one-to-many relationship question

Lidia Kalinovsky lidia at lemur-soft.com
Wed Aug 13 05:21:30 EDT 2014


Hello

Is it possible to make contained classes ( means one-to-many relationship )
to be loaded with some condition (means, have query for contained ) ?

For example:
Let's say we have 2 classes:

#pragma db...
class A
{
     bool hidden;
};

#pragma db...
class B
{
    bool hidden;

    #pragma db unordered
    std::vector<A>  manyA;
}

to load objects of B, i use

typedef odb::query<T> queryT;
queryT q;
if (!fullLoading)
q = queryT(queryT::hidden != true );

typename odb::core::result<T>  r (m_DB->query<T>(q,true));

This way i have only Bs with hidden=0.

Is it possible to have some condition for loaded A's objects inside manyA
vector inside pragma (means, at compilation) ?
inside dynamic query ?
( i need only A's with hidden=0. condition is constant and i could have a
many contained vectors inside container).

Thanks and regards.
Lidia

-- 
Software integration and outsourcing services,
Lemur-Soft, Giv'at Nili
Israel, 37825
Phone : (+972) 545748325
Fax : (+972) 775345383
Email : lidia at lemur-soft.com
Web: www.lemur-soft.com


More information about the odb-users mailing list