[freetds] Unicode strings in queries
gribunin at zelnet.ru
Thu Aug 17 04:21:08 EDT 2006
I know that UNICODE issues have been discussed a lot in this mailing list,
but I haven't managed to find solution to my particular problem, though I
have rummaged about in all threads.
I have C++ client working under FreeBSD and MS SQL. I call procedures from
C++ client, which require NVARCHAR parameters. My client program operates
with wide char strings (uses wchar_t and wstring). The problem is that I
don't know how to build and execute query which contains wide char
I need something like that:
const wchar_t* query = L"EXEC SomeProc 'national_symbols_here'";
But tds_submit_query expects only 1-byte strings, so I have no idea how to
I know TDS uses UCS-2 encoding in its protocol. I would be glad to convert
all my strings to UCS-2 and pass it to FreeTDS functions but, again, I don't
know how to do that.
My program is supposed to be multi-language so I can't afford to myself to
stick to one particular codepage. And the most convenient way to handle
multi-language string is using wchar_t based strings.
Have I missed any obvious solution to my problem? Or may be somebody knows
some kind of workaround? I have already started to think about encoding all
string parameters to Base64 and decoding them in database, and this way
definitely looks UGLY for me.
Thank you in advance,
More information about the FreeTDS