[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mysql-odbc
Subject:    read & write Blob fields with MicroOlap DAC
From:       "Kerry Frater" <kfrater () wannaemail ! com>
Date:       2005-08-07 16:34:46
Message-ID: NDBBLCAKJHDAHOEJMOLCEELJNHAA.kfrater () wannaemail ! com
[Download RAW message or body]


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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic