From: | Werner Donné <werner(dot)donne(at)pincette(dot)biz> |
---|---|
To: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Streaming bytea implementation offered |
Date: | 2012-08-31 16:49:42 |
Message-ID: | 6EA298B8-34D9-4832-A722-161911A22AB6@pincette.biz |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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. When the stream is later accessed, either with "getBinaryInputStream" or "getBytes", the bytes are fetched from the temporary file, 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.
From | Date | Subject | |
---|---|---|---|
Next Message | Craig Ringer | 2012-09-01 01:04:11 | Re: Streaming bytea implementation offered |
Previous Message | Dave Cramer | 2012-08-31 11:15:48 | Re: not fetching all query results |