Dave Rolsky > Fey > Fey::FK

Download:
Fey-0.40.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  3
Open  2
View/Report Bugs
Module Version: 0.40   Source  

NAME ^

Fey::FK - Represents a foreign key

VERSION ^

version 0.40

SYNOPSIS ^

  my $fk = Fey::FK->new( source => $user_id_from_user_table,
                         target => $user_id_from_department_table,
                       );

DESCRIPTION ^

This class represents a foreign key, connecting one or more columns in one table to columns in another table.

METHODS ^

This class provides the following methods:

Fey::FK->new()

This method constructs a new Fey::FK object. It takes the following parameters:

$fk->source_table()

$fk->target_table()

Returns the appropriate Fey::Table object.

$fk->source_columns()

$fk->target_columns()

Returns the appropriate list of Fey::Column objects as an array reference.

$fk->column_pairs()

Returns an array reference. Each element of this reference is in turn a two-element array reference of Fey::Column objects, one from the source table and one from the target.

$fk->has_tables( $table1, $table2 )

This method returns true if the foreign key includes both of the specified tables. The tables can be specified by name or as Fey::Table objects.

$fk->has_column($column)

Given a Fey::Column object, this method returns true if the foreign key includes the specified column.

$fk->is_self_referential()

This returns true if the the source and target tables for the foreign key are the same table.

$fk->pretty_print()

Returns a stringified representation of the foreign key in a pretty layout something like this:

  User      Message
  -------   -------
  user_id   user_id

BUGS ^

See Fey for details on how to report bugs.

AUTHOR ^

Dave Rolsky <autarch@urth.org>

COPYRIGHT AND LICENSE ^

This software is Copyright (c) 2011 by Dave Rolsky.

This is free software, licensed under:

  The Artistic License 2.0 (GPL Compatible)
syntax highlighting: