# The mcocomp Schema Compiler

> To express the content and organization of a database for C/C++ applications, the database designer uses the eXtremeDB Data Definition Language (DDL) to create a database schema. The schema is a textual description of the data model. It is processed by the eXtremeDB schema compiler, which ensures that the schema is syntactically correct and then generates the application programming interface (API) header (`database_name.h`) and implementation (`database_name.c`) files. When the application is compiled the database dictionary for the database is produced from the implementation file. The database dictionary is simply a binary form of the schema that the eXtremeDB runtime uses.

> The DDL compiler is executed as follows:

>         mcocomp [OPTIONS] ddlspec

> where ddlspec is the name of the text file containing the schema. It can follow any naming convention of your choice, but we customarily use the file extension ‘.mco’.

> The `mcocomp` options are as follows:

> OPTION

> DESCRIPTION

> -p, -P <path>

> Specifies the output directory. If the directory is not specified, the files are written to the ddlspec file directory

> -i, -I <path>

> Specifies the include directory. If this path is not specified the compiler will look only in the ddlspec file directory

> -hpp, -c++, -C++

> Generates a C++ implementation file (.hpp)

> -smartptr

> Generates smart accessor methods for C++ interface

> -cs [namespace]

> Generates C# class definitions, optionally within a namespace

> -java [package]

> Generates a Java interface

> -sa [typename]

> Suppress the generation of the API for classes (for use with the UDA API)

> -si

> Specifies verbose structure initialization. By default, the compiler generates code of the form:

>                                     struct A { int i; int j; };
>                                     A a = {3,4};

> Some C compilers will not accept this form of structure initialization so the si switch will generate code of the form:

>                                     struct A { int i; int j; };
>                                     A a;
>                                     a.i = 3;
>                                     a.j = 4;

> -c, -C, -compact

> Specifies the “compact” option for all classes in the database. 2-byte offsets will be used for structures, variable length, optional and sequence fields in each class, and all objects are limited in size to 64K (excluding BLOBs & sequences)

> -nonatomic

> -atomic

> Specifies that all transient classes are "nonatomic" when using the `MURSIW` transaction manager. This modifier changes the way an instance of the non-atomic class is handled in transactions. Normally, for an atomic class (the default), when a program requests an update operation on an object of this class, the runtime (1) makes a working copy of the instance, (2) puts the instance on the transaction list, and (3) removes the instance from any indexes. This takes time. In some cases, the full processing is not required, so for "nonatomic" classes, the runtime skips steps (1) and (2) and does (3) only if an indexed field is going to be updated. This breaks ACID property of the transaction but increases the performance significantly. Please note that no rollback is available for a nonatomic class! (The modifier can be applied to specific classes in the schema as a class modifier like `transient` or `persistent`.) Both The command line options "-nonatomic", and the alternative "-atomic", are applied by `mcocomp` to all classes in the schema.

> -s, -S

> suppress copyright notice and timestamp console output

> -x, -X

> generate XML methods: classname_xml_get, classname_xml_put,

> classname_xml_create, classname_xml_schema

> -x32

> Generate 32-bit pointers. (If neither -x32 or -x64 is specified, the default pointer size is the size of a pointer on the host system.)

> -x64

> Generate 64-bit pointers. (If neither -x32 or -x64 is specified, the default pointer size is the size of a pointer on the host system.)

> -dll

> Generates declspec prefixes for wrapper functions

> -mergeable

> Generates dictionary which can be merged with other dictionaries

> -sql

> Enables SQL extension

> -persistent

> Makes all unspecified classes ‘Persistent’

> -transient

> Makes all unspecified classes ‘Transient’ (default)

> -prefix

> prefixes schema names with the database name

> -nosort

> do not change order of fields (JNI/.NET Framework and DDL compatibility mode)

> -sortschema

> sort alphabetically the schema elements (class names)

> -ws1

> specifies size of wchar_t type on target system as 1 byte

> -ws2

> specifies size of wchar_t type on target system as 2 bytes

> -ws4

> specifies size of wchar_t type on target system as 4 bytes

> -o, -O

> Instructs `mcocomp` to generate the optimized version of the eXtremeDB implementation files; otherwise the default (development) version is generated. The optimized version generates inlined functions or replaces some functions with macros that are put into the implementation header file instead of the implementation ".c" file

> -revno

> Prints the revision number in addition to product build number

> -compiler

> Prints the version of the compiler which has built this utility

> -help

> Prints out usage information for mcocomp.