Debian Codegraph @

README

raw
1 NAME
2 Class::DBI::Pg - Class::DBI extension for Postgres
3
4 SYNOPSIS
5 use strict;
6 use base qw(Class::DBI::Pg);
7
8 __PACKAGE__->set_db(Main => 'dbi:Pg:dbname=dbname', 'user', 'password');
9 __PACKAGE__->set_up_table('film');
10
11 DESCRIPTION
12 Class::DBI::Pg automate the setup of Class::DBI columns and primary key
13 for Postgres.
14
15 select Postgres system catalog and find out all columns, primary key and
16 SERIAL type column.
17
18 create table.
19
20 CREATE TABLE cd (
21 id SERIAL NOT NULL PRIMARY KEY,
22 title TEXT,
23 artist TEXT,
24 release_date DATE
25 );
26
27 setup your class.
28
29 package CD;
30 use strict;
31 use base qw(Class::DBI::Pg);
32
33 __PACKAGE__->set_db(Main => 'dbi:Pg:dbname=db', 'user', 'password');
34 __PACKAGE__->set_up_table('cd');
35
36 This is almost the same as the following way.
37
38 package CD;
39
40 use strict;
41 use base qw(Class::DBI);
42
43 __PACKAGE__->set_db(Main => 'dbi:Pg:dbname=db', 'user', 'password');
44 __PACKAGE__->table('cd');
45 __PACKAGE__->columns(Primary => 'id');
46 __PACKAGE__->columns(All => qw(id title artist release_date));
47 __PACKAGE__->sequence('cd_id_seq');
48
49 METHODS
50 set_up_table TABLENAME HASHREF
51 Declares the Class::DBI class specified by TABLENAME. HASHREF can
52 specify options to when setting up the table.
53
54 ColumnGroup
55 You can specify the column group that you want your columns to be
56 in.
57
58 $class->set_up_table($table, { ColumnGroup => 'Essential' });
59
60 The default is 'All'
61
62 Primary
63 Overrides primary key setting. This can be useful when working with
64 views instead of tables.
65
66 pg_version
67 Returns the postgres version that you are currently using.
68
69 AUTHOR
70 Daisuke Maki "[email protected]"
71
72 AUTHOR EMERITUS
73 Sebastian Riedel, "[email protected]" IKEBE Tomohiro, "[email protected]"
74
75 LICENSE
76 This library is free software; you can redistribute it and/or modify it
77 under the same terms as Perl itself.
78
79 SEE ALSO
80 Class::DBI Class::DBI::mysql DBD::Pg
81