Subject Re: [ib-support] blob
Author Helen Borrie
At 01:03 PM 13-11-02 +0100, you wrote:
>Hi everybody,
>
>I have a table with a blob field (a text one).
>I want to make a before update trigger to test if the blob field was modified.
>I tried a test : new.field <> old.field but it doesn't work (blob fault ?).
>
>Is there somebody who have an idea ?

A blob is just a block of bytes. It has no attributes that can be checked
for equality, such as a string type has. You can use CONTAINING on a text
blob to have the engine search its content.

A blob isn't stored in the table row but in separate pages. The row stores
only a pointer (the blob_id) to enable the engine to locate it. "Updating"
a blob actually causes a completely new blob to be written.

You can use a UDF to compare the contents of blobs, however. Such a UDF
exists in the FreeUDFLib, the version at the www.cvalde.com website. I
think it is called BlobBinCmp. Another one, BlobCompare, is available if
you have IB Objects installed. There are probably others - check out the
UDF Library section at www.ibphoenix.com

Although you can use UDFs in a trigger, I don't know whether you could
access the old and new context variables for a blob. In your situation,
I'd consider it worth a try...

Helen