Page 1 of 1

!! Latest version has BLOB/Bytes length/access violation error !!

Posted: Thu 11 Nov 2021 11:38
by upscene
Hi,

When testing my own software with the new version of IBDac (8.0.1), I noticed the component set has a problem with BLOB values.

It raises this error followed by an access violation in rtl.bpl
---------------------------
Project raised exception class EIBCError with message 'Dynamic SQL ErrorSQL error code = -303
arithmetic exception, numeric overflow, or string truncation
string right truncation
expected length 16, actual 8192'.
---------------------------

The previous version I used was 7.1.3, that worked fine.

My code is transferring a character set octets (CHAR(16)) value, using raw byte with SaveToStream and LoadFromStream.

I noticed 7.4.3 has this change:
* Bug with assigning a BLOB parameter when the source data is loaded via the TParam.LoadFromStream method is fixed

Could this be related? If so, is there a code change that I can use on my end? This is an urgent issue for me.

With regards,

Martijn

Re: !! Latest version has BLOB/Bytes length/access violation error !!

Posted: Fri 12 Nov 2021 13:55
by ViktorV
Hey Martijn!

Thanks for the reply!
In order to give you a complete and accurate answer, please compose and send us a small sample demonstrating the behavior you indicated, including scripts to create and populate database data using our contact form:
https://devart.com/company/contactform.html

Looking forward to hearing from you!

Re: !! Latest version has BLOB/Bytes length/access violation error !!

Posted: Mon 15 Nov 2021 13:23
by upscene
Not sure what you want me to tell you.

It's simple:
1. CHAR(16), OCTETS fields (16 bytes long)
2. create two items, one is a SELECT cursor, the other is a parameterized INSERT INTO statement
3. open the cursor, make sure NOT to convert this to field type GUID
4. I copy the field value to a stream

Code: Select all

Bytes := TBytesStream.Create(TBinaryField(Field).AsBytes);
try
  Stream.CopyFrom(Bytes, Bytes.Size);
finally
  Bytes.Free;
end;
5. load the stream into the parameter

Code: Select all

if Stream is TBytesStream
then FCommand.ParamByName(ParamName).AsBytes := (Stream as TBytesStream).Bytes
else begin
  bytes := TBytesStream.Create;
  try
    bytes.LoadFromStream(Stream);
    FCommand.ParamByName(ParamName).AsBytes := bytes.Bytes;
  finally
    bytes.Free;
  end;
end;
6. execute the INSERT command

This code worked fine in an older version, fails now. No idea where 8192 comes from, the stream I pass to that latter piece of code has a length of 16 bytes.

Re: !! Latest version has BLOB/Bytes length/access violation error !!

Posted: Tue 16 Nov 2021 13:26
by ViktorV
Hi Martijn!

Thanks for the information. Please clarify this error occurs only when the DescribeParams option is enabled or regardless of its value? And what moment does AV appear when the application is closed or when Execute is executed? Also include the exact version of the DBMS version you are using.

Should you have any questions, do not hesitate to ask!

Re: !! Latest version has BLOB/Bytes length/access violation error !!

Posted: Tue 16 Nov 2021 13:35
by upscene
Hello Viktor,

DescribeParams = True.

AV/crash on calling Execute.

Using Firebird 3 or 4.

Re: !! Latest version has BLOB/Bytes length/access violation error !!

Posted: Wed 17 Nov 2021 13:28
by ViktorV
Hi Martijn!

Kindly be informed that unfortunally we weren't able fully reproduce your situation on our side, but we were able to reproduce a similar one.
So we able to fix the bug we have reproduced and its fix will be included in the next build of IBDAC. But we can provide you a nightly build that includes this change, so you can check if this change solves the problem on your side.

To do this, please send us your license number and the version of the IDE you are using via our contact form:
https://devart.com/company/contactform.html

Re: !! Latest version has BLOB/Bytes length/access violation error !!

Posted: Wed 17 Nov 2021 13:33
by upscene
Hello Viktor,

The problem with the nightly build, is that I use the components for Oracle, SQL Server, MySQL and PostgreSQL as well.

I would need a build of everything ;)

Re: !! Latest version has BLOB/Bytes length/access violation error !!

Posted: Wed 17 Nov 2021 14:07
by ViktorV
Ok, no problem!
Please send us your license number and the version of the IDE you are using via our contact form:
https://devart.com/company/contactform.html