TOraQuery, Unicode and FieldsAsString

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
MarkF
Posts: 211
Joined: Thu 02 Mar 2006 14:55

TOraQuery, Unicode and FieldsAsString

Post by MarkF » Mon 29 Jun 2009 20:57

It looks like the return data buffer size for numbers may be sized too small when FieldsAsString is true and Unicode is turned on. In some cases I get an "Ora-01406" error and in other cases the returned string seems to be cut short without an error message.

I haven't nailed it down completely yet, but one example is the following script. The query should show '-1', but it will only show '-':

Code: Select all

create table x (x number(1));
insert into x values (-1);
select * from x;
This isn't the only case though. If I have a function that returns a number, if the number is large, the value gets truncated. Please let me know if you need more info and I'll try to make a better test case!

Thanks.

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Tue 30 Jun 2009 10:50

We have increased the field size by one character to hold the sign. The fix will be included in the next ODAC build.

Please provide us an example for a function that returns a number.

MarkF
Posts: 211
Joined: Thu 02 Mar 2006 14:55

Post by MarkF » Tue 30 Jun 2009 11:03

Thanks! It looks to me as though the default lengths for a number aren't enough (even adding 1). If you select a really big number like:

Code: Select all

select (1e80+2e70+3e60+4e50+5e40+6e30+7e20+8e10+9e0) "BigNum" from dual;
The current version will give you:
10000000002000000000300000000040000000

If you expand the return buffer, you'll see that Oracle actually sends the correct result:
100000000020000000003000000000400000000000000000000000000000000000000000000000000

It looks like the existing code assumes that the largest regular number would be 38 digits or so.

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Tue 30 Jun 2009 11:34

In the next build we'll change the field size for NUMBER to 132 because the maximum exponent for NUMBER is 130.

MarkF
Posts: 211
Joined: Thu 02 Mar 2006 14:55

Post by MarkF » Tue 30 Jun 2009 14:39

Thanks!

Post Reply