build method
String
build({
- required SQLDialect dialect,
- Map<
String, dynamic> ? variables, - List<
SQL> ? executedSqls,
override
Implementation
@override
String build(
{required SQLDialect dialect,
Map<String, dynamic>? variables,
List<SQL>? executedSqls}) {
Object? value = this.value;
final q = dialect.q;
if (value != null && WithVariables.isVariableValue(value)) {
value = SQL.resolveVariableValue(value, variables, executedSqls);
}
var v = switch (value) {
num() => '$value',
String() => "'$value'",
List() => value.first,
_ => value?.toString() ?? 'null',
};
if (equalsIgnoreAsciiCase(v, 'null')) {
if (op == '=') {
return '$q$field$q IS NULL';
} else if (op == '!=' || op == '<>') {
return '$q$field$q IS NOT NULL';
}
}
return '$q$field$q $op $v';
}