[odb-users] Problem building query with multiple shared objects

Quentin Deldycke quentindeldycke at gmail.com
Tue Jun 24 07:52:50 EDT 2014


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