Hi ,

We are facing some issues now, when we need to make SQL queries and in our 
databases there are non ASCII characters, and SQL queries should be case 
insensitive ..

Then I read from the documentationn about enable ICU for sqlite

So I defined

#define SQLITE_ENABLE_ICU

Then I try call to create collation:

        int iRetVal = 
sqlite3_create_collation(m_sqliteDb,pstrDbName,SQLITE_UTF8,NULL,sqliteLocaleAwareCompare);

which returns SQLITE_OK

and then I implemented as a test following method:

    int sqliteLocaleAwareCompare(void *, int ll, const void *l, int rl,
const void *r)
{
    QString left = QString::fromUtf8((const char*)l);
    QString right = QString::fromUtf8((const char *)r);
    //qLog(Sql) << "comparing:" << left << "with" << right << "result"
    return QString::localeAwareCompare(left, right);
}


To do the comparison ..

But this sqliteLocaleAwareCompare never gets called when query is executed to 
database

Then I was wondering that should I do that create_collation to this following 
method defined in sqlite3.c but that never succeeded
static int icuLikeCompare(
  const uint8_t *zPattern,   /* LIKE pattern */
  const uint8_t *zString,    /* The UTF-8 string to compare against */
  const UChar32 uEsc         /* The escape character */

Now I just wonder which way to proceed ?

Br. Jarno




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

Reply via email to