NAME
Parse::Dia::SQL - Convert Dia class diagrams into SQL.
SYNOPSIS
use Parse::Dia::SQL;
my $dia = Parse::Dia::SQL->new(
file => 't/data/TestERD.dia',
db => 'db2'
);
print $dia->get_sql();
# or command-line version
perl parsediasql --file t/data/TestERD.dia --db db2
DESCRIPTION
Dia is a diagram creation program for Linux, Unix and Windows released under the GPL 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 SQL statements it represents.
MODELLING HOWTO
See http://tedia2sql.tigris.org/usingtedia2sql.html
DATABASE SUPPORT NOTE
The aim is to suppport the same set of databases as tedia2sql.
Adding support for additional databases
Adding support for additional databases means to create a subclass of Parse::Dia::SQL::Output.
Patches are welcome.
AUTHOR
Parse::Dia::SQL is based on tedia2sql by Tim Ellis and others. See the AUTHORS file for details.
Modified by Andreas Faafeng, <aff at cpan.org>
for release on CPAN.
BUGS
Please report any bugs or feature requests to bug-dia-sql at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Dia-SQL. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
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:
RT: CPAN's request tracker
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
SEE ALSO
Parse::Dia::SQL::Output
http://tedia2sql.tigris.org/
http://live.gnome.org/Dia
ACKNOWLEDGEMENTS
See the AUTHORS file.
LICENSE
This program is released under the GNU General Public License.
TERMINOLOGY
By database we mean relational database managment system (RDBMS).
METHODS
new
The constructor. Mandatory arguments:
file - The .dia file to parse
db - The target database type
Dies if target database is unknown or unsupported.
_init_log
Initialize logger
_init_const
Initialize Constants component
_init_utils
Initialize Parse::Dia::SQL::Utils class.
get_output_instance
Return Output subclass.
Some params will be taken from this object unless explicitly set by caller:
classes
associations
small_packages
components
files
Dies if db is unknown.
Note special handling for MySQL with separate sub-subclasses for each storage engine.
convert
Parse the .dia file and create inner representation.
Returns true on success.
Returns undefined if called more than once on the same object.
get_sql
Return sql for given db. Calls underlying methods that performs parsing and sql generation.
_parse_doms
Uncompress the .dia file(s) and parse xml content. Push the parsed xml dom onto the docs list.
Return the number of parsed files.
_get_docs
Returns the parsed xml dom documents (for testing).
_get_nodelist
Create nodelist from dom. Return array of array XML::DOM::NodeList objects.
Each inner array correspond to a separate input file.
get_smallpackages_ref
Accessor
_parse_smallpackages
Got through nodelists and return number of 'SmallPackages' found
_parse_smallpackage
Returns hashref where key is name of SmallPackage and value is its content.
get_classes_ref
Return hashref with parsed classes.
_parse_classes
Returns hashref where key is name of class and value is its content.
get_components_ref
Accessor
_parse_component
Parse a component and take our what is needed to create inserts.
Returns a hash reference.
_parse_class
Parse a CLASS and salt away the information needed to generate its SQL DDL.
Returns a hash reference.
get_associations_ref
Return hashref with parsed associations.
_parse_associations
Scan the nodeList for UML Associations and return them.
_parse_association
Generate the foreign key relationship between two tables: classify the relationship, and generate the necessary constraints and centre (join) tables.
uml_class_lookup
Look up a class given the XML id of the class, taking into account placeholder classes.
generate_many_to_many_association
Generate SQL for a many to many association including generating the centre (join) table.
gen_table_view_sql
Create datastructure that represents gevein Table or View SQL and store in classes reference.
add_centre_cols
Add column descriptors for a centre (join) table to an array of descriptors passed.
generate_one_to_any_association
Generate data for SQL generation for an association where one side has multiplicity one; no additional table is necessary.
save_foreign_key
Save the details of foreign keys for output later (i.e. push onto fk_defs array ref).