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;
#
my @cols = (
( map { $_->[0] } $self->_extract_order_criteria($order_by) ),
( $where ? @{ $self->_extract_fixed_condition_columns($where) || [] } : () ),
- ) or return undef;
+ ) or return 0;
my $colinfo = $self->_resolve_column_info($ident, \@cols);
return keys %$colinfo
? $self->_columns_comprise_identifying_set( $colinfo, \@cols )
- : undef
+ : 0
;
}
return 1 if $src->_identifying_column_set($_);
}
- return undef;
+ return 0;
}
-# this is almost identical to the above, except it accepts only
+# this is almost similar to _order_by_is_stable, except it takes
# a single rsrc, and will succeed only if the first portion of the order
# by is stable.
# returns that portion as a colinfo hashref on success
-sub _main_source_order_by_portion_is_stable {
+sub _extract_colinfo_of_stable_main_source_order_by_portion {
my ($self, $main_rsrc, $order_by, $where) = @_;
die "Huh... I expect a blessed result_source..."
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;
}