Subject | Re: [IBO] How to extract BLOB data from TIB_Row |
---|---|
Author | Geoff Worboys |
Post date | 2001-01-05T12:52:07Z |
> I need to extract blob data (icon picture) from TIB_Row.Most of the following is from the online help, you just have to know
> Can anyone help me quickly ?
where to look :-)
To go directly to a picture or whatever...
Procedure AssignTo(Dest: TObject );
Description
Assigns the columns data contents to another data member passed in.
All necessary data conversions are performed or an exception is
raised.
This works very well when moving BLOB data to and from TStrings,
TStream, TBitmap, TPicture, etc.
This will not support passing in a VCL TField.
More generically using streams...
TIB_Statement.CreateBlobStream(AColumn: TIB_Column; AMode:
TIB_BlobStreamMode ): TIB_BlobStream;
Method which allows direct access to the contents of a BLOB parameter
or field.
Here is some sample code showing how to use this method:
procedure TIB_ColumnBlob.LoadFromStream( const AStream: TStream );
var
tmpStream: TStream;
begin
tmpStream := Statement.CreateBlobStream( Self, bsmWrite );
try
tmpStream.CopyFrom( AStream, 0 );
finally
tmpStream.Free;
end;
end;
procedure TIB_ColumnBlob.SaveToStream( const AStream: TStream );
var
tmpStream: TStream;
begin
tmpStream := Statement.CreateBlobStream( Self, bsmRead );
try
AStream.CopyFrom( tmpStream, 0 );
finally
tmpStream.Free;
end;
end;
Geoff Worboys
Telesis Computing