Re: [sqlite] Sorting Japanese records

2008-02-12 Thread Cory Nelson
On Feb 12, 2008 9:17 PM, Mahalakshmi.m
<[EMAIL PROTECTED]> wrote:
> Hi,
> I am working in 3.3.6
>
> My database looks as follows:
> "Create table MUSIC (id integer primary key,Track text);"
>
> I have inserted some Japanese records inside and I tried to list all the
> tracks sorted by Tracks.
>
> "select Tracks from MUSIC order by Track;" [ All records are Japanese Full
> Size Katakana ]
>

If you aren't getting the expected results you might try creating a
custom collation.  But afaik hiragana and katakana should both sort
fine, as both are in lexicographical order (ie, あかさたなはまやらわ) which is
what sqlite uses by default.

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


[sqlite] Sorting Japanese records

2008-02-12 Thread Mahalakshmi.m
Hi,

 

I am working in 3.3.6

 

My database looks as follows:

 

"Create table MUSIC (id integer primary key,Track text);"

 

I have inserted some Japanese records inside and I tried to list all the
tracks sorted by Tracks.

 

"select Tracks from MUSIC order by Track;" [ All records are Japanese Full
Size Katakana ]

 

But I am not getting the results in sorting order.

I have created the table in UTF-16 encoding format.this I did by just
enabling the "PRAGMA encoding = UTF16;" before creating the table.

Then while inserting I will use as follows.

 

if (
sqlite3_prepare(pst_CallbackInstance->db,"INSERT OR IGNORE INTO MUSIC (
Track ) VALUES ( ? );",-1,_ PrepareStmt,0)!= SQLITE_OK) 

{

return SQLITE_DB_ERROR;

}

else

{

sqlite3_bind_text16 (pst_PrepareStmt,1,
TrackName,-1,SQLITE_STATIC);



sqlite3_step (pst_ PrepareStmt);

 

i_Return = sqlite3_finalize (pst_
PrepareStmt);

 

if( i_Return || ps8_SqliteErrMsg )

{

if( ps8_SqliteErrMsg!=0 )

{

#ifdef
PRINTF_ENABLED

 
printf("SQL error: %s\n", ps8_SqliteErrMsg);

#endif

 
sqlite3_free(ps8_SqliteErrMsg);

ps8_SqliteErrMsg
= 0;

}

}

else

{

e_ReturnStatus =
SQLITE_DB_SUCCESS;  

}

}

 

Will the above function  insert the track name in UTF16 format inside
Database  or I am wrong some where ?

 

I want the Tracks to be in Sorted order [ All track are inserted as UTF16 -
Japanese letters ]

Can I use UTF8 itself for doing this.

 

Can Anyone help to solve this.

 

Thanks & Regards,

Mahalakshmi.M

 

 

 

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