Each table is an object which contains information about the columns, the relations and the keys.
Methods of the table-objects
# set the tablename $table->name('tablename'); # get the tablename my $name = $table->name();
# set the tablecolumns my @array = ({'column1' => ['int','not null']}); $table->columns(\@array); # get the columns print $_,"\n" for($table->columns());
# get datatype of n-th column (i.e. 3rd column) my $datatype = $table->columnType(3);
# get info about n-th column (i.e. 4th column) print Dumper($table->columnInfo(4));
# maps column information to hash (needed for columns()) my @columns = ('col1 varchar(255) primary key', 'col2 int not null'); my @array = $table->stringsToTableCols(@columns);
# add the tablecolumn my $column = ['column1','int','not null']; $table->addColumn($column);
# set relations my @relations = ([1,'startTable.startCol','targetTable.targetCol']); $table->relations(\@relations); # get relations print $_,"\n" for($table->relations());
$table->addRelation([1,'startTable.startCol','targetTable.targetCol']);
# removes a relation (i.e. 2nd relation) $table->removeRelation(2);
# set the primary key $table->key(['prim1']); # get the primary key print "the primary key contains these columns:\n"; print $_,"\n" for($table->key());
my @names = $table->column_names print $_,"\n" for @names;
my %foreign_keys = $table->get_foreign_keys; use Data::Dumper; print Dumper \%foreign_keys;
To install FabForce::DBDesigner4, copy and paste the appropriate command in to your terminal.
cpanm
cpanm FabForce::DBDesigner4
CPAN shell
perl -MCPAN -e shell install FabForce::DBDesigner4
For more information on module installation, please visit the detailed CPAN module installation guide.