|
|
|
@ -273,15 +273,29 @@ const parseConditionV2 = async (
|
|
|
|
|
let [field, val] = [_field, _val]; |
|
|
|
|
switch (filter.comparison_op) { |
|
|
|
|
case 'eq': |
|
|
|
|
if (qb?.client?.config?.client === 'mysql2') { |
|
|
|
|
// mysql is case-insensitive, turn to case-sensitive
|
|
|
|
|
qb = qb.whereRaw('BINARY ?? = ?', [field, val]); |
|
|
|
|
} else { |
|
|
|
|
qb = qb.where(field, val); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case 'neq': |
|
|
|
|
case 'not': |
|
|
|
|
if (qb?.client?.config?.client === 'mysql2') { |
|
|
|
|
// mysql is case-insensitive, turn to case-sensitive
|
|
|
|
|
qb = qb.where((nestedQb) => { |
|
|
|
|
nestedQb |
|
|
|
|
.whereRaw('BINARY ?? != ?', [field, val]) |
|
|
|
|
.orWhereNull(customWhereClause ? _val : _field); |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
qb = qb.where((nestedQb) => { |
|
|
|
|
nestedQb |
|
|
|
|
.whereNot(field, val) |
|
|
|
|
.orWhereNull(customWhereClause ? _val : _field); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case 'like': |
|
|
|
|
if (!val) { |
|
|
|
|