Difference between revisions of "Midware TMWBuffer.WriteStreamField"

From Overbyte
Jump to navigation Jump to search
(Created page with ' Main page -> Midware component reference -> TMWBuffer -> [[Midware_TMWBuffer.WriteStreamField | WriteStre…')
 
 
Line 21: Line 21:
 
     MWBuffer1.WriteFields(TRUE, [FileName]);
 
     MWBuffer1.WriteFields(TRUE, [FileName]);
 
     MWBuffer1.WriteStreamField(FALSE, mwString, Data);
 
     MWBuffer1.WriteStreamField(FALSE, mwString, Data);
 
 
     Data.Destroy;
 
     Data.Destroy;
 
     ...
 
     ...

Latest revision as of 15:27, 14 May 2011

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.