tedia2sql Brief Help


tedia2sqlrc file

Some of these options can be specified in a $HOME/.tedia2sqlrc file (or, optionally, "tedia2sqlrc" stored in the same path as the tedia2sql executable).

Commandline arguments always override preferences specified in the rcfile.

-h: The Barebones Help

When you run tedia2sql with the -h commandline switch, you will get a short help that looks like the following.

tedia2sql -- vX.YY.ZZ Copyright (c)2002 by Tim Ellis <tim[dot]ellis[at]gamet[dot]com>

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2. This program is copyrighted!

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

Usage: /home/time/bin/tedia2sql -i xmlIn -o sqlOut
    [-t dbType] [-v {1 | 2}]
    [-s] [-d] [-h]

-i xmlIn XML File to parse, should be created by Dia
-o sqlOutName of output -- don't give extension, .sql will be appended
-t dbTypeType of database to gen SQL for (informix, ingres, postgres, mysql, mssql, sybase, oracle, db2)
-s Separate constraint drops, constraints, table drops, tables into separate SQL output files
-d Add 'drop' syntax to SQL output file
-v {1 | 2} Verbosity level, 1=verbose, 2=very verbose
-h This help, copyright, and licensing information

vX.YY.ZZ -- Version

The version of tedia2sql you are running. The X means the major revision. If tedia2sql is completely rewritten or uses a new set of libraries to achieve its goals, the X will be incremented by one. If YY is ODD, then you are using a development (unstable or untested) version of the script. If it is EVEN, you are using a stable, tested version.

Copyright and License

This script is not public domain. It is a copyrighted script licensed under the GNU GPL version 2. Note specifically this slightly varies from the standard method of licensing GPL scripts in that you cannot use a later version of the GPL at your discretion. This is licensed as version 2 of the GPL, the text of which is included in the file LICENSE which is distributed with tedia2sql.

-i: Input File

The input file must be a Dia UML diagram created by Dia version 0.90 or greater. tedia2sql detects if the file is compressed with gzip or not.

-o: Output File Format

tedia2sql will parse the filename you pass it for a BASE (what appears before the final dot) and extension (what appears after the final dot) and will generate output files accordingly. You should just pass to -o what you feel is intuitive, and it should do the right thing. If you pass the -s commandline option, you will get more than one SQL DDL file. See the section on -s.

-t: Database SQL DDL Type

tedia2sql supports multiple databases. To select which database to output for, pass one of the following on the commandline:

-s: Separate the Add, Drop, Constraint, and Table Scripts

When you specify the -s option, there will be multiple files created (four if you pass the -d option, two if you don't) to specify adds, drops, constraints, and table names in separate files. Each file will be prefixed with the word you pass to the -o option, and will have an extension of the extension you pass to the -o option.

Each SQL script generated will have a "1st" "2nd"... etc in the filename so that when sorted ASCIIbetically, a parent script will know in which order to run the SQL scripts. Also, if you look at the filenames, you will know in which order to run the scripts.

If you do not pass the -s option, then you will only ever get one file with all statements in the order tedia2sql thinks is best:

  1. Drop constraints
  2. Drop tables
  3. Create tables
  4. Insert data
  5. Create constraints and indexes
Because the script doesn't have any intelligence about the order in which it creates the INSERT statements (ie: fulfill foreign-key constraints), it must create the constraints after it inserts the data. If you don't like this idea (ie: you're using constraints to make sure your data is correct), then you can pass the -s option and run the scripts in the order you choose.

-d: Create drop statements

If you want to drop each constraint and table before you create them, pass this option to the script. Note that if you also pass -s that the drop statements will appear in their own SQL DDL file.

-v: Verbosity Level

If you would like to see what the script is doing while it runs via printing to STDOUT, then pass -v 1. Sometimes, if the script is malfunctioning, then a developer might ask you to run the script with -v 2 which will put even more debugging output to STDOUT. You will probably not be interested in either of these options unless you plan on changing the tedia2sql script.