/usr/local/perl/lib/site_perl/5.8.5/DB/Introspector/Base/Table.pm |
DB::Introspector::Base::Table
use DB::Introspector; my $table = $introspector->find_table('users');
print "table name is: ".$table->name."\n"; foreach my $column ($table->columns) {
print "column ".$column->name."\n";
} foreach my $foreign_key ($table->foreign_keys) {
print "foreign key (" .join(",",$foreign_key->local_column_names).") -> " .$foreign_key->foreign_table->name." (" .join(",",$foreign_key->foreign_column_names).")\n";
}
DB::Introspector::Base::Table is an abstract class that provides a higher level representation for a database table. This representation includes methods for discovering foreign keys, columns, and more cool stuff.
Returns: an array (@) of DB::Introspector::Base::Column instances foreach column in the primary key of this $table instance
Returns: an array (@) of DB::Introspector::Base::Column instances foreach column in the $table instance, whose assumed order is equivalent to that which is in the database from which they were extracted.
Returns: an array (@) of DB::Introspector::Base::ForeignKey instances.
Returns: an array (@) of DB::Introspector::Base::ForeignKey instances from the child tables to this table instance.
find_table($table_name)
Params:
$table_name - the name of the table being instantiated
$owner_name - the name of the owner of the table.
Returns: a new DB::Introspector::Base::Table instance.
Returns: the name of this table
Returns: the name of the owner of this table
Returns: an array (@) of the names of the columns in assumed database order
primary_key_column($column_name)
Returns: the DB::Introspector::Base::Column instance for the column name $column_name or undef if there exists no primary key column by that name.
column($column_name)
Returns: the DB::Introspector::Base::Column instance for the column name $column_name
Returns: an array (@) of the names of the foreign_keys in assumed database order
foreign_key($foreign_key_name)
Returns: the DB::Introspector::Base::ForeignKey instance for the foreign_key name $foreign_key_name
is_primary_key_column($column)
Param:
$column - DB::Introspector::Base::Column instance
Returns: 1 if $column is a primary key column and 0 otherwise.
is_primary_key_column_name($column_name)
Returns: 1 if $column_name is a primary key column name and 0 otherwise.
Returns: an array (@) of non primary key columns
the DB::Introspector::Base::Column manpage
the DB::Introspector::Base::ForeignKey manpage
Masahji C. Stewart
The DB::Introspector::Base::Table 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/Base/Table.pm |