read & write Blob fields with MicroOlap DAC

read & write Blob fields with MicroOlap DAC

am 07.08.2005 18:34:46 von Kerry Frater

------=_NextPart_000_0219_01C59B76.4E053EE0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

I am trying to use Delphi with MySQL using the DAC. I am using Blobs to
store RTF data and need to read and write the data. The manual says to use
the TBlobSTream object but I am unable to get it to work. Can someone advise
me please.


SQL unit
....
QNotes: TBlobField;
....
function TMyRec.GetNotes(MyRecId: string): TDataSet;
begin
with QueryForrNotes do
begin
SQL.Text := 'SELECT * FROM RecordNotes Where RecordId = ''' +
MyRecId + ''' ORDER BY RecordId LIMIT 1;';
Open;
end;
GetNotes := DsNotes.Dataset;
end;

This seems to work and viewing QNotes.AsString does show the "text" of the
field.

RichEdit Unit using example code
....
MyDsNotes: TDataset;
MyNotesStream: TBlobStream;
....
MyDsNotes := MyRecord.GetNotes(MyRecord.RecordId);

MyNotesStream := TBlobstream.Create(MyRecord.QNotes,bmRead); {This
errors during runtime}
ReNotes.Lines.LoadFromStream(MyNotesStream);
MyNotesStream.Free;


Thanks

Kerry

------=_NextPart_000_0219_01C59B76.4E053EE0--