Newer Older
70 lines | 1.683kb
add Oracle, DB2, Pg,
yuki-kimoto authored on 2009-11-16
1
package DBIx::Custom::Pg;
packaging one directory
yuki-kimoto authored on 2009-11-16
2
use base 'DBIx::Custom::Basic';
3

            
4
use warnings;
5
use strict;
6

            
7
my $class = __PACKAGE__;
8

            
9

            
10
sub connect {
11
    my $self = shift;
12
    
add port and host method
yuki-kimoto authored on 2009-11-16
13
    if (!$self->data_source) {
14
        my $database = $self->database;
15
        my $host     = $self->host;
16
        my $port     = $self->port;
17
        
18
        my $data_source = "dbi:Pg:";
19
        my $data_source_original = $data_source;
20
        $data_source .= "dbname=$database;" if $database;
21
        $data_source .= "host=$host;"       if $host;
22
        $data_source .= "port=$port;"       if $port;
23
        
24
        $data_source =~ s/:$// if $data_source eq $data_source_original;
25
        $self->data_source($data_source);
packaging one directory
yuki-kimoto authored on 2009-11-16
26
    }
27
    
28
    return $self->SUPER::connect;
29
}
30

            
31
=head1 NAME
32

            
add Oracle, DB2, Pg,
yuki-kimoto authored on 2009-11-16
33
DBIx::Custom::Pg - DBIx::Custom PostgreSQL implementation
packaging one directory
yuki-kimoto authored on 2009-11-16
34

            
35
=head1 Synopsys
36

            
37
=head1 See DBIx::Custom and DBI::Custom::Basic documentation
38

            
39
This class is L<DBIx::Custom::Basic> subclass,
40
and L<DBIx::Custom::Basic> is L<DBIx::Custom> subclass.
41

            
42
You can use all methods of L<DBIx::Custom::Basic> and <DBIx::Custom>
43
Please see L<DBIx::Custom::Basic> and <DBIx::Custom> documentation.
44

            
45
=head1 Object methods
46

            
47
=head2 connect
48

            
49
    This method override DBIx::Custom::connect
50
    
51
    If database attribute is set, automatically data source is created and connect
52

            
add Oracle, DB2, Pg,
yuki-kimoto authored on 2009-11-16
53
=head2 last_insert_id
54

            
packaging one directory
yuki-kimoto authored on 2009-11-16
55
=head1 Author
56

            
57
Yuki Kimoto, C<< <kimoto.yuki at gmail.com> >>
58

            
59
Github L<http://github.com/yuki-kimoto>
60

            
61
I develope this module L<http://github.com/yuki-kimoto/DBIx-Custom>
62

            
63
=head1 Copyright & license
64

            
65
Copyright 2009 Yuki Kimoto, all rights reserved.
66

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

            
70