Subject Re: [IBO] Re: Blob update
Author Jason Wharton
> how can i update a blob field using IBO ?. I want to insert a text at the
> beginning of the blob data, without using data aware components. here's
the
> code. Am i missing something.. help..
>
> the sql for the qryNote = Select * from note where no_businessid=44
and
> no_displayname='Chattels'
> the fields no_note & bn_comment is a blob field
>
>
> qryNote.Close;
> qryNote.Prepare;
> qryNote.Open;
>
> MyPictureColumnOld := TIB_Column(qryNote.FieldByName( 'NO_NOTE'));
> with dsql do begin file://TIB_DSQL
> sqltext:='Update businessnote set bn_comment=:bn_comment where
> bn_businessnoteid=1';
> SQl.Text:=sqltext;
> Prepare;
> MyPictureColumnNew:= DSQL.ParamByName('bn_comment');
> MyPictureColumnNew.AsString :='test' +#13+
> MyPictureColumnOld.Asstring;
> ExecSQL;
> end;
>
> here's the output if viewed in TWWDBRichEdit:
>
> test
> {\rtf1\ansi\deff0{\fonttbl{\f0\fnil\fcharset0 Arial;}{\f1\fnil Arial;}}
> {\colortbl ;\red0\green0\blue0;}
> \viewkind4\uc1\pard\cf1\lang1033\fs16 All light fittings\lang3081\f1\par
> }
>
> i don't want all that extra text. All i want is this text to be displayed
> in TWWDBRichEdit:

Are the notes originally in plain text or RTF? IBO doesn't have any facility
to convert RTF to plain text. I know that the TIB_RichEdit control can have
the PlainText property set to true such that it will recieve in the RTF and
then spit out just the plain text of the document. You might do well to try
manipulating things to do this.

Also, let me caution you about a bug in InterBase that you may hit if you
use the TIB_DSQL component and a SELECT statement. You can do what you are
doing as long as you prepare and unprepare the statement every time it is
executed. If you need to use an input parameter I recommend that you use a
TIB_Cursor component and call the First method (which closes if open, and
opens and fetches the first record). By doing it this way you avoid the bug
that it in the client API.

Doing the Update as you are doing should be just fine.

Another problem I just spotted is it appears you are expecting results from
the select to be obtained through the ParamByName(). THis will (should) not
work. I prefer that all output os acquired via the FieldByName() method.

HTH,
Jason Wharton
CPS - Mesa AZ
http://www.ibobjects.com