[odb-users] Sharing common object between multiple ODB schemas
Per Edin
per.edin at sequence-point.se
Mon Oct 14 16:12:46 EDT 2019
Hi!
I'm having two different sets of ODB schemas in my application, core and extras.
// core/user.hxx
//
#include <my-app/uuid.hxx>
namespace core {
#pragma db my_app::object
class user {
#pragma db id
uuid id;
// ...
};
}
// extras/profile.hxx
//
#include <my-app/uuid.hxx>
namespace my_app::extras {
#pragma db object
class profile {
#pragma db id
uuid id;
// ...
};
}
// uuid.hxx
//
namespace my_app {
#pragma db value
class uuid {
// ...
};
}
I process these and the other files in core/ and extras/ like this:
odb ... --at-once --schema-name core core/core.hxx
odb ... --at-once --schema-name extras extras/extras.hxx
core/core.hxx and extras/extras.hxx includes all headers belonging to
the respective schemas.
As can be seen the uuid class is shared between the two schemas. Can
you recommend a way to handle this? Currently, the database code for
class my_app::uuid ends up in both core-odb._xx and profile-odb._xx
resulting in duplicate symbols.
I guess I could just copy uuid.hxx to both core/ and extras/ but that
doesn't feel right.
A part from sharing some value types, the two schemas are completely unrelated.
Kind regards
Per Edin
Sequence Point AB
More information about the odb-users
mailing list