Reputation: 3171
I'm trying to implement diacritic insensitive lookups in my SQLite database (on iOS). From what I've read, creating my own collation is the way to do this (please suggest alternatives if there are any). I've implemented the following:
static int _myFunction(void* context, int length1, const void* bytes1, int length2, const void* bytes2) {
NSLog (@"Compare");
...
}
...
int collationResult = sqlite3_create_collation(db, "custom", SQLITE_UTF8, NULL, _myFunction);
NSLog (@"%d", collationResult == SQLITE_OK);
This returns without error. But when I run the following command, no results return and none of the code in my function is called. (I'm trying to get a result of "Côte")
SELECT * FROM team WHERE name LIKE \"Cote%\" COLLATE custom
Does anyone have any ideas?
Upvotes: 0
Views: 445
Reputation: 180080
As specified in the documentation, the built-in LIKE and GLOB operators always uses the NOCASE or BINARY collation.
You could override this by implementing your own user-defined like
function.
Upvotes: 2