}
BEGIN {
- # reinstall the carp()/croak() functions imported into SQL::Abstract
- # as Carp and Carp::Clan do not like each other much
+ # reinstall the belch()/puke() functions of SQL::Abstract with custom versions
+ # that use Carp::Clan instead of plain Carp (they do not like each other much)
no warnings qw/redefine/;
- no strict qw/refs/;
- for my $f (qw/carp croak/) {
-
- my $orig = \&{"SQL::Abstract::$f"};
- my $clan_import = \&{$f};
- *{"SQL::Abstract::$f"} = subname "SQL::Abstract::$f" =>
- sub {
- if (Carp::longmess() =~ /DBIx::Class::SQLMaker::[\w]+ .+? called \s at/x) {
- goto $clan_import;
- }
- else {
- goto $orig;
- }
- };
- }
+
+ *SQL::Abstract::belch = subname 'SQL::Abstract::belch' => sub (@) {
+ my($func) = (caller(1))[3];
+ carp "[$func] Warning: ", @_;
+ };
+
+ *SQL::Abstract::puke = subname 'SQL::Abstract::puke' => sub (@) {
+ my($func) = (caller(1))[3];
+ croak "[$func] Fatal: ", @_;
+ };
+
+ # 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
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 = {
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}) {