[odb-users] std::map<Entity, int>

Boris Kolpackov boris at codesynthesis.com
Thu Nov 27 06:46:38 EST 2014


Hi Adnan,

Adnan RIHAN <axel50397 at gmail.com> writes:

> - An Invoice has a Set of QSharedPointer<Cart>.
> - A Cart has 1 struct CartId, 1 quantity (int).
> - A struct CartId is 1 QWeakPointer<Invoice>, 1 QSharedPointer<Offer>.
> - An Offer has 1 QSharedPointer<Product>, 1 price (int).
> - A Product has many properties.

Uh, read this three times and I still can't wrap my head around it.
What happened to keeping things simple?


> > #   pragma  db  value(CartId)               column("")
> > #   pragma  db  value(CartId::m_invoice)    column("invoice_id")
> > #   pragma  db  value(CartId::m_offer)      column("offer_id")

These are all invalid. The column pragma cannot be specified on the
composite value. What you probably want is this:

#pragma db member(CartId::m_invoice) column("invoice_id")
#pragma db member(CartId::m_offer) column("offer_id")

#pragma db member(CartId::m_cardId) column("")

Boris



More information about the odb-users mailing list