Commit | Line | Data |
efe2cc83 |
1 | package DBIx::Class::Storage::DBI::AmbiguousGlob; |
2 | |
3 | use strict; |
4 | use warnings; |
5 | |
6 | use base 'DBIx::Class::Storage::DBI'; |
2ad62d97 |
7 | use mro 'c3'; |
efe2cc83 |
8 | |
9 | =head1 NAME |
10 | |
11 | DBIx::Class::Storage::DBI::AmbiguousGlob - Storage component for RDBMS supporting multicolumn in clauses |
12 | |
13 | =head1 DESCRIPTION |
14 | |
15 | Some servers choke on things like: |
16 | |
17 | COUNT(*) FROM (SELECT tab1.col, tab2.col FROM tab1 JOIN tab2 ... ) |
18 | |
19 | claiming that col is a duplicate column (it loses the table specifiers by |
20 | the time it gets to the *). Thus for any subquery count we select only the |
21 | primary keys of the main table in the inner query. This hopefully still |
22 | hits the indexes and keeps the server happy. |
23 | |
618a0fe3 |
24 | At this point the only overriden method is C<_subq_count_select()> |
efe2cc83 |
25 | |
26 | =cut |
27 | |
618a0fe3 |
28 | sub _subq_count_select { |
29 | my ($self, $source, $rs_attrs) = @_; |
30 | my @pcols = map { join '.', $rs_attrs->{alias}, $_ } ($source->primary_columns); |
31 | return @pcols ? \@pcols : [ 1 ]; |
efe2cc83 |
32 | } |
33 | |
34 | =head1 AUTHORS |
35 | |
36 | See L<DBIx::Class/CONTRIBUTORS> |
37 | |
38 | =head1 LICENSE |
39 | |
40 | You may distribute this code under the same terms as Perl itself. |
41 | |
42 | =cut |
43 | |
44 | 1; |