use List::Util 'first';
use Scalar::Util 'blessed';
use Sub::Name 'subname';
+use DBIx::Class::_Util qw(is_plain_value is_literal_value);
use namespace::clean;
#
}
$self->throw_exception ( sprintf
- 'A required group_by clause could not be constructed automatically due to a complex '
- . 'order_by criteria (%s). Either order_by columns only (no functions) or construct a suitable '
- . 'group_by by hand',
+ 'Unable to programatically derive a required group_by from the supplied '
+ . 'order_by criteria. To proceed either add an explicit group_by, or '
+ . 'simplify your order_by to only include plain columns '
+ . '(supplied order_by: %s)',
join ', ', map { "'$_'" } @$leftovers,
) if $leftovers;
my ($l, $r) = %$p;
- push @conds, ( ! ref $r or overload::Method($r, '""' ) )
+ push @conds, ( ! length ref $r or is_plain_value($r) )
? { $l => $r }
: { $l => { '=' => $r } }
;
for my $c (keys %$where_hash) {
if (defined (my $v = $where_hash->{$c}) ) {
if (
- ! ref $v
+ ! length ref $v
or
- (ref $v eq 'HASH' and keys %$v == 1 and defined $v->{'='} and (
- ! ref $v->{'='}
- or
- ref $v->{'='} eq 'SCALAR'
- or
- ( ref $v->{'='} eq 'REF' and ref ${$v->{'='}} eq 'ARRAY' )
- or
- overload::Method($v->{'='}, '""')
- ))
+ is_plain_value ($v)
+ or
+ (
+ ref $v eq 'HASH'
+ and
+ keys %$v == 1
+ and
+ ref $v->{'='}
+ and
+ is_literal_value($v->{'='})
+ )
) {
$res->{$c} = 1;
}