[odb-users] How to add a table to existing schema without dropping data?

Ella Vishnevsky ellav at checkpoint.com
Tue Jun 7 04:06:35 EDT 2016


I'm using the 2.1.1 odb version .
I have 2  Sqlite files, each containing 2 tables.  I want to add a table to one of them without dropping the data(for example, person table). Is it possible?

The compilation of new file:
odbCompilePath  -d sqlite --generate-query --generate-schema --schema-name schemaName1 person.h && cp person-odb.cxx person-odb.cpp

compilation of existing files:
odbCompilePath  -d sqlite --generate-query --generate-schema --schema-name schemaName1 test1.h && cp test1-odb.cxx test1-odb.cpp
odbCompilePath  -d sqlite --generate-query --generate-schema --schema-name schemaName1 test2.h && cp test2-odb.cxx test2-odb.cpp
odbCompilePath  -d sqlite --generate-query --generate-schema --schema-name schemaName2 test3.h && cp test3-odb.cxx test3-odb.cpp
odbCompilePath  -d sqlite --generate-query --generate-schema --schema-name schemaName2 test4.h && cp test4-odb.cxx test4-odb.cpp

// creating new db:
odb::database *m_db_3 = new odb::sqlite::database("TEST1",SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE);

// creating schema ---> dropping data
odb::schema_catalog::create_schema (*m_db_3," schemaName1 ");

I'm looking for something like : "add table if does not exist"
Is it possible?


More information about the odb-users mailing list