[odb-users] Generate DDL and DML methods in separate output files.
pstath at axxcelera.com
Fri Feb 24 11:31:33 EST 2012
Separate the DDL and DML methods generated by ODB into separate source modules.
The management of the database (DDL) and editing of data (DML) needs to be separated
into different processes and/or libraries.
The files generated by ODB when the schema format is "embedded" contain a number
of create_schema() methods that perform DDL like management actions to drop (optionally)
and create the required tables, indexes and constraints of the persistent classes in the database.
If I want to package my object model classes and ODB generated classes into a library for
third party use, the ODB generated classes contain functions that will allow the tables
in the database to be dropped and recreated!
May not be something you want to provide in a third party library.
In addition, for a complex object model with many persistent ODB classes, there is a
significant amount for DDL strings in the create_schema() methods that will be stored
in the .text segment of the program, and only be used if the database schema needs to
be created. (The first time the program is run.)
In an embedded environment, this would be a waste of memory.
I would expect that during device startup, the database would be checked to see if the
Schema is properly initialized. If not, the database schema is created and then the
Schema update program exits.
The program that is used to manipulate the data model objects can be run, without having
all of the DDL statements unnecessarily loaded into the .text segment of that program.
More information about the odb-users