rdm-compile

Schema compiler tool

Synopsis

rdm-compile [OPTION]… dbname.sdl

Description

rdm-compile is a command-line utility that compiles a database definition into a platform-agnostic binary catalog file. It can optionally generate C and C++ source and header files that can be included in an application. The generated files will always be written to the current working directory even though the input file was specified with a path. This behavior makes it possible to use the tool in an out-of-source build environment.

Options

-h, --help Display this usage information
--version Display the version information
-q, --quiet Quiet mode. No information will be displayed
-x, --cxx-api Generate C++ API source and header files. The generated files will be nameddbname_api.cppanddbname_api.hrespectively. This option implies the--catalogand--c-structsoptions.
--include-dir=path Location of the RDM include directory. This option only affects the generated Doxygen file when--cxx-apiis specified.
--lc-cxx-methods Use lower case for part of C++ method names derived from the schema
--locale=locale The string collation locale the database will use (Seelocale)
-a, --catalog Generate internal catalog source header files. The generated files will be nameddbname_cat.canddbname_cat.hrespectively.
-s, --c-structs Generate database header file. The generated file will be nameddbname_structs.h. The file is not necessary if an application only uses SQL to access the database.
--lc-struct-members Use lower case for struct members in the generated C-struct file
--uc-struct-members Use upper case for struct members in the generated C-struct file
--namespace=text Prefixtexttodbnamefor all generated files
dbname.sdl Name of database definition file (.sdl)

The dbname is used as a part of the generated files names for C/C++ files. You should avoid using characters that may be invalid for these file names when naming the dbname.sdl file.

Usage Examples

The usage examples assume that bookshop.sdl contains the following table definition:

CREATE TABLE author (
    last_name CHAR(13) PRIMARY KEY,
    full_name CHAR(25),
    gender CHAR(1),
    yr_born SMALLINT,
    yr_died SMALLINT,
    short_bio VARCHAR(216),
    KEY yob_gender_key(yr_born, gender)
);

Compiling an RDM database catalog

You can run rdm-compile to compile a database definition file into an RDM database catalog file.

$ rdm-compile bookshop.sdl

An RDM database catalog file named bookshop.cat will be created as the result.

Generating source and header files

A number of command-line options are provided with rdm-compile to generate source and header files that can be included or embedded in an application.

$ rdm-compile --c-structs --catalog bookshop.sdl

The header file, bookshop_structs.h, will contain the structure definition of the database. The catalog source header files, bookshop_cat.c and bookshop_cat.h, will contain the text definition of the database catalog and its entry point.