Subject Re: [IBO] BLOB is not refreshing
Author Helen Borrie
At 08:27 AM 29/04/2005 +0200, you wrote:
>Hi all,
>I have one problem. I'll try to explain it on simple example.
>I have TIB_Query. SQL is 'select TEXT from RECEPT', where TEXT is type
>I perform this commands:
> IB_Query1.Append;
> IB_Query1.FieldByName('TEXT').asString := 'something';
> IB_Query1.Cancel;
> while not IB_Query1.BOF do
> begin
> ShowMessage(IB_Query1.FieldByName('TEXT').asString);
> IB_Query1.Prior;
> end;
>Each ShowMessage command shows the same content 'something'! (althoug
>there is, in fact, another content).
>The problem disappears, when I reach BOF.
>Does anybody know where is the problem?

I don't blame you for being confused! AsString can be used to *write* a
new value into a text blob.

However, a text blob is not a string, so you can't just read a blob value
"AsString" and display it as a string. What you are seeing, as you work
your way backwards through the buffer, is simply the last string that was
held in that particular slot in the FieldValues array. The code in your
loop can't change it, so it continues to be the same string.

Typically, in order to get at the content of a text blob. you read the blob
into a TStream and then use an assignment method to assign the stream to a
TStrings object, e.g. a TStringList or the Lines property of a TMemo. To
read the strings of a stringlist as one string, refer to the object's Text