Page 1 of 1

AV using AsString for ftVarBytes

Posted: Wed 08 Apr 2009 17:10
by MarkF
I'm getting an AV error when I use the Field.ToString call on a ftVarBytes column. The easiest way to test is using USER_TAB_COLUMNS as the RAW(32) fields are of this type. Thanks for any suggestions!

-Mark

Posted: Thu 09 Apr 2009 07:16
by Plash
We could not reproduce the problem. Please send to odac*devart*com a complete small sample that demonstrates the problem, including the script for creating database objects.

I have found columns LOW_VALUE and HIGH_VALUE in the USER_TAB_COLUMNS view that are mapped to ftVarBytes. In my case these columns contain only NULL values. I have tested this also on my own table but could not reproduce the problem.

Posted: Thu 09 Apr 2009 11:28
by MarkF
Could you try using the following script?

Code: Select all

-- drop table rawtest;
create table rawtest
(
  id number(38) primary key,
  rw raw(100),
  lr long raw
);
insert into rawtest values ( 1, '626262', '623262' );
insert into rawtest values ( 2, '0A0B0C0D0E0F', '0A0B0C0D0E0F' );
insert into rawtest values ( 3, '0A', '0A0B0C' );
COMMIT;
select * from rawtest where id < 3;  -- Note that data is truncated.
select * from rawtest where id = 3;  -- AV
It looks like the length of RAW values are being messed up (perhaps only on D2009). It looks like a Char size vs Byte size issue (note the AV is when the data is one byte long.) I hope this helps find the problem, I'm actually not at my office this week so I can't easily send a code sample. It should happen with a simple OraQuery component and getting the Fields asString.

- update!
I'm testing with RawAsString := False. It looks like it works with RawAsString := True;

Thanks!

-Mark

Posted: Fri 10 Apr 2009 07:25
by Plash
This is a bug in Delphi 2009 (see TBinaryField.GetAsString). You should use the AsAnsiString property for ftVarBytes fields.

Posted: Fri 10 Apr 2009 12:59
by MarkF
Cool! Thanks for the help!

-Mark