Subject Re: [Firebird-Java] Re: Unrecognized transaction problem
Author Helen Borrie
At 01:34 PM 24/10/2004 +0000, you wrote:


>Hey Roman!
>
>Thanks for looking into it! The problem is probably related to the
>fact that it is impossible to use BLOBs inside stored procedures.

It's possible. Ask on Firebird-support, explaining what you want to do.


>A workaround would probably be to use some sort of checksum to see if
>there where changes inside BLOB fields.

Blobs are never updated. When you alter the contents of a blob, the old
blob is completely replaced with the new one and it gets a new blob_id. If
you can find a way to capture the old and new blob_ids, you'll know that
the blob has been "edited".

>Does the blob_col LIKE ? condition work like expected?

by "like expected", do you mean does the engine treat a blob as a
string? No. A blob isn't a string. It's a series of linked chains of
bytes. The chains are known as "segments". Some stuff that Nickolay has
been doing for Fb 2 will allow LIKE to work on a text blob the way it works
on a string.

You can currently use CONTAINING and STARTING WITH. One of the "gotchas"
about searching text blobs is that, if you stored a text document, there
will be hard and soft carriage returns. So, if you did something like

where MyBlob containing 'Hail, glorious morn!'

it will not find that sequence if it has a line break in the middle; or
if part of the search string crosses the boundary of a segment.

Another thing you have to remember when searching like this is that, if a
blob item never had anything stored in it, it will be null. So you need to
make your search clause like
where MyBlob is not null
and MyBlob containing 'Hail, glorious morn!'

Don't expect blob-searching to be quick. In document systems where you
need to search blobs, you'd usually store indexed keywords for searching by.

Helen