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 \s-1SERIAL\s0 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 \s-1TABLENAME\s0 \s-1HASHREF\s0

Declares the Class::DBI class specified by \s-1TABLENAME\s0. \s-1HASHREF\s0 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 \*(C`[email protected]\*(C'

AUTHOR EMERITUS

Sebastian Riedel, \*(C`[email protected]\*(C' \s-1IKEBE\s0 Tomohiro, \*(C`[email protected]\*(C'

LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

RELATED TO Class::DBI::Pg…

Class::DBI Class::DBI::mysql DBD::Pg