The sql2mco Utility

The sql2mcoutility is a simple command-line utility that converts SQL-89 DDL statements statements to the equivalent eXtremeDB DDL. The utility is invoked from the command line as follows:

 
    sql2mco <input-sql-file> <output-mco-file>
 

Formal Grammar

The formal grammar recognized by sql2mco is as follows:

 
    <create table statement> ::=
        CREATE TABLE <table name>
        ( <table element> [ { , <table element> } ... ] )
        <table element> ::=
            <column definition> | <table constraint>
            <column definition> ::=
                <column name> <data type> [ DEFAULT <default value> ] [ <column constraint> [ { , <column constraint > } ... ]
                <column constraint> ::= [ CONSTRAINT <constraint name> ] [ <constraint implementation> ]
                    { <unique column constraint> | <primary key column constraint> |
                    <foreign key column constraint> | <not null constraint> }
                    <unique column constraint> ::= UNIQUE
                    <primary key column constraint> ::= PRIMARY KEY
                    <foreign key column constraint> ::= REFERENCES <table name> [ ( <column name> ) ]
                    <not null constraint> ::= NOT NULL
            <table constraint> ::=  CONSTRAINT <constraint name> ] [ <constraint implementation> ]
                { <unique table constraint> | <primary key table constraint> | <foreign key table constraint> }
                <unique table constraint> ::= UNIQUE ( <column name> [ { , <column name> } ... ] )
                <primary key table constraint> ::= PRIMARY KEY ( <column name> [ { , <column name> } ... ] )
                <foreign key table constraint> ::= FOREIGN KEY ( <column name> [ { , <column name> } ... ] )
            REFERENCES <table name> [ ( <column name> [ { , <column name> } ... ] ) ]
            <constraint implementation> ::={ HASH ( <capacity> ) | TREE } INDEX
             

Example

The following table shows an example of an SQL DDL and the equivalent MCO DDL that it generates.