NAME
FabForce::DBDesigner4 - Parse/Analyse XML-Files created by DBDesigner 4 (FabForce)
SYNOPSIS
my $designer = FabForce::DBDesigner4->new();
$designer ->parsefile( xml => 'KESS.xml' );
$designer ->writeXML( 'text_xml.xml' );
$designer ->writeSQL( 'text_sql.sql' );
|
DESCRIPTION
FabForce::DBDesigner4 is a module to analyse xml-files created by the Database-Design tool DBDesigner (Version 4) from FabForce (http://www.fabforce.net).
You can also parse simple .sql-files to get the table structures off CREATE-statements.
METHODS
new
my $designer = FabForce::DBDesigner4->new();
|
parsefile
parse the input file (either SQL or XML (FabForce-format))
$designer ->parsefile( xml => 'KESS.xml' );
$designer ->parsefile( sql => 'database.sql' );
|
writeXML
prints the structure into a xml-file (FabForce-format)
$designer ->writeXML( 'foo.xml' );
|
writeSQL
print the structure into a sql-file
$designer ->writeSQL( 'foo.sql' );
|
getTables
returns an array of table-objects
my @tables = $designer ->getTables();
|
getSQL
returns an array of CREATE statements. One element for each table.
my @creates = $designer ->getSQL();
|
DBDesigner4::Table
Each table is an object which contains information about the columns, the relations and the keys.
Methods of the table-objects
name
$table ->name( 'tablename' );
my $name = $table ->name();
|
columns
my @array = ({ 'column1' => [ 'int' , 'not null' ]});
$table ->columns(\ @array );
print $_ , "\n" for ( $table ->columns());
|
columnType
my $datatype = $table ->columnType(3);
|
columnInfo
print Dumper( $table ->columnInfo(4));
|
stringsToTableCols
my @columns = ( 'col1 varchar(255) primary key' , 'col2 int not null' );
my @array = $table ->stringsToTableCols( @columns );
|
addColumn
my $column = [ 'column1' , 'int' , 'not null' ];
$table ->addColumn( $column );
|
relations
my @relations = ([1, 'startTable.startCol' , 'targetTable.targetCol' ]);
$table ->relations(\ @relations );
print $_ , "\n" for ( $table ->relations());
|
addRelation
$table ->addRelation([1, 'startTable.startCol' , 'targetTable.targetCol' ]);
|
removeRelation
$table ->removeRelation(2);
|
key
$table ->key([ 'prim1' ]);
print "the primary key contains these columns:\n" ;
print $_ , "\n" for ( $table ->key());
|
DEPENDENCIES
This module requires XML::Twig, XML::Writer and IO::File
This module is still in development so feel free to contact me and send me bugreports or comments on this module.
SEE ALSO
XML::Twig
XML::Writer
IO::File
|
AUTHOR
Renee Baecker, <module@renee-baecker.de>
COPYRIGHT AND LICENSE
Copyright (C) 2005 by Renee Baecker
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.6.1 or, at your option, any later version of Perl 5 you may have available.