silverstripe/sapphire — pull request #1011 by chillu (2012-12-10 23:07:56+00:00)
Title: BUG Using GLOB for case sensitive matches in SQLite3

As opposed to LIKE, the GLOB operator is case sensitive by default
in SQlite3. It uses "*" instead of "%" for wildcards,
which necessitated a new SearchFilter->getWildcard() method.

SQlite3 doesn't support per-term modifiers,
COLLATE BINARY LIKE is case insensitive by default
unless the field collation is set up accordingly.
There's connection-level modifiers (PRAGMA case_sensitive_like = true),
but that would affect all comparisators in the executed query.

Note that this doesn't escape asterisk wildcards in the searched string in any way.
That's no different from existing logic though, percent wildcards aren't escaped either.
Is this a bug, or a feature? It might be handy to pass in further
wildcards in the searched term through the highlevel APIs.
If its a feature, we need to convert any percents to asterisks.

This code should be contained in the DB driver instead,
but needs more refactoring, there's a *lot* of duplication
in there already. For now it fixes this
aspect of the SQlite3 builds, which enables us
to work with a more responsive test suite again.