Page 1 of 1

Automatically setting TOraSession.Options.UseUnicode property

Posted: Fri 16 Nov 2012 11:30
by menta
Hi all,
If I set session property "UseUnicode" to true, all string fields are handled as TWideString, and this allows me to read/write 16 bit characters to db.

The problem is that I can set this property event in a session connected to a non unicode db, potentially generating unclear behaviors when trying to insert non ascii characters.

Is there a way to understand from the program if the database is unicode, and setting consequetly "UseUnicode" session property?

Thank you,

Cheers,

Lorenzo

Re: Automatically setting TOraSession.Options.UseUnicode property

Posted: Fri 16 Nov 2012 11:50
by AlexP
Hello,

One of the variants of checking Unicode support on the server can be to check the VALUE field from the V$NLS_PARAMETERS view for presence of UTF data in this field, this can be checked by performing the following query:

Code: Select all

SELECT count(*) FROM V$NLS_PARAMETERS
WHERE PARAMETER = 'NLS_CHARACTERSET'
AND VALUE LIKE '%UTF%'
and if the query returns not 0, the server is Unicode

Re: Automatically setting TOraSession.Options.UseUnicode property

Posted: Mon 19 Nov 2012 15:18
by menta
Thank you for your reply!

Lorenzo