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 if the input file was specified with a path. This behavior makes it possible to use the tool in an out-of-source build environment.

Using file names or literals with embedded spaces, special characters, or something that can conflict with C/C++ reserved words or content in system header files may result in generated files that will fail to compile on one or more platforms.

Options

-h, --help Display this usage information
--version Display the version information
-q, --quiet Quiet mode. No information will be displayed
-x, --cpp-api Generate C++ API files
-X, --cpp Generate C++ files
--include-prefix=path Prefix for RDM include directory. This option only affects the generated source/header filies when '--cpp-api' is specified.
--include-path=path Full path location of the RDM include directory. This option only affects the generated doxygen file when '--cpp-api' is specified.
--lc-cpp-methods Use lower case for part of C++ method names derived from the schema
-a, --catalog Generate internal catalog C/H files
-s, --c-structs Generate database header file. This 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=namespace Prefix 'namespace' to dbname for all generated files
--key-ex Generate EX classes with constructors for key structs
dbname.sdl Name of SQL DDL Script file

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.