Helper/Row/ProxyResultSetUpdate.pm

filter: Statementstmt 95.6% 22 / 23 Branchbran 60.0% 6 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod 100% 1 / 1 totaltotal 86.8% 33 / 38 CC 6 SCAR 15.3
CC
6
Cov
85%
update
6.4
BEGIN
1.0
BEGIN
1.0
CRAP 4.6
« Helper/ResultSet/Shortcut/OrderByMagic.pm ↑ Summary Helper/Row/JoinTable.pm »
1 package DBIx::Class::Helper::Row::ProxyResultSetUpdate;
2 56 $DBIx::Class::Helper::Row::ProxyResultSetUpdate::VERSION = '2.037000';
3 # ABSTRACT: Efficiently reuse ResultSet updates from results
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::Helper::Row::SelfResultSet', 'DBIx::Class::Row';
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 2 ▶sub update {
Subroutine update: called CC=6 SCAR=18.6
Pod documented
11 2 my ($self, $upd) = @_;
12  
13 2 ▶ $self->set_inflated_columns($upd) if $upd;
Branch: 1 branch
BranchTrueFalseTotal
if $upd 2 0 2
14  
15 2 ▶ my %to_update = $self->get_dirty_columns
Branch: 1 branch
BranchTrueFalseTotal
my(%to_update) = $self->get_dirty_columns or return $self 2 0 2
16 or return $self;
17  
18 2 ▶ $self->throw_exception( "Not in database" ) unless $self->in_storage;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->in_storage 0 2 2
19  
20 # copied directly from DBIx::Class::Row except for this line
21 2 my $rows = $self->self_rs->update(\%to_update);
22 2 ▶ if ($rows == 0) {
Branch: 2 branches
BranchTrueFalseTotal
if ($rows == 0) { } 1 1 2
elsif ($rows > 1) { } 0 1 1
23 1 $self->throw_exception( "Can't update ${self}: row not found" );
24 } elsif ($rows > 1) {
25 0 $self->throw_exception("Can't update ${self}: updated more than one row");
26 }
27 1 $self->{_dirty_columns} = {};
28 1 $self->{related_resultsets} = {};
29 1 delete $self->{_column_data_in_storage};
30 1 return $self;
31 }
32  
33 56 1;
34  
35 __END__
« Helper/ResultSet/Shortcut/OrderByMagic.pm ↑ Summary Helper/Row/JoinTable.pm »