| 1 | package Test::DBChanges::Role::DBI; | ||
| 2 | 1 | ▶ | use Moo::Role; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 1 | ▶ | use Types::Standard qw(HasMethods); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 1 | ▶ | use namespace::autoclean; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 1 | our $VERSION = '1.0.2'; # VERSION | |
| 7 | # ABSTRACT: adapt DBChanges to DBI | ||
| 8 | |||
| 9 | |||
| 10 | 1 | has dbh => ( is => 'ro', required => 1, isa => HasMethods[qw(do selectall_arrayref)] ); | |
| 11 | |||
| 12 | 0 | ▶ | sub _db_do { |
|
Subroutine
_db_do: not called CC=1 SCAR=6.9
| |||
| 13 | 0 | my ($self,$sql,@args) = @_; | |
| 14 | 0 | my $dbh = $self->dbh; | |
| 15 | # silence "NOTICE: the relation already exists" | ||
| 16 | 0 | local $dbh->{PrintWarn} = 0; | |
| 17 | 0 | $dbh->do($sql,{},@args); | |
| 18 | } | ||
| 19 | |||
| 20 | 0 | ▶ | sub _db_fetch { |
|
Subroutine
_db_fetch: not called CC=1 SCAR=6.9
| |||
| 21 | 0 | my ($self,$sql,@args) = @_; | |
| 22 | 0 | return $self->dbh->selectall_arrayref($sql, { Slice => {} }, @args); | |
| 23 | } | ||
| 24 | |||
| 25 | 0 | ▶ | sub _table_and_factory_for_source { |
|
Subroutine
_table_and_factory_for_source: not called CC=1 SCAR=6.9
| |||
| 26 | 0 | my ($self,$source_name) = @_; | |
| 27 | |||
| 28 | # source names are table names, and we don't transform the result | ||
| 29 | # of _db_fetch | ||
| 30 | 0 | ▶ | return ( $source_name, sub { return @_ } ); |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 31 | } | ||
| 32 | |||
| 33 | 1 | 1; | |
| 34 | |||
| 35 | __END__ | ||