| 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
| |||||||||||
| 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; | |||||||||