Script/Sql.pm

filter: Statementstmt 32.2% 10 / 31 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 75.0% 3 / 4 Podpod 100% 1 / 1 totaltotal 35.0% 14 / 40 CC 3 SCAR 18.7
CC
3
Cov
29%
create_sql
12.0
BEGIN
1.0
BEGIN
1.0
CRAP 6.5
« Script/ForeignKey.pm ↑ Summary Script/Index.pm »
1 package Daje::Workflow::GenerateSQL::Script::Sql;
2 1 ▶use Mojo::Base 'Daje::Workflow::GenerateSQL::Base::Common', -base, -signatures;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use v5.40;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 ▶use Syntax::Keyword::Match qw(match);
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 has 'tablename' => "";
8  
9 0 ▶sub create_sql($self) {
Subroutine create_sql: not called CC=3 SCAR=24.8
Pod documented
10  
11 0 my $sql = "";
12 0 my $json = $self->json->{sql};
13 0 my $length = scalar @{$json};
14 0 ▶ for (my $i = 0; $i < $length; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $length) 0 0 0
15 0 my $type = @{$json}[$i]->{type};
16 0 my $template = $self->templates->get_data_section($type);
17 0 my $table_name = $self->tablename;
18 match ($type : eq) {
19 case('insert') {
20 0 my $fields = @{$json}[$i]->{fields};
21 0 my $values =@{$json}[$i]->{values};
22 0 $template =~ s/<<tablename>>/$table_name/ig;
23 0 $template =~ s/<<fields>>/$fields/ig;
24 0 $template =~ s/<<values>>/$values/ig;
25 }
26 0 ▶ default { $template = "" }
Branch: 1 branch
BranchTrueFalseTotal
$(Syntax::Keyword::Match/topic) eq 'insert' ? : 0 0 0
27 }
28 0 $sql .= $template;
29 }
30 0 $self->set_sql($sql);
31 0 return;
32 }
33  
34 1 1;
35  
36  
37  
38  
39  
40  
41  
42 #################### pod generated by Pod::Autopod - keep this line to make pod updates possible ####################
43  
44 =head1 NAME
45  
46 Daje::Workflow::GenerateSQL::Script::Sql
47  
48  
49 =head1 DESCRIPTION
50  
51 use v5.30;
52  
53  
54 =head1 REQUIRES
55  
56 L<v5.30>
57  
58 L<Syntax::Keyword::Match>
59  
60 L<Mojo::Base>
61  
62  
63 =head1 METHODS
64  
65 =head2 create_sql($self)
66  
67 create_sql($self)();
68  
69  
70 =cut
71  
« Script/ForeignKey.pm ↑ Summary Script/Index.pm »