EPUB | CHM | PDF

Example: Create, CreateBlobStream, Edit, CopyFrom

Top Previous Next

The following example copies the data in the Notes field of PSQLTable1 to the Remarks field of PSQLTable2.

procedure TForm1.Button1Click(Sender: TObject);
var
  Stream1, Stream2 : TPSQLBlobStream;
begin
  Stream1 := TPSQLBlobStream.Create(PSQLTable1Notes, bmRead);
  try
    PSQLTable2.Edit;
    // Here's a different way to create a blob stream
    Stream2 := PSQLTable2.CreateBlobStream(PSQLTable2.FieldByName('Remarks'),
                                            bmReadWrite);
    try
      Stream2.CopyFrom(Stream1, Stream1.Size);
      PSQLTable2.Post;
    finally
      Stream2.Free;
    end;
  finally
    Stream1.Free;
  end;
end;