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