1Class::DBI::Pg(3)     User Contributed Perl Documentation    Class::DBI::Pg(3)
2
3
4

NAME

6       Class::DBI::Pg - Class::DBI extension for Postgres
7

SYNOPSIS

9         use strict;
10         use base qw(Class::DBI::Pg);
11
12         __PACKAGE__->set_db(Main => 'dbi:Pg:dbname=dbname', 'user', 'password');
13         __PACKAGE__->set_up_table('film');
14

DESCRIPTION

16       Class::DBI::Pg automate the setup of Class::DBI columns and primary key
17       for Postgres.
18
19       select Postgres system catalog and find out all columns, primary key
20       and SERIAL type column.
21
22       create table.
23
24        CREATE TABLE cd (
25            id SERIAL NOT NULL PRIMARY KEY,
26            title TEXT,
27            artist TEXT,
28            release_date DATE
29        );
30
31       setup your class.
32
33        package CD;
34        use strict;
35        use base qw(Class::DBI::Pg);
36
37        __PACKAGE__->set_db(Main => 'dbi:Pg:dbname=db', 'user', 'password');
38        __PACKAGE__->set_up_table('cd');
39
40       This is almost the same as the following way.
41
42        package CD;
43
44        use strict;
45        use base qw(Class::DBI);
46
47        __PACKAGE__->set_db(Main => 'dbi:Pg:dbname=db', 'user', 'password');
48        __PACKAGE__->table('cd');
49        __PACKAGE__->columns(Primary => 'id');
50        __PACKAGE__->columns(All => qw(id title artist release_date));
51        __PACKAGE__->sequence('cd_id_seq');
52

METHODS

54       set_up_table TABLENAME HASHREF
55
56       Declares the Class::DBI class specified by TABLENAME. HASHREF can spec‐
57       ify options to when setting up the table.
58
59       ColumnGroup
60           You can specify the column group that you want your columns to be
61           in.
62
63              $class->set_up_table($table,  { ColumnGroup => 'Essential' });
64
65           The default is 'All'
66
67       Primary
68           Overrides primary key setting. This can be useful when working with
69           views instead of tables.
70
71       pg_version
72
73       Returns the postgres version that you are currently using.
74

AUTHOR

76       Daisuke Maki "dmaki@cpan.org"
77

AUTHOR EMERITUS

79       Sebastian Riedel, "sri@oook.de" IKEBE Tomohiro, "ikebe@edge.co.jp"
80

LICENSE

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

SEE ALSO

86       Class::DBI Class::DBI::mysql DBD::Pg
87
88
89
90perl v5.8.8                       2006-07-09                 Class::DBI::Pg(3)
Impressum