Why would an IROStream be empty?


(tobygroves) #1

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?


(EvgenyK) #2

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;

(tobygroves) #3

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


(tobygroves) #4

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)


(RemObjects) #5

Thanks, logged as bugs://81183


(tobygroves) #6

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.


(RemObjects) #7

bugs://81183 got closed with status fixed.


(EvgenyK) #8

this fix will be in this week beta


(tobygroves) #9

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


(EvgenyK) #10

we release beta at Wednesday usually