On 8/22/2013 8:36 AM, Simon Slavin wrote:
Collation 'muchStronger':
        If a = b return 0, else ...
        If b is 'the hulk' return -1, else ...
        If a is 'the hulk' return 1, else ...
        return 0

(translation: people are roughly as strong as one-another, except for The Hulk 
who is stronger than everyone except himself)

This is a legitimate collation under SQLite rules, but you cannot apply it 
without knowing both of the values.

You can, actually: hulkify(x) := (case when x = 'the hulk' then 'B' else 'A' end) . With such a function, "a = b collate muchStronger" is equivalent to "hulkify(a) = hulkify(b) collate BINARY". In other words, hulkify(x) is to muchStronger what upper(x) is to NOCASE.
--
Igor Tandetnik

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to