line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package ObjectDB::DBHPool; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
34
|
use strict; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
142
|
|
4
|
5
|
|
|
5
|
|
25
|
use warnings; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
217
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '3.28'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
require Carp; |
9
|
5
|
|
|
5
|
|
2109
|
use ObjectDB::DBHPool::Connection; |
|
5
|
|
|
|
|
17
|
|
|
5
|
|
|
|
|
1035
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new { |
12
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
13
|
0
|
|
|
|
|
|
my (%params) = @_; |
14
|
|
|
|
|
|
|
|
15
|
0
|
|
|
|
|
|
my $self = {}; |
16
|
0
|
|
|
|
|
|
bless $self, $class; |
17
|
|
|
|
|
|
|
|
18
|
0
|
|
|
|
|
|
$self->{check_timeout} = $params{check_timeout}; |
19
|
0
|
|
|
|
|
|
$self->{dsn} = $params{dsn}; |
20
|
0
|
|
|
|
|
|
$self->{username} = $params{username}; |
21
|
0
|
|
|
|
|
|
$self->{password} = $params{password}; |
22
|
0
|
|
|
|
|
|
$self->{attrs} = $params{attrs}; |
23
|
0
|
|
|
|
|
|
$self->{do} = $params{do}; |
24
|
|
|
|
|
|
|
|
25
|
0
|
|
|
|
|
|
$self->{connections} = {}; |
26
|
|
|
|
|
|
|
|
27
|
0
|
|
|
|
|
|
return $self; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub dbh { |
31
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# From DBIx::Connector |
34
|
0
|
|
|
|
|
|
my $pid_tid = $$; |
35
|
|
|
|
|
|
|
$pid_tid .= '_' . threads->tid |
36
|
0
|
0
|
0
|
|
|
|
if exists $INC{'threads.pm'} && $INC{'threads.pm'}; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
my $connection = $self->{connections}->{$pid_tid} ||= ObjectDB::DBHPool::Connection->new( |
39
|
|
|
|
|
|
|
check_timeout => $self->{check_timeout}, |
40
|
|
|
|
|
|
|
dsn => $self->{dsn}, |
41
|
|
|
|
|
|
|
username => $self->{username}, |
42
|
|
|
|
|
|
|
password => $self->{password}, |
43
|
|
|
|
|
|
|
attrs => $self->{attrs}, |
44
|
|
|
|
|
|
|
do => $self->{do}, |
45
|
0
|
|
0
|
|
|
|
); |
46
|
|
|
|
|
|
|
|
47
|
0
|
|
|
|
|
|
return $connection->dbh; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
1; |