line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DBIx::Class::Helper::ResultSet::Shortcut::OrderByMagic; |
2
|
|
|
|
|
|
|
$DBIx::Class::Helper::ResultSet::Shortcut::OrderByMagic::VERSION = '2.035000'; |
3
|
57
|
|
|
57
|
|
27270
|
use strict; |
|
57
|
|
|
|
|
156
|
|
|
57
|
|
|
|
|
1658
|
|
4
|
57
|
|
|
57
|
|
300
|
use warnings; |
|
57
|
|
|
|
|
199
|
|
|
57
|
|
|
|
|
1565
|
|
5
|
|
|
|
|
|
|
|
6
|
57
|
|
|
57
|
|
293
|
use parent 'DBIx::Class::Helper::ResultSet::Shortcut::OrderBy', 'DBIx::Class::ResultSet'; |
|
57
|
|
|
|
|
134
|
|
|
57
|
|
|
|
|
328
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub order_by { |
9
|
8
|
|
|
8
|
1
|
154986
|
my ($self, @order) = @_; |
10
|
|
|
|
|
|
|
|
11
|
8
|
100
|
66
|
|
|
71
|
return $self->next::method(@order) |
12
|
|
|
|
|
|
|
if @order && ref($order[0]); |
13
|
|
|
|
|
|
|
|
14
|
6
|
|
|
|
|
11
|
my @clauses; |
15
|
6
|
|
|
|
|
17
|
foreach (@order) { |
16
|
6
|
|
|
|
|
38
|
foreach my $col (split(/\s*,\s*/)) { |
17
|
10
|
|
|
|
|
21
|
my $dir = 'asc'; |
18
|
10
|
100
|
|
|
|
31
|
if (substr($col, 0, 1) eq '!') { |
19
|
5
|
|
|
|
|
11
|
$col = substr($col, 1); # take everything after '!' |
20
|
5
|
|
|
|
|
9
|
$dir = 'desc'; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
# add csa prefix if necessary |
24
|
10
|
50
|
|
|
|
53
|
$col = join('.', $self->current_source_alias, $col) |
25
|
|
|
|
|
|
|
if index($col, '.') == -1; |
26
|
|
|
|
|
|
|
|
27
|
10
|
|
|
|
|
85
|
push @clauses, { "-$dir" => $col }; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
6
|
|
|
|
|
27
|
return $self->next::method(\@clauses); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
1; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
__END__ |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=pod |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 NAME |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
DBIx::Class::Helper::ResultSet::Shortcut::OrderByMagic |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 AUTHOR |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
Arthur Axel "fREW" Schmidt <frioux+cpan@gmail.com> |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
This software is copyright (c) 2020 by Arthur Axel "fREW" Schmidt. |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
53
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=cut |