Re: patch: streaming of bytea parameter values
От | Kris Jurka |
---|---|
Тема | Re: patch: streaming of bytea parameter values |
Дата | |
Msg-id | Pine.BSO.4.56.0405220222030.20695@leary.csoft.net обсуждение исходный текст |
Ответ на | patch: streaming of bytea parameter values (Oliver Jowett <oliver@opencloud.com>) |
Список | pgsql-jdbc |
On Wed, 21 Apr 2004, Oliver Jowett wrote: > This patch allows bytea parameters set via setBytes() / > setBinaryStream() to be streamed to the backend. With the patch applied, > the additional memory overhead for bytea parameters is small and > independent of how large the parameter data is. Taking another look, this patch makes the assumption that the length parameter to setBinaryStream is correct. It does not check that the calls to the input stream's read method do not return -1 indicating the exhaustion of the stream, so doing setBinaryStream("col", new ByteArrayInputStream(new byte[0]), 1000); will actually put 1000 values of -1 into col. Fixing this is difficult because you cannot simply throw an Exception if you hit the end of stream before the specified length because you can't just bail out when streaming data as that will leave the PGStream in a confused state. You've got to get it back to a known state and do so without the query succeeding. Another problem along this line is that the InputStream given could throw an IOException when being read and the same unknown state problem would result. Kris Jurka
В списке pgsql-jdbc по дате отправления: