Fail to save to null blob

I have a blob in a database which is used to store notes. When I try to save a string to this blob, the value isn't stored. Tracing through the code in Aurelius.Types.Blob I see the following:

With value = 'Test notes', FIntData is set to length 10 in SetAsBytes. (1)
This function then calls GetSize (2),
which in turn calls CheckLoaded (3).
As the blob is lazy loaded, CheckLoaded goes ahead and loads the blob and assigns it to FIntData. But as the blob is nil to start with, FIntData is set to length zero. (4)
This then returns to SetAsBytes, passing size Zero to System.Move so the passed value doesn't get copied to the blob.  (5)


procedure TBlob.SetAsBytes(const Value: TBytes);
begin
  SetLength(FIntData, Length(Value));   (1)
  System.Move(Value[0], FIntData[0], Size);   (2)  &  (5)
  FLoaded := True;
end;

function TBlob.GetSize: Longint;
begin
  CheckLoaded;  (3)
  Result := Length(FIntData);
end;

procedure TBlob.CheckLoaded;
begin
  if FLoaded then Exit;
  if FController <> nil then
    FIntData := FController.ReadBlob;   (4)
  FLoaded := True;
  if FController <> nil then
    FController.AfterLoad;
end;

You're correct, we have fixed this. Thanks for reporting.

Is this a simple fix that we can make to the sources ourselves?

Yes, you can just change:

  System.Move(Value[0], FIntData[0], Size);
to:
  System.Move(Value[0], FIntData[0], Length(Value));

we have made other changes to increase performance, though. But to fix the issue, that should be enough.

Perfect, that will at least keep us going for now. Thanks.