Subject Re: [Firebird-Java] Re: Obscure error
Author William L. Thomson Jr.
It's cased by an empty blob that is not null. I had to do some work to
clean up my database when I ran into this a while back. There is a
difference here between Jaybird and InterClient. As I did not have the
problems with InterClient. However I prefer the Jaybird way since an
empty blob should be null.

Further more I changed how I was storing the blobs, to where blob record
only exist if there is data. So I can't have empty non-null blobs. They
are either full and exist or do not at all.

On Thu, 2003-02-06 at 08:14, Roman Rokytskyy wrote:
> Can you suggest how to get such field? I see the place in the code
> where this happens, but I hardly see how can it happen.

You can reproduce the erro by typing a few spaces into a blob field. Or
adding just enough data to make the blob not null, but not enough to be
read or used a whole blob. I am not sure how I did it, but it can and
does happen.

> This code is
> in FBLongVarCharField.getBlob():
> if (rs.row[numCol]==null)
> Long blobId = new Long(XSQLVAR.decodeLong(rs.row[numCol]));
> At this point blobId is equal to new Long(0), which for FBBlob
> implementation means "create new blob". There is either bug in FBBlob
> assuming that there can be no 0 blob ID, or in long decoding
> function. But say that for sure I will need some idea how to
> reproduce this bug.

I tried to explain above, but I saw it as an error on my behalf with
dealing with the blob's. Not a problem to burden the developers of
Jaybird with. It's not your fault if we make a mess in our db.

> > Hope this helps, please let me know if I can be a little more
> > specific or if you want me to try something.
> A test case would be great!

Damn, I made one, and in the process discovered what I was doing wrong.
I kept the example up until a day or two ago. I think I have a backup
and will go look for it.

Although I do not think this is a problem the driver needs to address.
Unless you do.

InterClient used to return null for those blobs, even though technically
they are not null. So if you want to do anything to address this, that
would be the way.

However it allows people to proceed in an improper manner in my opinion.
I do not see a reason an empty blob should not be null. I see it as
making a mess of the data in the db.

William L. Thomson Jr.
Support Group
Obsidian-Studios Inc.
439 Amber Way
Petaluma, Ca. 94952
Phone 707.766.9509
Fax 707.766.8989