Subsections
Annexes
A simple example
Here is a simple example that can be found
in examples/C++Binding/schema-oriented/share/schema.odl:
enum CivilState {
Lady = 0x10,
Sir = 0x20,
Miss = 0x40
};
class Address {
attribute string street;
attribute string<32> town;
attribute string country;
index on street;
};
class Person {
attribute string name;
attribute int age;
attribute Address addr;
attribute Address other_addrs[];
attribute CivilState cstate;
attribute Person * spouse inverse Person::spouse;
attribute set<Car *> cars inverse owner;
attribute array<Person *> children;
int change_address(in string street, in string town,
out string oldstreet, out string oldtown);
index on name;
};
class Car {
attribute string brand;
attribute int num;
Person *owner inverse cars;
};
class Employee extends Person {
attribute long salary;
};
A more complex example
Here is a more complex example used for the management of biological
databases:
enum StatusType {
running = 0,
done = 1
};
class File {
attribute string path;
attribute string name;
attribute string desc;
attribute set<Import_ctx *> imported_in inverse Import_ctx::file;
constraint<notnull, propagate=on> on name;
};
class Import_ctx {
attribute File * file inverse File::imported_in;
attribute Import * import inverse Import::contexts;
attribute StatusType status;
attribute string comment;
attribute int32 count;
attribute int32 elapsed;
attribute float average;
attribute string start_date;
attribute string last_update;
constraint<notnull, propagate=on> on file;
constraint<notnull, propagate=on> on import;
};
class Import {
attribute Db * related_db inverse Db::imports;
attribute string database_name;
attribute string cvs_tag;
attribute set<Import_ctx *> contexts inverse Import_ctx::import;
attribute string comment;
attribute bool deletable;
instance_method <client, called_from=OQL> time_interval getElapsed()
constraint<unique, propagate=on> on database_name;
constraint<notnull, propagate=on> on database_name;
constraint<unique, propagate=on> on cvs_tag;
constraint<notnull, propagate=on> on related_db;
index< propagate=on> on database_name;
index< propagate=on> on cvs_tag;
};
class Db {
attribute string name;
attribute string title;
attribute int32 version;
attribute set<Import *> imports inverse Import::related_db;
attribute array<File *> files;
attribute set<Db *> divisions;
attribute Import * official;
instance_method <client, called_from=OQL> string [] get_db_names();
constraint<unique, propagate=on> on name;
constraint<notnull, propagate=on> on name;
index< propagate=on> on name;
};
The eyedbodl usage
The usage of the eyedbodl is as follows:
eyedbodl --gencode=C++ [--package=<package>] [--output-dir=<dirname>] [--output-file-prefix=<prefix>]
[--schema-name=<schname>] [--namespace=<namespace>] [--class-prefix=<prefix>]
[--db-class-prefix=<dbprefix>] [--attr-style=implicit|explicit] [--dynamic-attr]
[--gen-class-stubs] [--class-enums=yes|no] [--c-suffix=<suffix>] [--h-suffix=<suffix>]
[--export] [--down-casting=yes|no] [--gencode-error-policy=status|exception] [--attr-cache=yes|no]
[--rootclass=<rootclass>] [--no-rootclass] [--cpp=<cpp>] [--cpp-flags=<flags>]
[--no-cpp] <odlfile>|-|-d <dbname>|--database=<dbname> [<openflags>]
eyedbodl --gencode=Java --package=<package> [--output-dir=<dirname>] [--output-file-prefix=<prefix>]
[--schema-name=<schname>] [--class-prefix=<prefix>] [--db-class-prefix=<dbprefix>]
[--attr-style=implicit|explicit] [--dynamic-attr] [--down-casting=yes|no]
[--gencode-error-policy=status|exception] [--cpp=<cpp>] [--cpp-flags=<flags>]
[--no-cpp] <odlfile>|-|-d <dbname>|--database=<dbname> [<openflags>]
eyedbodl --gencode=ODL -d <dbname>|--database=<dbname> [--system-class]
[-o <odlfile>] [<openflags>]
eyedbodl --diff -d <dbname>|--database=<dbname> [--system-class] [<openflags>] [--cpp=<cpp>]
[--cpp-flags=<flags>] [--no-cpp] <odlfile>|-
eyedbodl -u|-update -d <dbname>|--database=<dbname> [--db-class-prefix=<dbprefix>] [<openflags>]
[--schema-name=<schname>] [--rmv-undef-attrcomp=yes|no] [--update-index=yes|no]
[--cpp=<cpp>] [--cpp-flags=<flags>] [--no-cpp] [--rmcls={<class>}] [--rmsch] [<odlfile>|-]
eyedbodl --checkfile <odlfile>|-
eyedbodl --help
One must specify one and only one of the following major options:
--gencode=C++ Generates C++ code
--gencode=Java Generates Java code
--gencode=ODL Generates ODL
--update|-u Updates schema in database <dbname>
--diff Displays the differences between a database schema and an odl file
--checkfile Check input ODL file
--help Displays the current information
The following options must be added to the --gencode=C++ or Java option:
<odlfile>|-|-d <dbname>|--database=<dbname> Input ODL file (or - for standard input) or the database name
The following options can be added to the --gencode=C++ or Java option:
--package=<package> Package name
--output-dir=<dirname> Output directory for generated files
--output-file-prefix=<prefix> Ouput file prefix (default is the package name)
--class-prefix=<prefix> Prefix to be put at the begining of each runtime class
--db-class-prefix=<prefix> Prefix to be put at the begining of each database class
--attr-style=implicit Attribute methods have the attribute name
--attr-style=explicit Attribute methods have the attribute name prefixed by get/set (default)
--schema-name=<schname> Schema name (default is <package>)
--export Export class instances in the .h file
--dynamic-attr Uses a dynamic fetch for attributes in the get and set methods
--down-casting=yes Generates the down casting methods (the default)
--down-casting=no Does not generate the down casting methods
--attr-cache=yes Use a second level cache for attribute value
--attr-cache=no Does not use a second level cache for attribute value (the default)
For the --gencode=C++ option only
--namespace=<namespace> Define classes with the namespace <namespace>
--c-suffix=<suffix> Use <suffix> as the C file suffix
--h-suffix=<suffix> Use <suffix> as the H file suffix
--gen-class-stubs Generates a file class_stubs.h for each class
--class-enums=yes Generates enums within a class
--class-enums=no Do not generate enums within a class (default)
--gencode-error-policy=status Status oriented error policy (the default)
--gencode-error-policy=exception Exception oriented error policy
--rootclass=<rootclass> Use <rootclass> name for the root class instead of the package name
--no-rootclass Does not use any root class
The following options can be added to the --gencode=ODL option:
--system-class Generates system class ODL
The following option must be added to the --update|-u option:
-d <dbname>|--database=<dbname> Database for which operation is performed
The following options can be added to the --update|-u option:
<odlfile>|- Input ODL file or '-' (standard input)
--schema-name=<schname> Schema name (default is package)
--db-class-prefix=<prefix> Prefix to be put at the begining of each database class
--rmv-undef-attrcomp=yes|no Removes (yes) or not (no) the undefined attribute components
(constraint, index and implementation). Default is no
--update-index=yes|no Updates (yes) or not (no) the index with a different
implementation in the DB. Default is no
--rmcls={<class>} Removes the given class list
--rmsch Removes the entire schema
The following options must be added to the --diff option:
-d <dbname>|--database=<dbname> Database for which the schema difference is performed
<odlfile> The input ODL file for which the schema difference is performed
The following options can be added to the --diff option:
--system-class Performs difference on system classes also
The following option must be added to the --checkfile option:
<odlfile>|- Input ODL file or '-' (standard input)
The following options can be added when an <odlfile> is set:
--cpp=<cpp> Uses <cpp> preprocessor instead of the default one
--cpp-flags=<cpp-flags> Adds <cpp-flags> to the preprocessing command
--no-cpp Does not use any preprocessor
Common Options:
-U <user>|@, --user=<user>|@ User name
-P [<passwd>], --passwd[=<passwd>] Password
--host=<host> eyedbd host
--port=<port> eyedbd port
--inet Use the tcp_port variable if port is not set
--dbm=<dbmfile> EYEDBDBM database file
--conf=<conffile> Configuration file
--logdev=<logfile> Output log file
--logmask=<mask> Output log mask
--logdate=on|off Control date display in output log
--logtimer=on|off Control timer display in output log
--logpid=on|off Control pid display in output log
--logprog=on|off Control progname display in output log
--error-policy=<value> Control error policy: status|exception|abort|stop|echo
--trans-def-mag=<magorder> Default transaction magnitude order
--arch Display the client architecture
-v, --version Display the version
--help-eyedb-options Display this message
EyeDB manual