The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

DB::Introspector::Base::ForeignKey

SYNOPSIS

 use DB::Introspector;

 my $introspector = DB::Introspector->get_instance($dbh);

 my $table = $introspector->find_table('users');

 foreach my $foreign_key ($table->foreign_keys) {

    print "Foreign Key name:\t".$foreign_key->name."\n";

    print "Foreign Key local table:\t".$foreign_key->local_table->name."\n";

    print "Foreign Key foreign table:\t".$foreign_key->foreign_table->name."\n";

 }

     

DESCRIPTION

DB::Introspector::Base::ForeignKey is a class that represents a table's foreign key. The 'local_table' is the table that depends on the foreign table. This (local_table) can be considered the child table because data in the local table depends on the existence of data in the foreign table.

ABSTRACT METHODS

$foreign_key->foreign_table

    Returns: The table that the 'local_table' depends on.

$foreign_key->foreign_column_names

    Returns: an array (@) of foreign column names in order such that they can be mapped to the local column names.

$foreign_key->local_column_names

    Returns: an array (@) of local column names in order such that they can be mapped to the foreign column names.

METHODS

DB::Introspector::Base::ForeignKey->new($local_table);

    Params:

      $local_table - a DB::Introspector::Base::Table instance

    Returns: an instance of a DB::Introspector::Base::ForeignKey

$foreign_key->local_table

    Returns: The child table in this foreign key relationship

SEE ALSO

AUTHOR

Masahji C. Stewart

COPYRIGHT

The DB::Introspector::Base::ForeignKey module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.