/usr/local/perl/lib/site_perl/5.8.5/DB/Introspector.pm


NAME

DB::Introspector


SYNOPSIS

 use DB::Introspector;
 
 my $introspector = DB::Introspector->get_instance($dbh);
 
 my $table = $introspector->find_table('foo');
 
 print $table->name;
 # showing the table's indexes
 foreach my $index ($table->indexes) {
     print $index->name.": (".join(",",$index->column_names).")\n";
 }
 # showing the table's foreign keys
 foreach my $foreign_key ($table->foreign_keys) {
     print $foreign_key->foreign_table->name;
     print join(",",$foreign_key->foreign_column_names);
 }
 # showing foreign keys that reference this table ('foo')
 foreach my $foreign_key ($table->dependencies) {
     print "Some other table :".$foreign_key->local_table->name
          ." is pointing to me\n";
 }
 
 my @tables = $introspector->find_all_tables;
 # you can do other cool stuff; just read the docs.


DESCRIPTION

DB::Introspector looks into database metadata and derives detailed table level and foreign key information in a way that conforms to a collection common interfaces across all dbs. The DB::Introspector::Utils::* classes take advantage of these common interfaces in order to carry out relationship traversal algorithms (like finding the column level and table level mappings between two indirectly related tables).


ABSTRACT METHODS

$introspector->find_table($table_name)

Params:

$table_name - the name of the table that you wish to find

Returns: DB::Introspector::Base::Table

$introspector->find_all_tables

Returns: An array (@) of DB::Introspector::Base::Table instances for each table that exists in the database.


METHODS

DB::Introspector->get_instance($dbh)

Params:

$dbh - An instance of a DBI database handle.

Returns: DB::Introspector instance

$introspector->dbh

Returns: A DBI database handle instance (DBI::db).


SEE ALSO

the DB::Introspector::Base::Table manpage

the DB::Introspector::Base::ForeignKey manpage

the DB::Introspector::Utils::RelInspect manpage

the DB::Introspector::Base::BooleanColumn manpage

the DB::Introspector::Base::CharColumn manpage

the DB::Introspector::Base::Column manpage

the DB::Introspector::Base::DateTimeColumn manpage

the DB::Introspector::Base::IntegerColumn manpage

the DB::Introspector::Base::StringColumn manpage

the DBI manpage


AUTHOR

Masahji C. Stewart


COPYRIGHT

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

 /usr/local/perl/lib/site_perl/5.8.5/DB/Introspector.pm