File: README

package info (click to toggle)
libclass-dbi-pg-perl 0.06-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 56 kB
  • ctags: 8
  • sloc: perl: 67; makefile: 41
file content (61 lines) | stat: -rw-r--r-- 1,475 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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');

AUTHOR
    Sebastian Riedel, "sri@oook.de"

AUTHOR EMERITUS
    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