dbic_internal_try dump_value
fail_on_internal_wantarray fail_on_internal_call UNRESOLVABLE_CONDITION
);
+use DBIx::Class::SQLMaker::Util qw( normalize_sqla_condition extract_equality_conditions );
use Try::Tiny;
BEGIN {
(ref $_ eq 'HASH' and ! keys %$_)
) and $_ = undef for ($left, $right);
- # either one of the two undef
- if ( (defined $left) xor (defined $right) ) {
- return defined $left ? $left : $right;
- }
- # both undef
- elsif ( ! defined $left ) {
- return undef
- }
- else {
- return $self->result_source->schema->storage->_collapse_cond({ -and => [$left, $right] });
- }
+ return(
+ # either one of the two undef
+ ( (defined $left) xor (defined $right) ) ? ( defined $left ? $left : $right )
+
+ # both undef
+ : ( ! defined $left ) ? undef
+
+ : { -and => [$left, $right] }
+ );
}
=head2 search_literal
@cols_from_relations = keys %{ $implied_data || {} };
}
else {
- my $eqs = $self->result_source->schema->storage->_extract_fixed_condition_columns($self->{cond}, 'consider_nulls');
+ my $eqs = extract_equality_conditions( $self->{cond}, 'consider_nulls' );
$implied_data = { map {
( ($eqs->{$_}||'') eq UNRESOLVABLE_CONDITION ) ? () : ( $_ => $eqs->{$_} )
} keys %$eqs };
if ( $attrs->{rows} =~ /[^0-9]/ or $attrs->{rows} <= 0 );
}
+ # normalize where condition
+ $attrs->{where} = normalize_sqla_condition( $attrs->{where} )
+ if $attrs->{where};
# default selection list
$attrs->{columns} = [ $source->columns ]