Remove sets::isin references

This commit is contained in:
Isaac Connor 2022-02-28 15:41:57 -05:00
parent eee6053293
commit addfdcd330
1 changed files with 10 additions and 4 deletions

View File

@ -466,11 +466,17 @@ $log->debug("find_operators: field($field) type($type) op($operator) value($valu
my $add_placeholder = ( ! ( $field =~ /\?/ ) ) ? 1 : 0; my $add_placeholder = ( ! ( $field =~ /\?/ ) ) ? 1 : 0;
if ( sets::isin( $operator, [ '=', '!=', '<', '>', '<=', '>=', '<<=' ] ) ) { if ( $operator eq '='
or $operator eq '!='
or $operator eq '<'
or $operator eq '>'
or $operator eq '<='
or $operator eq '>='
or $operator eq '<<=' ) {
return ( $field.$type.' ' . $operator . ( $add_placeholder ? ' ?' : '' ), $value ); return ( $field.$type.' ' . $operator . ( $add_placeholder ? ' ?' : '' ), $value );
} elsif ( $operator eq 'not' ) { } elsif ( $operator eq 'not' ) {
return ( '( NOT ' . $field.$type.')', $value ); return ( '( NOT ' . $field.$type.')', $value );
} elsif ( sets::isin( $operator, [ '&&', '<@', '@>' ] ) ) { } elsif ( $operator eq '&&' or $operator eq '<@' or $operator eq '@>' ) {
if ( ref $value eq 'ARRAY' ) { if ( ref $value eq 'ARRAY' ) {
if ( $field =~ /^\(/ ) { if ( $field =~ /^\(/ ) {
return ( 'ARRAY('.$field.$type.') ' . $operator . ' ?', $value ); return ( 'ARRAY('.$field.$type.') ' . $operator . ' ?', $value );
@ -482,7 +488,7 @@ my $add_placeholder = ( ! ( $field =~ /\?/ ) ) ? 1 : 0;
} # end if } # end if
} elsif ( $operator eq 'exists' ) { } elsif ( $operator eq 'exists' ) {
return ( $value ? '' : 'NOT ' ) . 'EXISTS ' . $field.$type; return ( $value ? '' : 'NOT ' ) . 'EXISTS ' . $field.$type;
} elsif ( sets::isin( $operator, [ 'in', 'not in' ] ) ) { } elsif ( $operator eq 'in' or $operator eq 'not in' ) {
if ( ref $value eq 'ARRAY' ) { if ( ref $value eq 'ARRAY' ) {
return ( $field.$type.' ' . $operator . ' ('. join(',', map { '?' } @{$value} ) . ')', @{$value} ); return ( $field.$type.' ' . $operator . ' ('. join(',', map { '?' } @{$value} ) . ')', @{$value} );
} else { } else {
@ -492,7 +498,7 @@ my $add_placeholder = ( ! ( $field =~ /\?/ ) ) ? 1 : 0;
return ( '? IN '.$field.$type, $value ); return ( '? IN '.$field.$type, $value );
} elsif ( $operator eq 'does not contain' ) { } elsif ( $operator eq 'does not contain' ) {
return ( '? NOT IN '.$field.$type, $value ); return ( '? NOT IN '.$field.$type, $value );
} elsif ( sets::isin( $operator, [ 'like','ilike' ] ) ) { } elsif ( $operator eq 'like' or $operator eq 'ilike' ) {
return $field.'::text ' . $operator . ' ?', $value; return $field.'::text ' . $operator . ' ?', $value;
} elsif ( $operator eq 'null_or_<=' ) { } elsif ( $operator eq 'null_or_<=' ) {
return '('.$field.$type.' IS NULL OR '.$field.$type.' <= ?)', $value; return '('.$field.$type.' IS NULL OR '.$field.$type.' <= ?)', $value;