Geoffrey/Action/Entry.pm

filter: Statementstmt 95.5% 43 / 45 Branchbran 81.2% 13 / 16 Conditioncond 66.6% 2 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 8 / 8 Podpod 100% 3 / 3 totaltotal 89.6% 69 / 77 CC 10 SCAR 10.8
CC
10
Cov
91%
drop
4.3
add
4.0
alter
3.0
CRAP 3.0
« Geoffrey/Role/Converter.pm ↑ Summary Geoffrey/Action/Constraint/Default.pm »
1 package Geoffrey::Action::Entry;
2  
3 3 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 3 $Geoffrey::Action::Entry::VERSION = '0.000206';
8  
9 3 ▶use parent 'Geoffrey::Role::Action';
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 9 ▶sub _get_sql_abstract {
Subroutine _get_sql_abstract: called CC=2 SCAR=7.0
12 9 my ($self) = @_;
13 9 require SQL::Abstract;
14 9 ▶ $self->{sql_abstract} //= SQL::Abstract->new;
Condition66%2/3
$self->{"sql_abstract"} //= "SQL::Abstract"->new
l!l&&r!l&&!r
630
MC/DC0%0/2
$self->{"sql_abstract"} //= "SQL::Abstract"->new
$self->{"sql_abstract"} "SQL::Abstract"->new
Truth table66%2/3
A //= B
A= $self->{"sql_abstract"}B= "SQL::Abstract"->new
ABresult
1X1
011
000
15 9 return $self->{sql_abstract};
16 }
17  
18 10 ▶sub add {
Subroutine add: called CC=4 SCAR=13.9
Pod documented
19 10 my ( $self, $hr_params ) = @_;
20  
21 10 ▶ if ( !$hr_params->{table} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($hr_params->{"table"}) 2 8 10
22 2 require Geoffrey::Exception::RequiredValue;
23 2 Geoffrey::Exception::RequiredValue::throw_table_name( __PACKAGE__ . '::add' );
24 }
25 8 ▶ if ( !$hr_params->{values} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($hr_params->{"values"}) 1 7 8
26 1 require Geoffrey::Exception::RequiredValue;
27 1 Geoffrey::Exception::RequiredValue::throw_values( __PACKAGE__ . '::add' );
28 }
29  
30 my ( $s_stmt, @a_bindings ) = $self->_get_sql_abstract->insert(
31 ( $hr_params->{schema} ? $hr_params->{schema} . q/./ : q// ) . $hr_params->{table},
32 7 ▶ $hr_params->{values}->[0],
Branch: 1 branch
BranchTrueFalseTotal
$hr_params->{'schema'} ? : 0 7 7
33 );
34  
35 7 return $self->do_prepared( $s_stmt, \@a_bindings );
36 }
37  
38 4 ▶sub alter {
Subroutine alter: called CC=3 SCAR=11.0
Pod documented
39 4 my ( $self, $s_table_name, $hr_where, $ar_values ) = @_;
40  
41 4 ▶ if ( !$s_table_name ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($s_table_name) 1 3 4
42 1 require Geoffrey::Exception::RequiredValue;
43 1 Geoffrey::Exception::RequiredValue::throw_table_name( __PACKAGE__ . '::alter' );
44 }
45  
46 3 ▶ if ( !$hr_where ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($hr_where) 2 1 3
47 2 require Geoffrey::Exception::RequiredValue;
48 2 Geoffrey::Exception::RequiredValue::throw_where_clause( __PACKAGE__ . '::alter' );
49 }
50  
51 1 my ( $s_stmt, @a_bindings ) = $self->_get_sql_abstract->update( $s_table_name, $ar_values->[0], $hr_where );
52  
53 1 return $self->do_prepared( $s_stmt, \@a_bindings );
54 }
55  
56 2 ▶sub drop {
Subroutine drop: called CC=4 SCAR=14.6
Pod documented
57 2 my ( $self, $hr_params ) = @_;
58 2 ▶ if ( !$hr_params->{table} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($hr_params->{"table"}) 1 1 2
59 1 require Geoffrey::Exception::RequiredValue;
60 1 Geoffrey::Exception::RequiredValue::throw_table_name( __PACKAGE__ . '::drop' );
61 }
62 1 ▶ if ( !$hr_params->{conditions} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($hr_params->{"conditions"}) 0 1 1
63 0 require Geoffrey::Exception::RequiredValue;
64 0 Geoffrey::Exception::RequiredValue::throw_where_clause( __PACKAGE__ . '::drop' );
65 }
66  
67 my ( $s_stmt, @a_bindings ) = $self->_get_sql_abstract->delete(
68 ( $hr_params->{schema} ? $hr_params->{schema} . q/./ : q// ) . $hr_params->{table},
69 $hr_params->{conditions},
70 1 ▶ );
Branch: 1 branch
BranchTrueFalseTotal
$hr_params->{'schema'} ? : 0 1 1
71 1 return $self->do_prepared( $s_stmt, \@a_bindings );
72 }
73  
74 3 1;
75  
76 __END__
« Geoffrey/Role/Converter.pm ↑ Summary Geoffrey/Action/Constraint/Default.pm »