| 1 | package ObjectDB::DBHPool; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 5 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 5 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 5 | our $VERSION = '3.27'; | |||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 5 | require Carp; | |||||||||||||||||||||||||||
| 9 | 5 | ▶ | use ObjectDB::DBHPool::Connection; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | sub new { | ||||||||||||||||||||||||||||
| 12 | 0 | ▶ | my $class = shift; | ||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 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 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
dbh: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | # From DBIx::Connector | ||||||||||||||||||||||||||||
| 34 | 0 | my $pid_tid = $$; | |||||||||||||||||||||||||||
| 35 | $pid_tid .= '_' . threads->tid | ||||||||||||||||||||||||||||
| 36 | 0 | ▶ | if exists $INC{'threads.pm'} && $INC{'threads.pm'}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $INC{"threads.pm"} and $INC{"threads.pm"}
MC/DC0%0/2
exists $INC{"threads.pm"} and $INC{"threads.pm"}
exists $INC{"threads.pm"}
$INC{"threads.pm"}
Truth table0%0/3
A and B
A= exists $INC{"threads.pm"}B= $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 | ▶ | ); | ||||||||||||||||||||||||||
|
Condition0%0/3
$self->{"connections"}{$pid_tid} ||= "ObjectDB::DBHPool::Connection"->new("check_timeout", $self->{"check_timeout"}, "dsn", $self->{"dsn"}, "username", $self->{"username"}, "password", $self->{"password"}, "attrs", $self->{"attrs"}, "do", $self->{"do"})
MC/DC0%0/2
$self->{"connections"}{$pid_tid} ||= "ObjectDB::DBHPool::Connection"->new("check_timeout", $self->{"check_timeout"}, "dsn", $self->{"dsn"}, "username", $self->{"username"}, "password", $self->{"password"}, "attrs", $self->{"attrs"}, "do", $self->{"do"})
$self->{"connections"}{$pid_tid}
"ObjectDB::DBHPool::Connection"->new("check_timeout", $self->{"check_timeout"}, "dsn", $self->{"dsn"}, "username", $self->{"username"}, "password", $self->{"password"}, "attrs", $self->{"attrs"}, "do", $self->{"do"})
Truth table0%0/3
A ||= B
A= $self->{"connections"}{$pid_tid}B= "ObjectDB::DBHPool::Connection"->new("check_timeout", $self->{"check_timeout"}, "dsn", $self->{"dsn"}, "username", $self->{"username"}, "password", $self->{"password"}, "attrs", $self->{"attrs"}, "do", $self->{"do"})
| |||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | 0 | return $connection->dbh; | |||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | 5 | 1; | |||||||||||||||||||||||||||