Eine einfach zu handhabende Lösung wäre eine Klasse, die beide Felder aufnehmen kann und den Inhalt in einen Stream schreiben (und von dort auch wieder auslesen kann).
So etwas z.B.
Delphi-Quellcode:
unit Unit2;
interface
uses
System.Classes;
type
TDataObject =
class( TInterfacedPersistent, IStreamPersist )
private
FDate: TDateTime;
FText: TStrings;
procedure SetText(
const Value: TStrings );
public { IStreamPersist }
procedure LoadFromStream( Stream: TStream );
procedure SaveToStream( Stream: TStream );
public
constructor Create;
destructor Destroy;
override;
property Date: TDateTime
read FDate
write FDate;
property Text: TStrings
read FText
write SetText;
end;
implementation
{ TDataObject }
constructor TDataObject.Create;
begin
inherited;
FText := TStringList.Create;
end;
destructor TDataObject.Destroy;
begin
FText.Free;
inherited;
end;
procedure TDataObject.LoadFromStream( Stream: TStream );
var
reader: TBinaryReader;
begin
reader := TBinaryReader.Create( Stream );
try
FDate := reader.ReadDouble( );
finally
reader.Free;
end;
FText.LoadFromStream( Stream );
end;
procedure TDataObject.SaveToStream( Stream: TStream );
var
writer: TBinaryWriter;
begin
writer := TBinaryWriter.Create( Stream );
try
writer.
Write( FDate );
finally
writer.Free;
end;
FText.SaveToStream( Stream );
end;
procedure TDataObject.SetText(
const Value: TStrings );
begin
FText.Assign( Value );
end;
end.
Um die Daten vom/zum Blob-Feld zu bekommen reicht dann
Delphi-Quellcode:
data := TDataObject.Create;
// Daten vom Feld holen
data.Assign( MyDataSet.FieldByName('BlobData') );
// Daten in das Feld schreiben
MyDataSet.FieldByName('BlobData').Assign( data );
Kaum macht man's richtig - schon funktioniert's
Zertifikat: Sir Rufo (Fingerprint: ea 0a 4c 14 0d b6 3a a4 c1 c5 b9
dc 90 9d f0 e9 de 13 da 60)