[odb-users] Nested pointers in relationship

Nicholas Cremonesi nicholas.cremonesi at gmail.com
Thu Mar 12 09:01:43 EDT 2015


I founded an old request like mine:
"Hi,

I have a problem using ODB in a particular situation:

I have this sort of code:

*class A*
*{*
*std::string valuea;*
*}*

*class B*
*{*
*std::string valueb*

*shared_ptr<A> obja;*
*}*

*class C*
*{*
*shared_ptr<B> objb;*
*}*

All these objects are build using odb without any problems.

But my final source file fail with such type of code:

*odb::query<C> qry(odb::query<C>::objb->obja->valuea == "Test");*

It declares an error saying that "odb::query<C>::objb->obja" is not a
pointer type.

Does ODB support multiple nesting like this? (tables creation goes
correctly and the whole architecture seems ok)
Is there an error in my syntax?

Here is the exact error.

*..*/../*../../build/gen/odb/classes/OTCaracteristiqueCharge-query.cpp:9:63:
error: base operand of ‘->’ has non-pointer type ‘const Support_*type*_ {aka
const odb::mysql::query_column<long unsigned int,
(odb::mysql::database_type_id)7u>}’*
*                q_OTCaracteristiqueCharge::Identifiant->Support->Reference
== "ABCD"*

*q_OTCaracteristiqueCharge *is a typedef to
odb::query<OTCaracteristiqueCharge>
The complete architecture is the same as described as example.

-- 

Deldycke Quentin"


More information about the odb-users mailing list