Automatically setting TOraSession.Options.UseUnicode property

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
menta
Posts: 4
Joined: Wed 27 Oct 2010 13:10

Automatically setting TOraSession.Options.UseUnicode property

Post by menta » Fri 16 Nov 2012 11:30

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

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Automatically setting TOraSession.Options.UseUnicode property

Post by AlexP » Fri 16 Nov 2012 11:50

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

menta
Posts: 4
Joined: Wed 27 Oct 2010 13:10

Re: Automatically setting TOraSession.Options.UseUnicode property

Post by menta » Mon 19 Nov 2012 15:18

Thank you for your reply!

Lorenzo

Post Reply