TurboDB VCL Component Library

TTdbDataSet.CreateBlobStream

TTdbDataSet

Previous  Top  Next

Returns a TBlobStream object for reading or writing the data in a specified blob field.

Delphi syntax:

function CreateBlobStream(Field: TField; Mode: TBlobStreamMode): TStream;

C++ syntax:

virtual Classes::TStream* __fastcall CreateBlobStream(TField* Field, TBlobStreamMode Mode);

Description

Call CreateBlobStream to obtain a stream for reading and writing the value of the field specified by the Field parameter. The Mode parameter indicates whether the stream will be used for reading the field's value (bmRead), writing the field's value (bmWrite), or modifying the field's value (bmReadWrite).

Blob streams are created in a specific mode for a specific field on a specific record. Applications create a new blob stream every time the record in the dataset changes: do not reuse an existing blob stream.

Note: It is preferable to call CreateBlobStream rather than creating a blob stream directly in code. This ensures that the stream is appropriate to the dataset, and may also ensure that datasets that do not always store BLOB data in memory fetch the blob data before creating the stream.

Note: With TurboDB you must free the stream object returned by CreateBlobStream before you post the attached record. This is necessary because the stream does not write its content until it is destroyed.