[odb-users] how to generate two db files with different schemas and embedded into an application

Jed Wu jed.wu at ringcentral.com
Tue Aug 16 02:09:55 EDT 2022



ls -d -1 *.h* | grep -v odb | tr '\n' ' '| xargs odb -I./ --ixx-suffix .ipp -d sqlite --generate-schema --at-once   --std c++11 --generate-query --generate-session --input-name contact --show-sloc

ls -d -1 *.h* | grep -v odb | tr '\n' ' '| xargs odb -I./ --ixx-suffix .ipp -d sqlite --generate-schema --at-once   --std c++11 --generate-query --generate-session --input-name phonenumber --show-sloc


By the commands above, the ODB compiler would generate contact-odb.cxx and phonenumber-odb.cxx, both of cxx files have static create_schema() function.

 namespace odb
{
  static bool
  create_schema (database& db, unsigned short pass, bool drop)
  {
    ODB_POTENTIALLY_UNUSED (db);
    ODB_POTENTIALLY_UNUSED (pass);
    ODB_POTENTIALLY_UNUSED (drop);

    if (drop)
...
}


When calling odb::schema_catalog::create_schema(*db);it always debug into call create_schema() in contact-odb.cxx.
How can I call create_schema() in contact-odb.cxx for contact.db and create_schema in phonenumber-odb.cxx for phonenumber.db?


Hope to hear from you very soon! Thank you!





More information about the odb-users mailing list