toSQL method
Generates the SQL representation with proper escaping and wildcards.
Escapes the value and any existing % characters, then adds wildcards as configured.
Returns the quoted string with wildcards for LIKE operations.
Example:
QVarLike('John', left: false, right: true).toSQL(); // "'John%'"
QVarLike('50%', left: true, right: false).toSQL(); // "'%50\\%'"
Implementation
@override
String toSQL() {
var res = QVar.escape(value).replaceAll('%', '\\%');
if (left) {
res = '%$res';
}
if (right) {
res = '$res%';
}
return "'$res'";
}