|
|
@ -284,21 +284,28 @@ const parseConditionV2 = async ( |
|
|
|
}); |
|
|
|
}); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 'like': |
|
|
|
case 'like': |
|
|
|
|
|
|
|
if (!val) { |
|
|
|
|
|
|
|
// val is empty -> all values including empty strings but NULL
|
|
|
|
|
|
|
|
qb.where(field, ''); |
|
|
|
|
|
|
|
qb.orWhereNotNull(field); |
|
|
|
|
|
|
|
} else { |
|
|
|
if (column.uidt === UITypes.Formula) { |
|
|
|
if (column.uidt === UITypes.Formula) { |
|
|
|
[field, val] = [val, field]; |
|
|
|
[field, val] = [val, field]; |
|
|
|
val = `%${val}%`.replace(/^%'([\s\S]*)'%$/, '%$1%'); |
|
|
|
val = `%${val}%`.replace(/^%'([\s\S]*)'%$/, '%$1%'); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
val = val.startsWith('%') || val.endsWith('%') ? 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]); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
qb = qb.where(field, 'like', val); |
|
|
|
qb = qb.where(field, 'like', val); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 'nlike': |
|
|
|
case 'nlike': |
|
|
|
if (!val) { |
|
|
|
if (!val) { |
|
|
|
// val is empty -> include all values but empty strings
|
|
|
|
// val is empty -> all values including NULL but empty strings
|
|
|
|
qb.whereNot(field, ''); |
|
|
|
qb.whereNot(field, ''); |
|
|
|
qb.orWhereNull(field); |
|
|
|
qb.orWhereNull(field); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|