Browse Source

improve like operator

Signed-off-by: Vijay Kumar Rathore <professional.vijay8492@gmail.com>
pull/4322/head
Vijay Kumar Rathore 2 years ago
parent
commit
4418106d33
  1. 4
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/conditionV2.ts

4
packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/conditionV2.ts

@ -285,7 +285,7 @@ const parseConditionV2 = async (
[field, val] = [val, field]; [field, val] = [val, field];
val = `%${val}%`.replace(/^%'([\s\S]*)'%$/, '%$1%'); val = `%${val}%`.replace(/^%'([\s\S]*)'%$/, '%$1%');
} else { } else {
val = `%${val}%`; val = val.startsWith('%') || val.endsWith('%') ? val : `%${val}%`;
} }
if (qb?.client?.config?.client === 'pg') { if (qb?.client?.config?.client === 'pg') {
qb = qb.whereRaw('??::text ilike ?', [field, val]); qb = qb.whereRaw('??::text ilike ?', [field, val]);
@ -298,7 +298,7 @@ const parseConditionV2 = async (
[field, val] = [val, field]; [field, val] = [val, field];
val = `%${val}%`.replace(/^%'([\s\S]*)'%$/, '%$1%'); val = `%${val}%`.replace(/^%'([\s\S]*)'%$/, '%$1%');
} else { } else {
val = `%${val}%`; val = val.startsWith('%') || val.endsWith('%') ? val : `%${val}%`;
} }
qb = qb.whereNot( qb = qb.whereNot(
field, field,

Loading…
Cancel
Save