add group_by and having in ExtraClauses
[scpubgit/Q-Branch.git] / lib / SQL / Abstract / ExtraClauses.pm
CommitLineData
1ff9018c 1package SQL::Abstract::ExtraClauses;
2
3use strict;
4use warnings;
5use if $] < '5.010', 'MRO::Compat';
6use mro 'c3';
7use base qw(SQL::Abstract::Clauses);
8
9BEGIN { *puke = \&SQL::Abstract::puke }
10
11sub new {
12 my ($proto, @args) = @_;
13 my $new = $proto->next::method(@args);
14 $new->{clauses_of}{select} = [
15 @{$new->{clauses_of}{select}}, qw(group_by having)
16 ];
17 $new->{expand_clause}{'select.group_by'} = sub {
18 $_[0]->_expand_maybe_list_expr($_[1], -ident)
19 };
20 $new->{expand_clause}{'select.having'} = sub {
21 $_[0]->expand_expr($_[1], -ident)
22 };
23 return $new;
24}
25
261;