Method FoldCase(string)

Assembly: redb.Core.dll

Wraps a text expression so the database folds its case for ALL scripts, not just ASCII.

Every case-insensitive operation goes through here, so the three of them
(ILIKE/LIKE, LOWER, UPPER) can never drift apart: fixing one and
forgetting another is exactly how a search finds a row that an equality check then rejects.


The mechanism differs per provider and that is deliberate, because the providers differ in
kind and not merely in syntax. PostgreSQL attaches a COLLATE clause to the operand.
MSSQL needs nothing: its default collation already folds every script. SQLite has no
collation that could help (its only case-insensitive one, NOCASE, is ASCII-only, and
LIKE is a function that ignores collations entirely), so its provider fixes the
problem one level down by overriding the built-in functions on the connection and returns
the expression untouched here.

Returns expression unchanged when the feature is off, so generated SQL is
byte-for-byte what it was.

string FoldCase(string expression)