X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FSQLMaker.pm;h=1340165a825f097b506b37ea01a1331af232268b;hb=9c1700e39e6ee002d9294c0d988882d1f0d7d86f;hp=322ad336dffede41710975e19b5a930c861f212e;hpb=4c2b30d6e53cd05e570ad112e87ad6f96355f695;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/SQLMaker.pm b/lib/DBIx/Class/SQLMaker.pm index 322ad33..1340165 100644 --- a/lib/DBIx/Class/SQLMaker.pm +++ b/lib/DBIx/Class/SQLMaker.pm @@ -73,6 +73,9 @@ BEGIN { } }; } + + # Current SQLA pollutes its namespace - clean for the time being + namespace::clean->clean_subroutines(qw/SQL::Abstract carp croak confess/); } # the "oh noes offset/top without limit" constant @@ -215,7 +218,7 @@ sub select { sub _assemble_binds { my $self = shift; - return map { @{ (delete $self->{"${_}_bind"}) || [] } } (qw/select from where having order/); + return map { @{ (delete $self->{"${_}_bind"}) || [] } } (qw/select from where group having order/); } my $for_syntax = { @@ -317,8 +320,13 @@ sub _parse_rs_attrs { my $sql = ''; - if (my $g = $self->_recurse_fields($arg->{group_by}) ) { - $sql .= $self->_sqlcase(' group by ') . $g; + if ($arg->{group_by}) { + # horible horrible, waiting for refactor + local $self->{select_bind}; + if (my $g = $self->_recurse_fields($arg->{group_by}) ) { + $sql .= $self->_sqlcase(' group by ') . $g; + push @{$self->{group_bind} ||= []}, @{$self->{select_bind}||[]}; + } } if (defined $arg->{having}) {