| 1 | package DBIx::Class::Helper::Row::StorageValues; | ||||||||||||||||||||
| 2 | 56 | $DBIx::Class::Helper::Row::StorageValues::VERSION = '2.037000'; | |||||||||||||||||||
| 3 | # ABSTRACT: Keep track of stored vs in-memory row values | ||||||||||||||||||||
| 4 | |||||||||||||||||||||
| 5 | 56 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | 56 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 7 | |||||||||||||||||||||
| 8 | 56 | ▶ | use parent 'DBIx::Class::Row'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 9 | |||||||||||||||||||||
| 10 | 56 | __PACKAGE__->mk_group_accessors(inherited => '_storage_value_columns'); | |||||||||||||||||||
| 11 | 56 | __PACKAGE__->mk_group_accessors(inherited => '_storage_values'); | |||||||||||||||||||
| 12 | |||||||||||||||||||||
| 13 | 673 | ▶ | sub _has_storage_value { $_[0]->column_info($_[1])->{keep_storage_value} } | ||||||||||||||||||
|
Subroutine
_has_storage_value: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 14 | |||||||||||||||||||||
| 15 | 308 | ▶ | sub storage_value_columns { | ||||||||||||||||||
|
Subroutine
storage_value_columns: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 16 | 308 | my $self = shift; | |||||||||||||||||||
| 17 | 308 | ▶ | if (!$self->_storage_value_columns) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 18 | 301 | $self->_storage_value_columns([ | |||||||||||||||||||
| 19 | grep $self->_has_storage_value($_), | ||||||||||||||||||||
| 20 | $self->result_source->columns | ||||||||||||||||||||
| 21 | ]); | ||||||||||||||||||||
| 22 | } | ||||||||||||||||||||
| 23 | 308 | return $self->_storage_value_columns; | |||||||||||||||||||
| 24 | } | ||||||||||||||||||||
| 25 | |||||||||||||||||||||
| 26 | 308 | ▶ | sub store_storage_values { | ||||||||||||||||||
|
Subroutine
store_storage_values: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||
| 27 | 308 | my $self = shift; | |||||||||||||||||||
| 28 | $self->_storage_values({ | ||||||||||||||||||||
| 29 | map { | ||||||||||||||||||||
| 30 | 152 | ▶ | my $acc = ($self->column_info($_)->{accessor} || $_); | ||||||||||||||||||
|
Condition33%1/3
$self->column_info($_)->{'accessor'} || $_
MC/DC0%0/2
$self->column_info($_)->{'accessor'} || $_
$self->column_info($_)->{'accessor'}
$_
Truth table33%1/3
A || B
A= $self->column_info($_)->{'accessor'}B= $_
| |||||||||||||||||||||
| 31 | 152 | $_ => $self->$acc | |||||||||||||||||||
| 32 | 308 | } @{$self->storage_value_columns} | |||||||||||||||||||
| 33 | }); | ||||||||||||||||||||
| 34 | 308 | $self->_storage_values; | |||||||||||||||||||
| 35 | } | ||||||||||||||||||||
| 36 | |||||||||||||||||||||
| 37 | 18 | ▶ | sub get_storage_value { $_[0]->_storage_values->{$_[1]} } | ||||||||||||||||||
|
Subroutine
get_storage_value: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 38 | |||||||||||||||||||||
| 39 | 1 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 40 | 1 | my $class = shift; | |||||||||||||||||||
| 41 | 1 | my $ret = $class->next::method(@_); | |||||||||||||||||||
| 42 | 1 | $ret->_storage_values({}); | |||||||||||||||||||
| 43 | 1 | $ret; | |||||||||||||||||||
| 44 | } | ||||||||||||||||||||
| 45 | |||||||||||||||||||||
| 46 | 300 | ▶ | sub inflate_result { | ||||||||||||||||||
|
Subroutine
inflate_result: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 47 | 300 | my $class = shift; | |||||||||||||||||||
| 48 | 300 | my $ret = $class->next::method(@_); | |||||||||||||||||||
| 49 | 300 | $ret->store_storage_values; | |||||||||||||||||||
| 50 | 300 | $ret; | |||||||||||||||||||
| 51 | } | ||||||||||||||||||||
| 52 | |||||||||||||||||||||
| 53 | 1 | ▶ | sub insert { | ||||||||||||||||||
|
Subroutine
insert: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 54 | 1 | my $self = shift; | |||||||||||||||||||
| 55 | 1 | my $ret = $self->next::method(@_); | |||||||||||||||||||
| 56 | 1 | $ret->store_storage_values; | |||||||||||||||||||
| 57 | 1 | $ret; | |||||||||||||||||||
| 58 | } | ||||||||||||||||||||
| 59 | |||||||||||||||||||||
| 60 | 7 | ▶ | sub update { | ||||||||||||||||||
|
Subroutine
update: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 61 | 7 | my $self = shift; | |||||||||||||||||||
| 62 | 7 | my $ret = $self->next::method(@_); | |||||||||||||||||||
| 63 | 7 | $ret->store_storage_values; | |||||||||||||||||||
| 64 | 7 | $ret; | |||||||||||||||||||
| 65 | } | ||||||||||||||||||||
| 66 | |||||||||||||||||||||
| 67 | 56 | 1; | |||||||||||||||||||
| 68 | |||||||||||||||||||||
| 69 | __END__ | ||||||||||||||||||||