I need to perform a SELECT queries that are insensitive to case and accents. For demo purposes, I create a table like that:
create table table
(
column tex
Here is my solution of LIKE problem
static void myLow(sqlite3_context *context, int argc, sqlite3_value **argv)
{
NSString* str = [[NSString alloc] initWithUTF8String:
(const char *)sqlite3_value_text(argv[0])];
const char* s = [[str lowercaseString] UTF8String];
sqlite3_result_text(context, s, strlen(s), NULL);
[str release];
}
// call it once after opening db
sqlite3_create_function(_db, "myLow", 1, SQLITE_UTF8,NULL, &myLow, NULL, NULL);
And then instead of query
SELECT * FROM table WHERE column LIKE 'a'
you should use
SELECT * FROM table WHERE myLow(column) LIKE 'a'