Wizard/Expr/Compound.pm

filter: Statementstmt 59.5% 28 / 47 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 66.6% 8 / 12 Podpod 0.0% 0 / 8 totaltotal 53.6% 37 / 69 CC 2 SCAR 3.8
CC
2
Cov
59%
order_by
2.0
union
2.0
intersect
2.0
CRAP 1.5
« Wizard/Expr.pm ↑ Summary Wizard/Expr/Func.pm »
1 package SQL::Wizard::Expr::Compound;
2  
3 14 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 14 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 14 ▶use Storable qw(dclone);
Subroutine BEGIN: called CC=1 SCAR=0.0
6 14 ▶use parent 'SQL::Wizard::Expr';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 8 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
9 8 my ($class, %args) = @_;
10 # args: queries => [ { type => undef|'UNION'|..., query => $select }, ... ]
11 8 $class->SUPER::new(%args);
12 }
13  
14 # Chain more compounds
15  
16 0 ▶sub union {
Subroutine union: not called CC=1 SCAR=6.9
Pod undocumented
17 0 my ($self, $other) = @_;
18 0 my $clone = dclone($self);
19 0 push @{$clone->{queries}}, { type => 'UNION', query => $other };
20 0 $clone;
21 }
22  
23 2 ▶sub union_all {
Subroutine union_all: called CC=1 SCAR=0.0
Pod undocumented
24 2 my ($self, $other) = @_;
25 2 my $clone = dclone($self);
26 2 push @{$clone->{queries}}, { type => 'UNION ALL', query => $other };
27 2 $clone;
28 }
29  
30 0 ▶sub intersect {
Subroutine intersect: not called CC=1 SCAR=6.9
Pod undocumented
31 0 my ($self, $other) = @_;
32 0 my $clone = dclone($self);
33 0 push @{$clone->{queries}}, { type => 'INTERSECT', query => $other };
34 0 $clone;
35 }
36  
37 0 ▶sub except {
Subroutine except: not called CC=1 SCAR=6.9
Pod undocumented
38 0 my ($self, $other) = @_;
39 0 my $clone = dclone($self);
40 0 push @{$clone->{queries}}, { type => 'EXCEPT', query => $other };
41 0 $clone;
42 }
43  
44 1 ▶sub order_by {
Subroutine order_by: called CC=2 SCAR=7.0
Pod undocumented
45 1 my ($self, @order) = @_;
46 1 my $clone = dclone($self);
47 1 ▶ $clone->{order_by} = @order == 1 ? $order[0] : \@order;
Branch: 1 branch
BranchTrueFalseTotal
@order == 1 ? : 1 0 1
48 1 $clone;
49 }
50  
51 1 ▶sub limit {
Subroutine limit: called CC=1 SCAR=0.0
Pod undocumented
52 1 my ($self, $limit) = @_;
53 1 my $clone = dclone($self);
54 1 $clone->{limit} = $limit;
55 1 $clone;
56 }
57  
58 0 ▶sub offset {
Subroutine offset: not called CC=1 SCAR=6.9
Pod undocumented
59 0 my ($self, $offset) = @_;
60 0 my $clone = dclone($self);
61 0 $clone->{offset} = $offset;
62 0 $clone;
63 }
64  
65 14 1;
« Wizard/Expr.pm ↑ Summary Wizard/Expr/Func.pm »