If you know the internal structure of a Long or Long Raw, you may also exactly know its size and can fetch exactly what you need with a minimum of network roundtrips. The GetLongField method can help you with this:
Code:
GetLongField(FieldId: Integer; Buffer: Pointer; Offset, Length: Integer): Integer
If for example you know that a Long Raw column is a 16-color bitmap, you know the width and height is stored at positions 18 and 22. If you first fetch these two integers, you can determine the size of the bitmap and fetch the rest:
Code:
var wh: TPoint;
Size: Integer;
Bitmap: Pointer;
begin
Query.GetLongField(BmpField, @wh, 18, SizeOf(wh));
Size := ((wh.x * wh.y) div 2) + 70;
GetMem(Bitmap, Size);
Query.GetLongField(BmpField, Bitmap, 0, Size);
...
end;