NAME
DB::Introspector::Base::Table
SYNOPSIS
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";
}
DESCRIPTION
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.
ABSTRACT METHODS
- $table->primary_key
-
Returns: an array (@) of DB::Introspector::Base::Column instances foreach column in the primary key of this $table instance
- $table->columns
-
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.
- $table->foreign_keys
-
Returns: an array (@) of DB::Introspector::Base::ForeignKey instances.
- $table->dependencies
-
Returns: an array (@) of DB::Introspector::Base::ForeignKey instances from the child tables to this table instance.
METHODS
- DB::Introspector::Base::Table->new($table_name, $owner_name)
- $introspector->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.
- $table->name
-
Returns: the name of this table
- $table->owner
-
Returns: the name of the owner of this table
- $table->column_names
-
Returns: an array (@) of the names of the columns in assumed database order
- $table->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.
- $table->column($column_name)
-
Returns: the DB::Introspector::Base::Column instance for the column name $column_name
- $table->foreign_key_names
-
Returns: an array (@) of the names of the foreign_keys in assumed database order
- $table->foreign_key($foreign_key_name)
-
Returns: the DB::Introspector::Base::ForeignKey instance for the foreign_key name $foreign_key_name
- $table->is_primary_key_column($column)
-
Param:
$column - DB::Introspector::Base::Column instance
Returns: 1 if $column is a primary key column and 0 otherwise.
- $table->is_primary_key_column_name($column_name)
-
Returns: 1 if $column_name is a primary key column name and 0 otherwise.
- $table->non_primary_key_columns
-
Returns: an array (@) of non primary key columns
SEE ALSO
AUTHOR
Masahji C. Stewart
COPYRIGHT
The DB::Introspector::Base::Table module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 344:
You forgot a '=back' before '=head1'