Streaming bytea implementation offered - Mailing list pgsql-jdbc

From Werner Donné
Subject Streaming bytea implementation offered
Date
Msg-id 6EA298B8-34D9-4832-A722-161911A22AB6@pincette.biz
Whole thread Raw
Responses Re: Streaming bytea implementation offered
List pgsql-jdbc
Hello,

I have modified version 9.1-902 of the driver in order for it to stream bytea values when calling
ResultSet.getBinaryStream().The implementation is here: 

http://www.pincette.biz/home/werner/postgresql-jdbc-9.1-902-patched.src.zip

When a bytea value is larger than 1MB it is streamed to a temporary file instead of being copied in the "answer" array.
Whenthe stream is later accessed, either with "getBinaryInputStream" or "getBytes", the bytes are fetched from the
temporaryfile, which is subsequently deleted. The "getBytes" method copies the bytes in the result array, while
"getBinaryInputStream"returns a FileInputStream with an overridden "close" method that deletes the temporary file. 

Best regards,

Werner.
--
http://www.pincette.biz/
Handling your documents with care, wherever you are.



pgsql-jdbc by date:

Previous
From: Dave Cramer
Date:
Subject: Re: not fetching all query results
Next
From: Craig Ringer
Date:
Subject: Re: Streaming bytea implementation offered