[odb-users] SQLite and std::wstring

Boris Kolpackov boris at codesynthesis.com
Fri Jun 8 09:52:53 EDT 2012


Hi Phil,

philly.dilly at gmail.com <philly.dilly at gmail.com> writes:

> Although utf8 is generally a more compact encoding, in my case I will be  
> using wstring since my application deals with a lot of non latin 
> languages and processing utf16 is a lot easier.

Yes, I understand that you want to use wstring/UTF-16 in the application.
What I was curious about is which encoding you were planning to use in
the database (you have a choice of UTF-8 or UTF-16, and it seems UTF-8 is
generally recommended since it results in a more compact database and thus
better performance).


> I tried mapping std::wstring to TEXT with pragmas but then I got some
> compilation errors about wrong number of arguments or something.

Yes, since there is not built-in support for std::wstring (yet), you will
need to implement a value_traits specialization for it which will need to
convert to/from UTF-8, since that's the only "image" currently supported
by ODB for SQLite TEXT. The 'mapping' example has more information on how
to do this.

Boris



More information about the odb-users mailing list