Char length issue

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for Oracle in Delphi and C++Builder
Post Reply
ez
Posts: 11
Joined: Tue 01 Dec 2009 12:56

Char length issue

Post by ez » Wed 21 May 2014 10:39

Hello,

I have upgraded the 4.70 driver to the last 6.3.6 and I encounter the following problem :
a select from a column declared as CHAR(4 CHAR) with nls_length_semantics = 'CHAR' returns the value 'DATA ' (16 characters) whereas the the driver 4.70 correctly returns the value 'DATA' (4 characters as expected).

Both environnements are exactly the same, only the dll is replaced.
The character set of the database is AL32UTF8.

Should I make changes to the connection options for the new driver ?

Thanks.

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

Re: Char length issue

Post by AlexP » Fri 23 May 2014 09:17

Hello,

If you are using Delphi 2006 or higher, you should set the UseUnicode option to True. Otherwise, set the CharLength option to 1. However, if in the field multi-byte symbols are used, they will be displayed correctly.

ez
Posts: 11
Joined: Tue 01 Dec 2009 12:56

Re: Char length issue

Post by ez » Thu 05 Jun 2014 12:25

Thanks, setting CharLength to 1 solved the problem.
Can you give me more explanations about this parameter because its purpose remains unclear to me: should it reflect the character's length used by the Oracle database or does it tell Oracle of the character's length expected by the driver when returning data ?

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

Re: Char length issue

Post by AlexP » Thu 05 Jun 2014 13:07

When working with strings, we allocate a buffer to store them. If the property CharLength = 0 , we calculate the required buffer depending on the parameters returned by the server: if CharLength <> 0 - we allocate the specified number of bytes for a symbol forcedly.

Post Reply