| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package SQL::Wizard::Expr::Compound; |
|
2
|
|
|
|
|
|
|
|
|
3
|
14
|
|
|
14
|
|
81
|
use strict; |
|
|
14
|
|
|
|
|
20
|
|
|
|
14
|
|
|
|
|
460
|
|
|
4
|
14
|
|
|
14
|
|
53
|
use warnings; |
|
|
14
|
|
|
|
|
21
|
|
|
|
14
|
|
|
|
|
636
|
|
|
5
|
14
|
|
|
14
|
|
59
|
use Storable qw(dclone); |
|
|
14
|
|
|
|
|
77
|
|
|
|
14
|
|
|
|
|
856
|
|
|
6
|
14
|
|
|
14
|
|
90
|
use parent 'SQL::Wizard::Expr'; |
|
|
14
|
|
|
|
|
34
|
|
|
|
14
|
|
|
|
|
75
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new { |
|
9
|
8
|
|
|
8
|
0
|
19
|
my ($class, %args) = @_; |
|
10
|
|
|
|
|
|
|
# args: queries => [ { type => undef|'UNION'|..., query => $select }, ... ] |
|
11
|
8
|
|
|
|
|
23
|
$class->SUPER::new(%args); |
|
12
|
|
|
|
|
|
|
} |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# Chain more compounds |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub union { |
|
17
|
0
|
|
|
0
|
0
|
0
|
my ($self, $other) = @_; |
|
18
|
0
|
|
|
|
|
0
|
my $clone = dclone($self); |
|
19
|
0
|
|
|
|
|
0
|
push @{$clone->{queries}}, { type => 'UNION', query => $other }; |
|
|
0
|
|
|
|
|
0
|
|
|
20
|
0
|
|
|
|
|
0
|
$clone; |
|
21
|
|
|
|
|
|
|
} |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub union_all { |
|
24
|
2
|
|
|
2
|
0
|
6
|
my ($self, $other) = @_; |
|
25
|
2
|
|
|
|
|
244
|
my $clone = dclone($self); |
|
26
|
2
|
|
|
|
|
4
|
push @{$clone->{queries}}, { type => 'UNION ALL', query => $other }; |
|
|
2
|
|
|
|
|
7
|
|
|
27
|
2
|
|
|
|
|
7
|
$clone; |
|
28
|
|
|
|
|
|
|
} |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub intersect { |
|
31
|
0
|
|
|
0
|
0
|
0
|
my ($self, $other) = @_; |
|
32
|
0
|
|
|
|
|
0
|
my $clone = dclone($self); |
|
33
|
0
|
|
|
|
|
0
|
push @{$clone->{queries}}, { type => 'INTERSECT', query => $other }; |
|
|
0
|
|
|
|
|
0
|
|
|
34
|
0
|
|
|
|
|
0
|
$clone; |
|
35
|
|
|
|
|
|
|
} |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub except { |
|
38
|
0
|
|
|
0
|
0
|
0
|
my ($self, $other) = @_; |
|
39
|
0
|
|
|
|
|
0
|
my $clone = dclone($self); |
|
40
|
0
|
|
|
|
|
0
|
push @{$clone->{queries}}, { type => 'EXCEPT', query => $other }; |
|
|
0
|
|
|
|
|
0
|
|
|
41
|
0
|
|
|
|
|
0
|
$clone; |
|
42
|
|
|
|
|
|
|
} |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub order_by { |
|
45
|
1
|
|
|
1
|
0
|
3
|
my ($self, @order) = @_; |
|
46
|
1
|
|
|
|
|
79
|
my $clone = dclone($self); |
|
47
|
1
|
50
|
|
|
|
6
|
$clone->{order_by} = @order == 1 ? $order[0] : \@order; |
|
48
|
1
|
|
|
|
|
5
|
$clone; |
|
49
|
|
|
|
|
|
|
} |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub limit { |
|
52
|
1
|
|
|
1
|
0
|
2
|
my ($self, $limit) = @_; |
|
53
|
1
|
|
|
|
|
31
|
my $clone = dclone($self); |
|
54
|
1
|
|
|
|
|
2
|
$clone->{limit} = $limit; |
|
55
|
1
|
|
|
|
|
3
|
$clone; |
|
56
|
|
|
|
|
|
|
} |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub offset { |
|
59
|
0
|
|
|
0
|
0
|
|
my ($self, $offset) = @_; |
|
60
|
0
|
|
|
|
|
|
my $clone = dclone($self); |
|
61
|
0
|
|
|
|
|
|
$clone->{offset} = $offset; |
|
62
|
0
|
|
|
|
|
|
$clone; |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
1; |