[odb-users] abstract objects and the data member pragma 'table'

Marcel Nehring mne at qosmotec.com
Tue Mar 31 08:08:15 EDT 2015


Hi all,

in my code I have an ODB abstract class with a data member of a container type.

PRAGMA_DB(unordered table("CUSTOM_NAME") id_column("FOO_ID") value_column("BAR_ID"))
std::vector<Bar> m_bars;

When I try to specify a custom table name for the table that should be used to store the contents of the
container member, this results in an ODB error when generating the schema (note the identical line numbers).

Foo.h:156:26: error: table name 'CUSTOM_NAME' conflicts with an already defined table name
Foo.h:156:26: info: conflicting table is defined here
Foo.h:156:26: info: use #pragma db table to change its name

Is there a way to avoid this? For example when I don't specify a custom name ODB generates the table name from the class name of the derived, non-abstract class and the member's name. What I would like is to have my custom name prefixed with the non-abstract class' name, for example. I would like to avoid the need to specify the custom name in each derived class.

Regards,
                Marcel


More information about the odb-users mailing list