Midware TMWBuffer.WriteStreamField

From Overbyte
Revision as of 15:27, 14 May 2011 by Marie (talk | contribs) (→‎Example)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Main page -> Midware component reference -> TMWBuffer -> WriteStreamField

Definition

procedure WriteStreamField(NewRec:Boolean;FldType:TMWFieldType;Data:TStream);

Description

Write a single stream (blob) field. This function can be used to place a complete file (for example a BMP file) into a single field.


Example

<syntaxhighlight lang="delphi">

var
   Data : TStream;

begin

   Data := TFileStream.Create(FileName, 
                              fmOpenRead + fmShareDenyNone);
   Data.Seek(0, 0);
   MWBuffer1.WriteFields(TRUE, [FileName]);
   MWBuffer1.WriteStreamField(FALSE, mwString, Data);
   Data.Destroy;
   ...
   ...

end; </syntaxhighlight> This code will append a record to MWBuffer1 with two fields. The first will contain a file name, the second will contains the complete file. The file is loaded into the field as a blob using a file stream.