whereNotLike method
Adds a NOT LIKE condition to the query.
field is the column to match.
pattern is the SQL pattern.
caseSensitive determines if the match is case-sensitive.
escape determines if special characters in the pattern are escaped.
Implementation
QueryBuilder whereNotLike(String field, String pattern,
{bool caseSensitive = false, bool escape = true}) {
final paramName = 'p${_paramIndex++}';
final processedPattern = escape ? _escapeLike(pattern) : pattern;
if (DB.driver == DBDriver.postgres) {
final sql = caseSensitive
? '$field NOT LIKE :$paramName'
: '$field NOT ILIKE :$paramName';
_wheres.add(sql);
} else {
final sql = caseSensitive
? '$field NOT LIKE ?'
: 'LOWER($field) NOT LIKE LOWER(?)';
_wheres.add(sql);
}
_bindings[paramName] = processedPattern;
return this;
}