Unicode trouble (five days spent)

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Serg Soorskih

Unicode trouble (five days spent)

Post by Serg Soorskih » Fri 25 Mar 2005 17:17

Hello, Core Lob!

We use now ODAC VCL 4.5 and have to support Unicode in our database.

Database

create table BA_DOMAIN_STRING
(
Hello, Core Lob!

We use now ODAC VCL 4.5 and have to support Unicode in our database.

Database

create table BA_DOMAIN_STRING
(
CODE VARCHAR2(255) not null,
DOMAIN_CD VARCHAR2(255) not null,
LANG_CD VARCHAR2(10) not null,
NAME NVARCHAR2(500) not null
)

Oracle Server 9.2
Oracle Client 9.2

Code


Delphi 6.0

TOraSql.Text=
'INSERT INTO BA_DOMAIN_STRING
("CODE", "DOMAIN_CD", "LANG_CD", "NAME")
VALUES
(:"CODE", :"DOMAIN_CD", :"LANG_CD", :"NAME")'

TOraSession.Options.UseUnicode= true;
All parametrs have type ftWideString

I have tested
1) TOraSql.Params.Value=SomeWideString
2) TOraSql.Params.Value=SomeOleVariant
3) TOraSql.Params.AsWideString=SomeWideString
4) TOraQuery instead TOraSql
5) TOraLoader
6) Download trial version 5.50.0.16 for Delphi 6 and test on 1-4 it

All SomeWideStrings and SomeOleVariants I have wrote to text file (to debug).
It looks fine, but I see in field "Name" only "????????????" (upsided down) instead arabian chars.
My viewer works correct (it was checked on another non-delphi project).

What I have to do?
Or ODAC VCL does'nt support unicode and I have to try another solution?;)

Best Regards,
Serg Soorskih

Alex
Posts: 655
Joined: Mon 08 Nov 2004 08:39

Post by Alex » Mon 28 Mar 2005 12:42

Support for NCHAR types was added since ODAC 5.50.0.16 to use it properly you must set
TOraSql.Params.National := True; for params of national type.

Serg Soorskih

Post by Serg Soorskih » Mon 28 Mar 2005 16:30

Thanks to Alex & Core Lab!

All works fine now.
If it is possible, explain please, why need set
Params.National=true, when Params.DataType=ftWideString?

Alex
Posts: 655
Joined: Mon 08 Nov 2004 08:39

Post by Alex » Tue 29 Mar 2005 07:12

The work with National Oracle types slightly differs from other types such as CHAR, VARCHAR and others so to determine that application works with National Oracle type you need to set National property to True.

Post Reply