line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DBomb::Query::GroupBy; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
DBomb::Query::GroupBy - An ORDER BY clause. |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 SYNOPSIS |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=cut |
10
|
|
|
|
|
|
|
|
11
|
12
|
|
|
12
|
|
72
|
use strict; |
|
12
|
|
|
|
|
23
|
|
|
12
|
|
|
|
|
553
|
|
12
|
12
|
|
|
12
|
|
65
|
use warnings; |
|
12
|
|
|
|
|
23
|
|
|
12
|
|
|
|
|
541
|
|
13
|
|
|
|
|
|
|
our $VERSION = '$Revision: 1.2 $'; |
14
|
|
|
|
|
|
|
|
15
|
12
|
|
|
12
|
|
83
|
use Carp::Assert; |
|
12
|
|
|
|
|
30
|
|
|
12
|
|
|
|
|
96
|
|
16
|
|
|
|
|
|
|
use Class::MethodMaker |
17
|
12
|
|
|
|
|
6073
|
'new_with_init' => 'new', |
18
|
|
|
|
|
|
|
'get_set' => [qw(names)], |
19
|
12
|
|
|
12
|
|
2047
|
; |
|
12
|
|
|
|
|
22
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
## new GroupBy([cols,...]) |
22
|
|
|
|
|
|
|
## new GroupBy(cols,...) |
23
|
|
|
|
|
|
|
sub init { |
24
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
25
|
0
|
|
|
|
|
|
assert(@_ > 0, 'valid parameters'); |
26
|
0
|
0
|
|
|
|
|
assert(@_ == 1 ? (ref($_[0])? ref($_[0]) eq 'ARRAY' : 1) : 1, 'valid parameters'); |
|
|
0
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
|
$self->names([]); |
29
|
0
|
|
|
|
|
|
$self->append(@_); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub append { |
33
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
34
|
|
|
|
|
|
|
|
35
|
0
|
0
|
|
|
|
|
if (UNIVERSAL::isa($_[0],__PACKAGE__)){ |
|
|
0
|
|
|
|
|
|
36
|
0
|
|
|
|
|
|
push @{$self->names}, @{$_[0]->names}; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
elsif (ref($_[0]) eq 'ARRAY'){ |
39
|
0
|
|
|
|
|
|
push @{$self->names}, @{$_->[0]} |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
else { |
42
|
0
|
|
|
|
|
|
push @{$self->names}, @_; |
|
0
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub sql { |
47
|
0
|
|
|
0
|
0
|
|
my ($self, $dbh) = @_; |
48
|
0
|
|
|
|
|
|
my $names = $self->names; |
49
|
0
|
0
|
|
|
|
|
return '' unless @$names; |
50
|
0
|
|
|
|
|
|
return join(",", @$names); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
1; |
55
|
|
|
|
|
|
|
__END__ |