| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Pgtools::Connection; |
|
2
|
2
|
|
|
2
|
|
22141
|
use strict; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
42
|
|
|
3
|
2
|
|
|
2
|
|
6
|
use warnings; |
|
|
2
|
|
|
|
|
1
|
|
|
|
2
|
|
|
|
|
41
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
327
|
use parent qw(Class::Accessor); |
|
|
2
|
|
|
|
|
232
|
|
|
|
2
|
|
|
|
|
9
|
|
|
6
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors(qw(dbh host port user password database)); |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub set_args { |
|
9
|
|
|
|
|
|
|
my $self = shift; |
|
10
|
|
|
|
|
|
|
my ($option) = @_; |
|
11
|
|
|
|
|
|
|
my @tmp = split(/,/, $option, -1); |
|
12
|
|
|
|
|
|
|
if($#tmp != 4) { |
|
13
|
|
|
|
|
|
|
die "Invalid arguments.\nPlease check pg_config_diff -help\n"; |
|
14
|
|
|
|
|
|
|
} |
|
15
|
|
|
|
|
|
|
$self->set("host", $tmp[0]) if $tmp[0] ne ''; |
|
16
|
|
|
|
|
|
|
$self->set("port", $tmp[1]) if $tmp[1] ne ''; |
|
17
|
|
|
|
|
|
|
$self->set("user", $tmp[2]) if $tmp[2] ne ''; |
|
18
|
|
|
|
|
|
|
$self->set("password", $tmp[3]) if $tmp[3] ne ''; |
|
19
|
|
|
|
|
|
|
$self->set("database", $tmp[4]) if $tmp[4] ne ''; |
|
20
|
|
|
|
|
|
|
} |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub create_connection { |
|
23
|
|
|
|
|
|
|
my $self = shift; |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
$self->set("dbh", DBI->connect( |
|
26
|
|
|
|
|
|
|
"dbi:Pg:dbname=".$self->database.";host=".$self->host.";port=".$self->port, |
|
27
|
|
|
|
|
|
|
$self->user, |
|
28
|
|
|
|
|
|
|
$self->password |
|
29
|
|
|
|
|
|
|
)) or die "$!\n Error: failed to connect to DB.\n"; |
|
30
|
|
|
|
|
|
|
} |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
1; |