Why would an IROStream be empty?

I’ve got a strange problem with a stream object.

I have a table with a binary field. I’m using strongly typed classes so I have a field in my interface which is of type IROStream.

When I open a record in this table, which has data in the binary field, there’s nothing in the stream at all. I can inspect the Stream property of the IROStream and it is indeed of type TMemoryStream but the stream itself is totally empty, showing NIL for the memory property and zero for size. All other fields are loading fine.

What could be causing this?

Hi,

I can’t reproduce this issue with simple testcase.
it works correctly for me.

Usage of the BeginUpdate/EndUpdate methods of IROStream may cause your behavior, because it sets Result.InUpdateMode

function TEmployeesDataTableRules.GetPhotoValue: IROStream;
begin
  result := f_Photo;
  result.Position := 0;
  result.Size := 0;
  if not Result.InUpdateMode then begin
    DataTable.Fields[idx_EmployeesPhoto].SaveToStream(result);
    result.Position := 0;
  end;
end;

I’m currently trying to narrow this down with a simple test case.

I’ve located the issue. I’m not sure if it’s related to your “InUpdateMode” thing above but, when the data table is in Edit state, the stream becomes either empty or inaccessible.

I’m using Delphi 10.2.3 Enterprise with FireDAC against an MSSQL database.
I’ve created a test case program which demonstrates the issue. I’ve put some comments in the client which explain what to look for - if you debug through it you’ll see the issue. There’s an SQL file which will generate the database and an existing data row.

BinaryTest.rar (128.0 KB)

Thanks, logged as bugs://81183

Thanks, any idea on a timeframe for a fix? I’ve been trying to find a workaround but, right now, I can’t actually save anything into an IROStream field.

bugs://81183 got closed with status fixed.

this fix will be in this week beta

Ok, when will that be available? Is there any way I can get hold of the code changes sooner or are they too extensive?

we release beta at Wednesday usually