MT#57100 avoid where ambiguity for query_types search_eq,search_like

* uses prefix 'me.' for query types search_eq and search_like
  in the where condition to avoid ambiguity if the search_rs
  has joins that with the same column names

Change-Id: I90fef80970aa4415480b00bbed2fb9fbee1f1ccc
mr11.4
Kirill Solomko 3 years ago
parent dd9d57c33b
commit c58a8b9b1f

@ -26,7 +26,7 @@ sub query_params {
query => { query => {
first => sub { first => sub {
my $q = shift; my $q = shift;
return { 'contract_id' => lc($q) eq 'null' ? undef : $q }; return { 'me.contract_id' => lc($q) eq 'null' ? undef : $q };
}, },
second => sub {}, second => sub {},
}, },

@ -1158,10 +1158,14 @@ sub get_query_callbacks{
my @p = @$query_param_spec; my @p = @$query_param_spec;
my($sub_where,$sub_attributes); my($sub_where,$sub_attributes);
if($p[0]->{query_type}){ if($p[0]->{query_type}){
my $param = $p[0]->{param};
if ($param !~ /\./) {
$param = 'me.' . $param;
}
if('string_like' eq $p[0]->{query_type}){ if('string_like' eq $p[0]->{query_type}){
$sub_where = sub {my ($q, $c) = @_; { $p[0]->{param} => { like => $q } };}; $sub_where = sub {my ($q, $c) = @_; { $param => { like => $q } };};
}elsif('string_eq' eq $p[0]->{query_type}){ }elsif('string_eq' eq $p[0]->{query_type}){
$sub_where = sub {my ($q, $c) = @_; { $p[0]->{param} => $q };}; $sub_where = sub {my ($q, $c) = @_; { $param => $q };};
} }
} }
if($p[0]->{query}){ if($p[0]->{query}){

Loading…
Cancel
Save