| 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
| |||||||||||||||
| 13 | or return undef; | ||||||||||||||
| 14 | 0 | ▶ | my $row = $sth->$method() | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 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
| |||||||||||||||
| 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
| |||||||||||||||
| 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
| |||||||||||||||
| 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
| |||||||||||||||
| 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__ | ||||||||||||||