Art wrote:


questions:
when enumerating the tables and indices - should these be passed back as mbcs or sbcs? 
exec( "select * from sqlite_master;" )

since there is no sqlite_exec16 call, does the sqlite_open16 force all data to be sent 
back as mbcs?  if so, why am i getting pointers with data in char* format vs wchar_t 
format?    when doing sqlite_exec("select * from user_data;") calls

using sqlite v3.3.5
windows win32 sdk - no mfc routines are in a win32 dll that load the sqlite.dll 
and call the sqlite routines.

recap:
sqlite_open16 works. i can dump the db and physically see that the data is 
stored in utf-16 format. data sent back is in char * format.
Art,

Your problems probably stems from the way you, or the wrapper or are using, retrieves text data. Are you using a wrapper? If so, which one?

The sqlite3_open16() function passes the name of the file as UTF-16. It also sets the encoding of a newly created database to UTF-16 as a side effect. It has no effect on a the encoding of a preexisting database file. You can check the encoding for your database using the "pragma encoding" query. Note, this command can only be used to change the encoding of a new empty database file (i.e. as the first command executed on a new database file).

When you retrieve data from the database you (or your wrapper) need to use the sqlite3_column_text16() API to get the data in UTF-16 format. If you use sqlite3_column_text() to retrieve data from a UTF-16 encoded database, SQLite will convert the data to UTF-8 and return the converted string.

If you are using the obsolete sqlite3_get_table() API I believe it will always return the data encoded in UTF-8.

HTH
Dennis Cote


Reply via email to