Class::DBI::ColumnGrouper(3pm) User Contributed Perl Documentation Class::DBI::ColumnGrouper(3pm)NAME
Class::DBI::ColumnGrouper - Columns and Column Groups
SYNOPSIS
my $colg = Class::DBI::ColumnGrouper->new;
$colg->add_group(People => qw/star director producer/);
my @cols = $colg->group_cols($group);
my @all = $colg->all_columns;
my @pri_col = $colg->primary;
my @essential_cols = $colg->essential;
DESCRIPTION
Each Class::DBI class maintains a list of its columns as class data. This provides an interface to that. You probably don't want to be
dealing with this directly.
METHODS
new
my $colg = Class::DBI::ColumnGrouper->new;
A new blank ColumnnGrouper object.
clone
my $colg2 = $colg->clone;
Clone an existing ColumnGrouper.
add_column / find_column
$colg->add_column($name);
my Class::DBI::Column $col = $colg->find_column($name);
Add or return a Column object for the given column name.
add_group
$colg->add_group(People => qw/star director producer/);
This adds a list of columns as a column group.
group_cols / groups_for
my @colg = $cols->group_cols($group);
my @groups = $cols->groups_for(@cols);
This returns a list of all columns which are in the given group, or the groups a given column is in.
columns_in
my @cols = $colg->columns_in(@groups);
This returns a list of all columns which are in the given groups.
all_columns
my @all = $colg->all_columns;
This returns a list of all the real columns.
primary
my $pri_col = $colg->primary;
This returns a list of the columns in the Primary group.
essential
my @essential_cols = $colg->essential;
This returns a list of the columns in the Essential group.
perl v5.12.4 2005-09-14 Class::DBI::ColumnGrouper(3pm)
Check Out this Related Man Page
Class::DBI::Pg(3pm) User Contributed Perl Documentation Class::DBI::Pg(3pm)NAME
Class::DBI::Pg - Class::DBI extension for Postgres
SYNOPSIS
use strict;
use base qw(Class::DBI::Pg);
__PACKAGE__->set_db(Main => 'dbi:Pg:dbname=dbname', 'user', 'password');
__PACKAGE__->set_up_table('film');
DESCRIPTION
Class::DBI::Pg automate the setup of Class::DBI columns and primary key for Postgres.
select Postgres system catalog and find out all columns, primary key and SERIAL type column.
create table.
CREATE TABLE cd (
id SERIAL NOT NULL PRIMARY KEY,
title TEXT,
artist TEXT,
release_date DATE
);
setup your class.
package CD;
use strict;
use base qw(Class::DBI::Pg);
__PACKAGE__->set_db(Main => 'dbi:Pg:dbname=db', 'user', 'password');
__PACKAGE__->set_up_table('cd');
This is almost the same as the following way.
package CD;
use strict;
use base qw(Class::DBI);
__PACKAGE__->set_db(Main => 'dbi:Pg:dbname=db', 'user', 'password');
__PACKAGE__->table('cd');
__PACKAGE__->columns(Primary => 'id');
__PACKAGE__->columns(All => qw(id title artist release_date));
__PACKAGE__->sequence('cd_id_seq');
METHODS
set_up_table TABLENAME HASHREF
Declares the Class::DBI class specified by TABLENAME. HASHREF can specify options to when setting up the table.
ColumnGroup
You can specify the column group that you want your columns to be in.
$class->set_up_table($table, { ColumnGroup => 'Essential' });
The default is 'All'
Primary
Overrides primary key setting. This can be useful when working with views instead of tables.
pg_version
Returns the postgres version that you are currently using.
AUTHOR
Daisuke Maki "dmaki@cpan.org"
AUTHOR EMERITUS
Sebastian Riedel, "sri@oook.de" IKEBE Tomohiro, "ikebe@edge.co.jp"
LICENSE
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
SEE ALSO
Class::DBI Class::DBI::mysql DBD::Pg
perl v5.10.1 2006-07-09 Class::DBI::Pg(3pm)