Hi i am using sqlite FTS4 and my .sqlite file is in the main Bundle, i implemented this function mentioned here How to deal with accented characters in iOS SQLite?
void unaccented(sqlite3_context *context, int argc, sqlite3_value **argv)
{
if (argc != 1 || sqlite3_value_type(argv[0]) != SQLITE_TEXT) {
sqlite3_result_null(context);
return;
}
@autoreleasepool {
NSMutableString *string = [NSMutableString stringWithUTF8String:(const char *)sqlite3_value_text(argv[0])];
CFStringTransform((__bridge CFMutableStringRef)string, NULL, kCFStringTransformStripCombiningMarks, NO);
sqlite3_result_text(context, [string UTF8String], -1, SQLITE_TRANSIENT);
}
}
- (void)createUnaccentedFunction
{
if (sqlite3_create_function_v2(euph, "unaccented", 1, SQLITE_ANY, NULL, &unaccented, NULL, NULL, NULL) != SQLITE_OK)
NSLog(@"%s: sqlite3_create_function_v2 error: %s", __FUNCTION__, sqlite3_errmsg(euph));
}
the following query that i need does not work (query OK but no results),
SELECT term_id,eng_term, ara_term, type_id FROM mainporter where unaccented(ara_term) MATCH '%@'
But when using an old column that i removed accentuation from manually, i can get results unaccented. so the functions is working fine
SELECT term_id,eng_term, unaccented(ara_term), type_id FROM mainporter where ara_term_2 MATCH '%@'
Any suggestions ? Sorry i had to start a new question but i can't comment as i don't have 50+ reputation (thumbs up) !!