Parse::Dia::SQL3pm
Convert dia class diagrams into sql.
Usage
use Parse::Dia::SQL;my $dia = Parse::Dia::SQL->new(file => 't/data/TestERD.dia',db => 'db2');print $dia->get_sql();# or command-line versionperl parsediasql --file t/data/TestERD.dia --db db2
Overview
Dia is a diagram creation program for Linux, Unix and Windows released under the GNU General Public License.
Parse::Dia::SQL converts Dia class diagrams into SQL.
Parse::Dia::SQL is the parser that interprets the .dia file(s) into an internal datastructure.
Parse::Dia::SQL::Output (or one of its sub classes) can take the datastructure and generate the SQL statements it represents.
Modelling howto
See <http://tedia2sql.tigris.org/usingtedia2sql.html>
Modelling differences from tedia2sql
- •
-
Index options are supported. Text is taken from the comments field of the operation, i.e. the index. A database specific default value is used if the comments field is left blank. Consult the Output sub class' constructor.
- •
-
Type mapping is supported. A type mapping is a user-defined column name replacement. Unlike tedia2sql the type mapping is non-recursive. Consult
"t/data/typemap.dia"for an example.
- •
-
Preliminary support for Dia's database shapes is added.
- •
-
Table comments are used as table postfix options. This means per-table options (e.g. partitioning options) are supported on a per-database level.
- •
-
backticks notation is supported for MySQL-InnoDB.
Dia versions
Parse::Dia::SQL has been tested with Dia versions 0.93 - 0.97.
Parse::Dia::SQL uses the XML "version" tag information in the .dia input file to determine how each XML construct is formatted. Future versions of Dia may change the internal format, and XML "version" tag is used to detect such changes.
Database support
The following databases are supported:
- DB2
- Informix
- Ingres
- Oracle
- Postgres
- Sas
- SQLite3
- SQLite3fk (with foreign key support)
- Sybase
- MySQL InnoDB
- MySQL MyISAM
Adding support for additional databases means to create a subclass of Parse::Dia::SQL::Output.
Patches are welcome.
Support
You can find documentation for this module with the perldoc command.
perldoc Parse::Dia::SQL
You can also look for information at:
- •
-
Project home
Documentation and public source code repository:
<http://tedia2sql.tigris.org/>
- •
-
RT: CPAN's request tracker
<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Parse-Dia-SQL>
- •
-
AnnoCPAN: Annotated CPAN documentation
<http://annocpan.org/dist/Parse-Dia-SQL>
- •
-
CPAN Ratings
<http://cpanratings.perl.org/d/Parse-Dia-SQL>
- •
-
Search CPAN
<http://search.cpan.org/dist/Parse-Dia-SQL>
Acknowledgements
See the AUTHORS file.
Terminology
By database we mean relational database management system (RDBMS).
Methods
new()-
The constructor. Mandatory arguments:
file - The .dia file to parsedb - The target database typeDies if target database is unknown or unsupported.
get_sql()-
Return sql for given db. Calls underlying methods that performs parsing and sql generation.
Releases
8 releases since Debian 6.0 (Squeeze); the text changed 6 times.