typedef struct 
{
  unsigned short s8_ArtistName[256];  

}STRUCT_SQLITE_MY_RECORD;

 UINT32                       u32_Return;
 const UINT16                 *u16_SearchResult;
 STRUCT_SQLITE_MY_RECORD      st_SQLITE_DB_Record; 
 sqlite3*                               db;
 sqlite3_stmt*                  insert; 

 
  u32_Return = sqlite3_open("mysqlite.db ", &db);

  u32_Return = sqlite3_exec(db, "pragma encoding= UTF16", 0, 0, 0);
  u32_Return = sqlite3_exec(db, "create table ARTIST(id  integer primary key
not null , ArtistName  test not null collate nocase )", 0, 0, 0);

  u32_Return = sqlite3_prepare(db,"INSERT INTO ARTIST (ArtistName)
VALUES(?);",-1,&insert,0);
{
    I will call this loop 2 times for inserting 2 records at run time.
    memset(&st_SQLITE_DB_Record,0,sizeof(STRUCT_SQLITE_MY_RECORD));
    memcpy(st_SQLITE_DB_Record.s8_ArtistName,tmp_str,strlen(tmp_str)*sizeof(
short));
    u32_Return = sqlite3_bind_text16(insert,1,(char *)
st_SQLITE_DB_Record.s8_ArtistName,-1,SQLITE_STATIC); -->input will be in
UTF16 format.If it is utf8 I will convert it to utf16 and then I will bind.
    u32_Return = sqlite3_step(insert);

    u32_Return = sqlite3_reset(insert);
}
  u32_Return = sqlite3_finalize(insert);

  u32_Return = sqlite3_prepare(db,"SELECT ArtistName from ARTIST order by
ArtistName;",-1,&insert,0);
  u32_Return = sqlite3_step(insert);
 
  while( u32_Return == SQLITE_ROW )
   {
    u16_SearchResult=sqlite3_column_text16(insert,0);
    printf(u16_SearchResult);
    printf("\n");
    u32_Return = sqlite3_step(insert);
   }
  u32_Return = sqlite3_finalize(insert);
  u32_Return = sqlite3_close(db);

I tried like this and I didn’t got .
   



 
 


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

Reply via email to