I found the function that I would need to modify (see below).
|static void icuCaseFunc16(sqlite3_context *p, int nArg,
sqlite3_value **apArg){
const UChar *zInput;
UChar *zOutput;
int nInput;
int nOutput;
UErrorCode status = U_ZERO_ERROR;
const char *zLocale = 0;
assert(nArg==1 || nArg==2);
if( nArg==2 ){
zLocale = (const char *)sqlite3_value_text(apArg[1]);
}
zInput = sqlite3_value_text16(apArg[0]);
if( !zInput ){
return;
}
nInput = sqlite3_value_bytes16(apArg[0]);
nOutput = nInput * 2 + 2;
zOutput = sqlite3_malloc(nOutput);
if( !zOutput ){
return;
}
if( sqlite3_user_data(p) ){
u_strToUpper(zOutput, nOutput/2, zInput, nInput/2, zLocale,
&status);
}else{
u_strToLower(zOutput, nOutput/2, zInput, nInput/2, zLocale,
&status);
}
if( !U_SUCCESS(status) ){
icuFunctionError(p, "u_strToLower()/u_strToUpper", status);
return;
}
sqlite3_result_text16(p, zOutput, -1, xFree);
}
|
Given that there exists a table db_locale [CREATE TABLE db_locale
(locale text)],
what lines of code would be used to query that table from inside this
function?
*Grace Batumbya*
Research Assistant | Seneca CDOT
Phone: 416-491-5050 x3548
cdot.senecac.on.ca <http://cdot.senecac.on.ca/>
On 3/1/2012 08:56, Grace Batumbya wrote:
Is there an example extension you know that I could look at that does this? (i
am a novice at SQLite)
________________________________________
From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on
behalf of Pavel Ivanov [paiva...@gmail.com]
Sent: March 1, 2012 8:52 AM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] Set Locale for upper() and lower() using a pragma variable
On Thu, Mar 1, 2012 at 8:50 AM, Grace Batumbya
<grace.batum...@senecacollege.ca> wrote:
You can simply register your
own lower/upper with one argument that looks wherever you want to know
what locale to use.
The part of registering a function to override lower/upper I think I understand.
But if I wanted to persist the locale, so that even if I disconnect and
reconnect it is still set to the last time I set it, how do I go about
accomplishing this.
Create a special table for that and store your last locale value in
it. Then after reconnect read the locale value from this table.
Pavel
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users