Geoffrey/Action/Constraint/Default.pm

filter: Statementstmt 76.7% 33 / 43 Branchbran 50.0% 4 / 8 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 10 / 10 Podpod 100% 3 / 3 totaltotal 74.6% 50 / 67 CC 6 SCAR 10.7
CC
6
Cov
70%
add
6.4
list_from_schema
3.5
drop
2.1
CRAP 2.9
« Geoffrey/Action/Entry.pm ↑ Summary Geoffrey/Converter/SQLite.pm »
1 package Geoffrey::Action::Constraint::Default;
2  
3 4 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use 5.016;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 4 ▶use Geoffrey::Utils;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 4 ▶use Geoffrey::Exception::NotSupportedException;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 4 ▶use parent 'Geoffrey::Role::Action';
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 4 $Geoffrey::Action::Constraint::Default::VERSION = '0.000206';
13  
14 3 ▶sub add {
Subroutine add: called CC=4 SCAR=18.5
Pod documented
15 3 my ($self, $params) = @_;
16 3 ▶ Geoffrey::Exception::RequiredValue::throw_table_name() if !$params->{table};
Branch: 1 branch
BranchTrueFalseTotal
unless $params->{"table"} 1 2 3
17 2 my $sequence = $self->converter->sequence;
18 1 ▶ if (!$sequence->can('nextval')) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($sequence->can("nextval")) 1 0 1
19 1 Geoffrey::Exception::NotSupportedException::throw_sequence('nextval', $self->converter);
20 }
21  
22 0 my $s_table = $params->{table} =~ s/"//gr;
23 0 $params->{name} =~ s/"//g;
24 0 ▶ $params->{name} //= qq~seq_$s_table~ . q/_/ . time;
Condition0%0/2
$params->{"name"} //= "seq_$s_table" . '_' . time
l!l
00
MC/DC0%0/1
$params->{"name"} //= "seq_$s_table" . '_' . time
$params->{"name"}
Truth table0%0/2
A
A= $params->{"name"}
Aresult
11
00
25 my $sql = Geoffrey::Utils::replace_spare($sequence->add,
26 0 [$params->{name}, 1, 1, $Geoffrey::Utils::INT_64BIT_SIGNED, 1, 1]);
27 0 $self->do($sql);
28 0 return Geoffrey::Utils::replace_spare($sequence->nextval, [$params->{name}]);
29 }
30  
31 3 ▶sub drop {
Subroutine drop: called CC=2 SCAR=7.4
Pod documented
32 3 my ($self, $name) = @_;
33 3 my $sequence = $self->converter->sequence;
34 1 ▶ if (!$sequence->can('drop')) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($sequence->can("drop")) 0 1 1
35 0 Geoffrey::Exception::NotSupportedException::throw_sequence('drop', $self->converter);
36 }
37 1 return $self->do(Geoffrey::Utils::replace_spare($sequence->drop, [$name]));
38 }
39  
40 3 ▶sub list_from_schema {
Subroutine list_from_schema: called CC=2 SCAR=12.4
Pod documented
41 3 my ($self, $schema) = @_;
42 3 my $sequence = $self->converter->sequence;
43 0 ▶ if (!$sequence->can('list')) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($sequence->can("list")) 0 0 0
44 0 Geoffrey::Exception::NotSupportedException::throw_sequence('list', $self->converter);
45 }
46 0 return $self->converter->sequence_information($self->do_arrayref($sequence->list($schema), []));
47 }
48  
49 4 1;
50  
51 __END__
« Geoffrey/Action/Entry.pm ↑ Summary Geoffrey/Converter/SQLite.pm »