File | /wise/base/static/lib/perl5/site_perl/5.10.0/DBIx/Class/Storage/DBI/MultiDistinctEmulation.pm | Statements Executed | 118 | Total Time | 0.000656 seconds |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine | |
---|---|---|---|---|---|---|
4 | 1 | 1 | 0.00034 | 483.44368 | DBIx::Class::Storage::DBI::MultiDistinctEmulation:: | _select |
23 | 1 | 1 | 0.00017 | 0.00017 | DBIx::Class::Storage::DBI::MultiDistinctEmulation:: | replace_distincts |
0 | 0 | 0 | 0 | 0 | DBIx::Class::Storage::DBI::MultiDistinctEmulation:: | BEGIN |
Line | Stmts. | Exclusive Time | Avg. | Code |
---|---|---|---|---|
1 | package DBIx::Class::Storage::DBI::MultiDistinctEmulation; | |||
2 | ||||
3 | 3 | 7.1e-5 | 2.4e-5 | use strict; # spent 47µs making 1 call to strict::import |
4 | 3 | 3.8e-5 | 1.3e-5 | use warnings; # spent 17µs making 1 call to warnings::import |
5 | ||||
6 | 3 | 0.00020 | 6.8e-5 | use base qw/DBIx::Class::Storage::DBI/; # spent 156µs making 1 call to base::import, max recursion depth 1 |
7 | ||||
8 | # spent 483s (339µs+483) within DBIx::Class::Storage::DBI::MultiDistinctEmulation::_select which was called 4 times, avg 121s/call:
# 4 times (339µs+483s) by DBIx::Class::Storage::DBI::Cursor::_dbh_next at line 78 of /wise/base/static/lib/perl5/site_perl/5.10.0/DBIx/Class/Storage/DBI/Cursor.pm, avg 121s/call | |||
9 | 12 | 7.0e-5 | 5.8e-6 | my ($self, $ident, $select, $condition, $attrs) = @_; |
10 | ||||
11 | # hack to make count distincts with multiple columns work in SQLite and Oracle | |||
12 | 4 | 4.5e-5 | 1.1e-5 | if (ref $select eq 'ARRAY') { |
13 | 23 | 0.00013 | 5.6e-6 | @{$select} = map {$self->replace_distincts($_)} @{$select}; # spent 172µs making 23 calls to DBIx::Class::Storage::DBI::MultiDistinctEmulation::replace_distincts, avg 7µs/call |
14 | } else { | |||
15 | $select = $self->replace_distincts($select); | |||
16 | } | |||
17 | ||||
18 | return $self->next::method($ident, $select, $condition, $attrs); # spent 125µs making 4 calls to next::method, avg 31µs/call | |||
19 | } | |||
20 | ||||
21 | # spent 172µs within DBIx::Class::Storage::DBI::MultiDistinctEmulation::replace_distincts which was called 23 times, avg 7µs/call:
# 23 times (172µs+0) by DBIx::Class::Storage::DBI::MultiDistinctEmulation::_select at line 13, avg 7µs/call | |||
22 | 69 | 9.7e-5 | 1.4e-6 | my ($self, $select) = @_; |
23 | ||||
24 | $select->{count}->{distinct} = join("||", @{$select->{count}->{distinct}}) | |||
25 | if (ref $select eq 'HASH' && $select->{count} && ref $select->{count} eq 'HASH' && | |||
26 | $select->{count}->{distinct} && ref $select->{count}->{distinct} eq 'ARRAY'); | |||
27 | ||||
28 | return $select; | |||
29 | } | |||
30 | ||||
31 | 1 | 3.0e-6 | 3.0e-6 | 1; |
32 | ||||
33 | =head1 NAME | |||
34 | ||||
35 | DBIx::Class::Storage::DBI::MultiDistinctEmulation - Some databases can't handle count distincts with multiple cols. They should use base on this. | |||
36 | ||||
37 | =head1 SYNOPSIS | |||
38 | ||||
39 | =head1 DESCRIPTION | |||
40 | ||||
41 | This class allows count distincts with multiple columns for retarded databases (Oracle and SQLite) | |||
42 | ||||
43 | =head1 AUTHORS | |||
44 | ||||
45 | Luke Saunders <luke.saunders@gmail.com> | |||
46 | ||||
47 | =head1 LICENSE | |||
48 | ||||
49 | You may distribute this code under the same terms as Perl itself. | |||
50 | ||||
51 | =cut |