encodeString function
Encodes the given string (s
) into the format: E'xxx'
Note: the null character (
\u0000
) will be removed, since PostgreSql won't accept it.
Implementation
String encodeString(String? s) {
if (s == null) return ' null ';
var escaped = s.replaceAllMapped(_escapeRegExp, _escape);
return " E'$escaped' ";
}