EPUB | CHM | PDF

Example: Create, CreateBlobStream, Edit, CopyFrom

Top Previous Next

The following example copies the data in the Notes field of MySQLTable1 to the Remarks field of MySQLTable2.

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