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.
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’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.
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.