Subsections
The eyedbodl tool
The eyedbodl tool can be used to:
- update a database from an ODL file:
- create a schema
- add methods, triggers, constraints, indexes to classes
- remove methods, triggers, constraints, indexes to classes
- add classes
- remove classes
- add attributes
- rename attributes
- remove attributes
- remove classes
- generate C++ stubs from an ODL file or a database containing
a schema
- generate Java stubs from an ODL file or a database containing
a schema
- generate ODL from a database containing a schema
- display the differences between an ODL file and a database
schema
- check an ODL file syntax
For instance, let schema.odl an ODL file and dbtest
a database.
Updating a schema
To update a database from an ODL file:
eyedbodl -u -d dbtest schema.odl
or:
eyedbodl --update --database=dbtest schema.odl
Important notes:
- All classes defined in the ODL file will be added to the
existing schema in the database
- The classes in the database and not in the ODL file will not
be removed from the database
- To remove a class from a database, one must use the
-rmcls=class option. Because of class dependancies,
the removal of a class can fail because one needs to remove
other classes, for instance collection classes of the class one want
to remove.
In this case, one must delete classes in the good order.
- To remove a entire schema from a database, on must use
the -rmsch option
- The methods, triggers, constraint and indexes
in the ODL file and not in the database will be added to the database
- The methods, triggers, constraint and indexes in the databae
and not in the ODL file will not be removed from the database
unless the -rmv-undex-attrcomp=yes option is given
- The common indexes (on same attributes) in the ODL file and in the
database with a different implementation will not be updated unless
the -update-index=yes is given
- A class C defined in the ODL and in the database with
different attributes will have the following behavior:
- an attribute a in a class C of the ODL, not
in the class C of the database will be automatically added to the
class C in the database
- an attribute a in a class C in the database, not
in the class C in ODL will be automatically removed from
the class C in the database: This operation is not undoable
- an attribute a in a class C in the database and
in the class C in ODL with different types will lead
to an update failure
Generates C++ code
To generate the C++ API from an ODL file:
eyedbodl --gencode=C++ schema.odl
To generate the C++ API from a database:
eyedbodl --gencode=C++ --package=schema -d dbtest
For a given package.odl ODL file, the generated files are as follows:
- package.h, package.cc: the generated C++ API to be used in
a client program
- template_package.cc: an example of a client program using the generated
API
- Makefile.package: an example of Makefile to compile package.cc and
template_package.cc: make -f Makefile.package will compile
and link the generated API and template files
- packagestubsfe.cc, packagestubsbe.cc: stubs for client and server methods
- packagemthfe-skel.cc, packagemthbe-skel.cc: skeletons for
client and server methods
Generates Java code
To generate the Java API from an ODL file:
eyedbodl --gencode=Java schema.odl
To generate the Java API from a database:
eyedbodl --gencode=Java --package=schema -d dbtest
For a given package.odl ODL file,
the package directory contains a Java file for each class
defined in the ODL file plus a Java file for each collection template
class used as an attribute in classes of the ODL file.
Generates ODL
To generate the ODL from a database:
eyedbodl --gencode=ODL -d dbtest # generates on the standard ouput
eyedbodl --gencode=ODL -d dbtest -o schema.odl
Display schema differences
To display the difference between a schema in an ODL file and a database
schema:
eyedbodl --diff schema.odl -d dbtest
Checking the syntax of an ODL file
To check the syntax of an ODL file:
eyedbodl --checkfile schema.odl
Beside these major options, eyedbodl has a lot of extra options as
described when running eyedbodl with the -help option.
EyeDB manual