vrogier / ocilib

OCILIB (C and C++ Drivers for Oracle) - Open source C and C++ library for accessing Oracle databases

Home Page:http://www.ocilib.net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Handling special characters from C++

OCIntel opened this issue · comments

Ocilib version: 4.7.4
Charset mode: ANSI
Platform: Windows

Hello Vincent,

I would like to know how to indicate at the environment initialization that we want to use a specific charset?
By consulting a similar issue (#45 (comment)), I found a temporary working solution which implies to modify an environment variable, like this:

_putenv_s("NLS_LANG", "American_America.UTF8");
Environment::Initialize(Environment::Default | Environment::Threaded);
_putenv_s("NLS_LANG", "");

This solution works but is not viable for my project.

I also saw that you can specify the charset for a bind with SetCharsetForm, like this:

stmt->Bind(":1", val, INOUT_STRING_SIZE, BindInfo::In);
stmt->GetBind(":1").SetCharsetForm(CharsetFormValues::CharsetFormNational);

Apart from the fact that this option is only available for binding queries, it produces an error at compile time, which suggests that I am using the method incorrectly:

error LNK2019: unresolved external symbol OCI_BindSetCharsetForm referenced in function "public: void __cdecl ocilib::BindInfo::SetCharsetForm(class ocilib::core::Enum)" (?SetCharsetForm@BindInfo@ocilib@@QEAAXV?$Enum@W4CharsetFormValues@ocilib@@@core@2@@z)

Do you have any idea how to solve this problem?

Thanks for your help!

Hi,

Sorry for such a delayed response.

Regarding the linking issue that a bug in the C++ API that will be fixed in branch 4.7.5.
I will create a separate issue for it.

About specifying the charset, it can only be done currently in OCILIB using the nls_lang parameter and/or env variable .

I don't get your issue about "temporary setting" the variable.
Setting the variable can be done only at current process level.

Regards,

Vincent

Hi,

Any news ?

btw, I created an issue (#314) and committed a fix for the visibility of OCI_BindSetCharsetForm()

regards,

Vincent