Skip site navigation (1) Skip section navigation (2)

Re: BLOB help - yes I've read around!

From: Thomas Kellerer <spam_eater(at)gmx(dot)net>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: BLOB help - yes I've read around!
Date: 2009-04-08 06:38:46
Message-ID: grhgpj$vqr$ (view raw, whole thread or download thread mbox)
Lists: pgsql-jdbc
Brad Milne, 07.04.2009 23:55:
>> Do not use availabe()
>> This will *not* give you the number of bytes that are "available" in 
>> the stream.
>> Read the Javadocs carefully: it will give you the number of bytes that 
>> can be /read without blocking/
>> Most of the time this will not be the length of the stream.
> Good point Thomas, I hear you. I shouldn't have written that hear as 
> others could follow that. In my implementation it is ok as the stream is 
> complete prior to persisting it. I have an AudioInputStream object, but 
> it is always complete. If you think I should be therefore using a 
> different method/db object then I'd be pleased to hear.

I have never used AudioInputStream. If that one reports the real size when calling available() then it would be the first InputStream that I have seen that does that ;)

If you do use available() you should verify that the size of your BLOB (bytea) in the database is really what you expected. You have to test with sizes that exceed any potential buffer that takes place in the input stream, and I would inspect the source code for available(). 


In response to

pgsql-jdbc by date

Next:From: John ListerDate: 2009-04-08 07:33:44
Subject: Re: Array passing
Previous:From: Kris JurkaDate: 2009-04-08 02:16:46
Subject: Re: Array passing

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group