encodeConditionValuesWithOperator method
Implementation
FutureOr<EncodingContext> encodeConditionValuesWithOperator(
EncodingContext context,
Type keyType,
String? fieldKey,
String tableKey,
String operator,
dynamic values,
bool valueAsList,
) {
context.write(' ');
context.write(tableKey);
context.write(' ');
// The encoding value rather than only its text: a null supplied as a
// parameter encodes to a placeholder, so the text alone cannot say whether
// the comparison is against null.
var valueRet = valueToParameterValue(
context,
values,
fieldKey: fieldKey,
fieldType: keyType,
valueAsList: valueAsList,
);
return valueRet.resolveMapped((value) {
if (isNullEncodingValue(value, context)) {
switch (operator) {
case '=':
case 'IN':
{
context.write('IS NULL ');
_markPlaceholderInlinedAsNull(value, context);
return context;
}
case '!=':
case 'NOT IN':
{
context.write('IS NOT NULL ');
_markPlaceholderInlinedAsNull(value, context);
return context;
}
}
}
context.write(operator);
context.write(' ');
context.write(value.encode);
context.write(' ');
return context;
});
}