| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Eve::PgSqlConnection; |
|
2
|
|
|
|
|
|
|
|
|
3
|
8
|
|
|
8
|
|
45
|
use parent qw(Eve::Class); |
|
|
8
|
|
|
|
|
20
|
|
|
|
8
|
|
|
|
|
49
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
8
|
|
|
8
|
|
420
|
use strict; |
|
|
8
|
|
|
|
|
19
|
|
|
|
8
|
|
|
|
|
222
|
|
|
6
|
8
|
|
|
8
|
|
41
|
use warnings; |
|
|
8
|
|
|
|
|
35
|
|
|
|
8
|
|
|
|
|
195
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
8
|
|
|
8
|
|
19788
|
use DBI; |
|
|
8
|
|
|
|
|
170676
|
|
|
|
8
|
|
|
|
|
1753
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 NAME |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
B - a class for PostgreSQL connection. |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
my $pgsql_connection = Eve::PgSqlConnection->new( |
|
17
|
|
|
|
|
|
|
host => 'localhost', port => '5432', database => 'somedb', |
|
18
|
|
|
|
|
|
|
user => 'someuser', password => 'somepassword', schema => 'someschema'); |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
B is an adapter class for PostgreSQL |
|
23
|
|
|
|
|
|
|
connection. It adapts B's database handle with B driver |
|
24
|
|
|
|
|
|
|
and encapsulates connection establishing mechanisms and confuguring |
|
25
|
|
|
|
|
|
|
practices. |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head3 Attributes |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=over 4 |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=item C |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
a service attribute containing a data base handle (not for regular |
|
34
|
|
|
|
|
|
|
use). |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=back |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head3 Constructor arguments |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=over 4 |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=item C |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=item C |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=item C |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=item C |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=item C |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=item C |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=back |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
For default argument values see the B documentation. |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 METHODS |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head2 B |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=cut |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub init { |
|
65
|
0
|
|
|
0
|
1
|
|
my ($self, %arg_hash) = @_; |
|
66
|
0
|
|
|
|
|
|
Eve::Support::arguments( |
|
67
|
|
|
|
|
|
|
\%arg_hash, |
|
68
|
|
|
|
|
|
|
my ($host, $port, $database, $user, $password, $schema) = |
|
69
|
|
|
|
|
|
|
(\undef) x 6); |
|
70
|
|
|
|
|
|
|
|
|
71
|
0
|
|
0
|
|
|
|
$self->{'dbh'} = DBI->connect( |
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
72
|
|
|
|
|
|
|
'dbi:Pg:dbname='.($database or '').';host='.($host or ''). |
|
73
|
|
|
|
|
|
|
';port='.($port or ''), $user, $password, |
|
74
|
|
|
|
|
|
|
{ |
|
75
|
|
|
|
|
|
|
RaiseError => 1, ShowErrorStatement => 1, AutoCommit => 1, |
|
76
|
|
|
|
|
|
|
pg_server_prepare => 1, pg_enable_utf8 => 1 |
|
77
|
|
|
|
|
|
|
}); |
|
78
|
|
|
|
|
|
|
|
|
79
|
0
|
|
|
|
|
|
return; |
|
80
|
|
|
|
|
|
|
} |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=over 4 |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=item L |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=item L |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=item L |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=back |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Copyright 2012 Igor Zinovyev. |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
|
99
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
|
100
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 AUTHOR |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=over 4 |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=item L |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=back |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=cut |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
1; |