| 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 | ▶ | use strict; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 12 | 12 | ▶ | use warnings; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 13 | 12 | our $VERSION = '$Revision: 1.2 $'; | |||||||||||||
| 14 | |||||||||||||||
| 15 | 12 | ▶ | use Carp::Assert; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 16 | use Class::MethodMaker | ||||||||||||||
| 17 | 12 | ▶ | 'new_with_init' => 'new', | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 18 | 'get_set' => [qw(names)], | ||||||||||||||
| 19 | 12 | ; | |||||||||||||
| 20 | |||||||||||||||
| 21 | ## new GroupBy([cols,...]) | ||||||||||||||
| 22 | ## new GroupBy(cols,...) | ||||||||||||||
| 23 | 0 | ▶ | sub init { | ||||||||||||
|
Subroutine
init: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||
| 24 | 0 | my $self = shift; | |||||||||||||
| 25 | 0 | assert(@_ > 0, 'valid parameters'); | |||||||||||||
| 26 | 0 | ▶ | assert(@_ == 1 ? (ref($_[0])? ref($_[0]) eq 'ARRAY' : 1) : 1, 'valid parameters'); | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 27 | |||||||||||||||
| 28 | 0 | $self->names([]); | |||||||||||||
| 29 | 0 | $self->append(@_); | |||||||||||||
| 30 | } | ||||||||||||||
| 31 | |||||||||||||||
| 32 | 0 | ▶ | sub append { | ||||||||||||
|
Subroutine
append: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||
| 33 | 0 | my $self = shift; | |||||||||||||
| 34 | |||||||||||||||
| 35 | 0 | ▶ | if (UNIVERSAL::isa($_[0],__PACKAGE__)){ | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 36 | 0 | push @{$self->names}, @{$_[0]->names}; | |||||||||||||
| 37 | } | ||||||||||||||
| 38 | elsif (ref($_[0]) eq 'ARRAY'){ | ||||||||||||||
| 39 | 0 | push @{$self->names}, @{$_->[0]} | |||||||||||||
| 40 | } | ||||||||||||||
| 41 | else { | ||||||||||||||
| 42 | 0 | push @{$self->names}, @_; | |||||||||||||
| 43 | } | ||||||||||||||
| 44 | } | ||||||||||||||
| 45 | |||||||||||||||
| 46 | 0 | ▶ | sub sql { | ||||||||||||
|
Subroutine
sql: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||
| 47 | 0 | my ($self, $dbh) = @_; | |||||||||||||
| 48 | 0 | my $names = $self->names; | |||||||||||||
| 49 | 0 | ▶ | return '' unless @$names; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 50 | 0 | return join(",", @$names); | |||||||||||||
| 51 | } | ||||||||||||||
| 52 | |||||||||||||||
| 53 | |||||||||||||||
| 54 | 12 | 1; | |||||||||||||
| 55 | __END__ | ||||||||||||||