Hello folks, long time no see.
I have a quicky...
I need some advice with the way I am dealing with SQLite data extraction functions. The culprit is one - of two, I don't use the other - function that returns an UTF-8 text representation of a single column of the current result row. The prototype is:
My implementation defines "char" as being of type signed char by default. So, in order to put the result of ths function into a std::string I first need to cast it to the appropriate type:Code:const unsigned char* sqlite3_column_text(sqlite3_stmt*, int);
I'm only partially worried with the resulting data loss since the database in question only uses characters in the acceptable range (english characters only). However two question arise:Code:char* result = reinterpret_cast<char*>( sqlite3_column_text(/*...*/) );
1. Can I do better than a reinterpret_cast? Again data loss is no concern.
2. What if data loss becomes a concern? How can I handle this? The problem is that the character 'ó', for instance, is well within the capabilities of a signed char. However the cast alters that and renders latin characters unusable.