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

Adnan RIHAN axel50397 at gmail.com
Wed Apr 15 09:37:01 EDT 2015


Hi Boris,

On 15 avril 2015 at 14:35:15, Boris Kolpackov
(boris at codesynthesis.com(mailto:boris at codesynthesis.com)) wrote:

> FYI, a composite column name is constructed by concatenating the
> composite member name and the inner member name ("o" in your case).

That’s what I thought.

> So the question is whether the schema that was produced by the
> ODB compiler is incorrect or the mapping to an existin schema
> is incorrect.

For me, these 2 « problems » are the same. The mapping could be
miswrote, which makes ODB produce an incorrect schema. Or, as using an
Entity as a Key isn’t supported yet, the compiler can also misinterpret
the pragmas.

Here is a workaround I’ve found 2 minutes ago (line 3):
# ifdef     ODB_COMPILER
#   pragma  db  value(OfferKey)
#   pragma  db  member(OfferKey::o)             table("invoice_carts")
 column("")

#   pragma  db  model                           version(1, 1, open)
#   pragma  db  object(Invoice)                 table("invoices")
#   pragma  db  member(Invoice::m_cart)         table("invoice_carts") \
                                                id_column("invoice_id") \
                                                key_column("offer_id") \
                                                key_type("UNSIGNED INT") \
                                                value_column("quantity")
[...]
# endif

With this, the columns in « *-odb.cxx » are correct (and taken from the
member(Invoice::m_cart) line)

Thank you.
-- 
Cordialement, Adnan RIHAN.
Directeur-Gérant de Eolis-Software, société de services informatiques.

GPG: 5675-62BA (https://keybase.io/max13/key.asc)
-> Si vous n'utilisez pas GPG mais souhaitez quand même m’envoyer un
e-mail chiffré: (https://encrypt.to/0x567562BA).

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 882 bytes
Desc: OpenPGP digital signature
Url : http://codesynthesis.com/pipermail/odb-users/attachments/20150415/d9432b03/signature.pgp


More information about the odb-users mailing list