| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
9
|
|
|
9
|
|
69
|
use strict; |
|
|
9
|
|
|
|
|
23
|
|
|
|
9
|
|
|
|
|
418
|
|
|
2
|
9
|
|
|
9
|
|
52
|
use warnings; |
|
|
9
|
|
|
|
|
17
|
|
|
|
9
|
|
|
|
|
636
|
|
|
3
|
9
|
|
|
9
|
|
201
|
use 5.010_001; |
|
|
9
|
|
|
|
|
34
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package # hide from PAUSE |
|
6
|
|
|
|
|
|
|
DBIx::Squirrel::dr; |
|
7
|
|
|
|
|
|
|
|
|
8
|
9
|
|
|
9
|
|
61
|
use DBIx::Squirrel::util qw/confessf/; |
|
|
9
|
|
|
|
|
19
|
|
|
|
9
|
|
|
|
|
562
|
|
|
9
|
9
|
|
|
9
|
|
54
|
use namespace::clean; |
|
|
9
|
|
|
|
|
15
|
|
|
|
9
|
|
|
|
|
89
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
BEGIN { |
|
12
|
9
|
50
|
|
9
|
|
3056
|
require DBIx::Squirrel unless keys(%DBIx::Squirrel::); |
|
13
|
9
|
|
|
|
|
22
|
$DBIx::Squirrel::dr::VERSION = $DBIx::Squirrel::VERSION; |
|
14
|
9
|
|
|
|
|
5349
|
@DBIx::Squirrel::dr::ISA = qw/DBI::dr/; |
|
15
|
|
|
|
|
|
|
} |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub _root_class { |
|
18
|
11
|
|
33
|
11
|
|
69
|
my $root_class = ref( $_[0] ) || $_[0]; |
|
19
|
11
|
|
|
|
|
94
|
$root_class =~ s/::\w+$//; |
|
20
|
11
|
50
|
|
|
|
117
|
return RootClass => $root_class if wantarray; |
|
21
|
0
|
|
|
|
|
0
|
return $root_class; |
|
22
|
|
|
|
|
|
|
} |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub _clone_connection { |
|
25
|
4
|
|
|
4
|
|
6
|
my $invocant = shift; |
|
26
|
4
|
50
|
|
|
|
13
|
return unless UNIVERSAL::isa( $_[0], 'DBI::db' ); |
|
27
|
4
|
|
|
|
|
5
|
my $connection = shift; |
|
28
|
4
|
50
|
33
|
|
|
11
|
my $attrs = @_ && UNIVERSAL::isa( $_[$#_], 'HASH' ) ? pop : {}; |
|
29
|
4
|
|
|
|
|
7
|
return $connection->clone( { %{$attrs}, __PACKAGE__->_root_class } ); |
|
|
4
|
|
|
|
|
10
|
|
|
30
|
|
|
|
|
|
|
} |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub connect { |
|
33
|
11
|
100
|
|
11
|
0
|
837827
|
goto &_clone_connection if UNIVERSAL::isa( $_[1], 'DBI::db' ); |
|
34
|
7
|
|
|
|
|
18
|
my $invocant = shift; |
|
35
|
7
|
100
|
66
|
|
|
63
|
my $attrs = @_ && UNIVERSAL::isa( $_[$#_], 'HASH' ) ? pop : {}; |
|
36
|
7
|
50
|
|
|
|
17
|
my $dbh = DBI::connect( $invocant, @_, { %{$attrs}, __PACKAGE__->_root_class } ) |
|
|
7
|
|
|
|
|
59
|
|
|
37
|
|
|
|
|
|
|
or confessf $DBI::errstr; |
|
38
|
7
|
|
|
|
|
17952
|
return $dbh; |
|
39
|
|
|
|
|
|
|
} |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub connect_cached { |
|
42
|
0
|
|
|
0
|
0
|
|
my $invocant = shift; |
|
43
|
0
|
0
|
0
|
|
|
|
my $attributes = @_ && UNIVERSAL::isa( $_[$#_], 'HASH' ) ? pop : {}; |
|
44
|
|
|
|
|
|
|
my $dbh = DBI::connect_cached( |
|
45
|
|
|
|
|
|
|
$invocant, @_, |
|
46
|
0
|
0
|
|
|
|
|
{ %{$attributes}, __PACKAGE__->_root_class }, |
|
|
0
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
) or confessf $DBI::errstr; |
|
48
|
0
|
|
|
|
|
|
return $dbh; |
|
49
|
|
|
|
|
|
|
} |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
1; |