blib/lib/DBIx/Handler/Sunny.pm

filter: Statementstmt 34.3% 11 / 32 Branchbran 0.0% 0 / 14 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 37.5% 3 / 8 Podpod 100% 4 / 4 totaltotal 31.0% 18 / 58 SCAR 35.9
CC
8
Cov
24%
_do_selectrow
12.0
last_insert_id
12.0
select_one
6.0
CRAP 36.2
↑ Summary Build »
1 package DBIx::Handler::Sunny;
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 our $VERSION = '0.01';
6  
7 # cpan
8 1 ▶use parent qw(DBIx::Handler);
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 sub _do_selectrow { # see DBI::_do_selectrow
11 0 ▶ my ($self, $method, @args) = @_;
Subroutine _do_selectrow: not called CC=3 SCAR=24.8
12 0 ▶ my $sth = $self->query(@args)
Branch: 1 branch
BranchTrueFalseTotal
my $sth = $self->query(@args) or return undef 0 0 0
13 or return undef;
14 0 ▶ my $row = $sth->$method()
Branch: 1 branch
BranchTrueFalseTotal
my $row = $sth->$method and $sth->finish 0 0 0
15 and $sth->finish;
16 0 return $row;
17 }
18  
19 sub select_one {
20 0 ▶ my ($self, @args) = @_;
Subroutine select_one: not called CC=2 SCAR=17.9
Pod documented
21 0 my $row = $self->_do_selectrow('fetchrow_arrayref', @args);
22 0 ▶ return undef unless $row;
Branch: 1 branch
BranchTrueFalseTotal
unless $row 0 0 0
23 0 return $row->[0];
24 }
25  
26 sub select_row {
27 0 ▶ my ($self, @args) = @_;
Subroutine select_row: not called CC=2 SCAR=17.9
Pod documented
28 0 my $row = $self->_do_selectrow('fetchrow_hashref', @args);
29 0 ▶ return unless $row;
Branch: 1 branch
BranchTrueFalseTotal
unless $row 0 0 0
30 0 return $row;
31 }
32  
33 sub select_all {
34 0 ▶ my ($self, @args) = @_;
Subroutine select_all: not called CC=2 SCAR=17.9
Pod documented
35 0 ▶ my $sth = $self->query(@args)
Branch: 1 branch
BranchTrueFalseTotal
my $sth = $self->query(@args) or return [] 0 0 0
36 or return [];
37 0 return $sth->fetchall_arrayref({});
38 }
39  
40 sub last_insert_id {
41 0 ▶ my $self = shift;
Subroutine last_insert_id: not called CC=3 SCAR=24.8
Pod documented
42 0 my $dsn = $self->{_connect_info}->[0];
43 0 ▶ if ($dsn =~ /^(?i:dbi):SQLite\b/) {
Branch: 2 branches
BranchTrueFalseTotal
if ($dsn =~ /^(?i:dbi):SQLite\b/) { } 0 0 0
elsif ($dsn =~ /^(?i:dbi):mysql\b/) { } 0 0 0
44 0 return $self->dbh->func('last_insert_rowid');
45 }
46 elsif ( $dsn =~ /^(?i:dbi):mysql\b/) {
47 0 return $self->dbh->{mysql_insertid};
48 }
49 0 $self->dbh->last_insert_id(@_);
50 }
51  
52 1 1;
53 __END__
↑ Summary Build »