← Index
Performance Profile   « block view • line view • sub view »
For /wise/base/deliv/dev/bin/getfix
  Run on Thu May 20 15:30:03 2010
Reported on Thu May 20 16:25:26 2010

File/wise/base/static/lib/perl5/site_perl/5.10.0/DBIx/Class/Storage/DBI/MultiDistinctEmulation.pm
Statements Executed118
Total Time0.000656 seconds

Subroutines — ordered by exclusive time
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
4110.00034483.44368DBIx::Class::Storage::DBI::MultiDistinctEmulation::_select
23110.000170.00017DBIx::Class::Storage::DBI::MultiDistinctEmulation::replace_distincts
00000DBIx::Class::Storage::DBI::MultiDistinctEmulation::BEGIN

LineStmts.Exclusive
Time
Avg.Code
1package DBIx::Class::Storage::DBI::MultiDistinctEmulation;
2
337.1e-52.4e-5use strict;
# spent 47µs making 1 call to strict::import
433.8e-51.3e-5use warnings;
# spent 17µs making 1 call to warnings::import
5
630.000206.8e-5use 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
sub _select {
9390.000246.2e-6 my ($self, $ident, $select, $condition, $attrs) = @_;
10
11 # hack to make count distincts with multiple columns work in SQLite and Oracle
12 if (ref $select eq 'ARRAY') {
13 @{$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
sub replace_distincts {
22699.7e-51.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
3113.0e-63.0e-61;
32
33=head1 NAME
34
35DBIx::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
41This class allows count distincts with multiple columns for retarded databases (Oracle and SQLite)
42
43=head1 AUTHORS
44
45Luke Saunders <luke.saunders@gmail.com>
46
47=head1 LICENSE
48
49You may distribute this code under the same terms as Perl itself.
50
51=cut