From: | Kris Jurka <books(at)ejurka(dot)com> |
---|---|
To: | Oliver Jowett <oliver(at)opencloud(dot)com> |
Cc: | "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org> |
Subject: | Re: patch: streaming of bytea parameter values |
Date: | 2004-05-22 07:34:03 |
Message-ID: | Pine.BSO.4.56.0405220222030.20695@leary.csoft.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Kris Jurka | 2004-05-22 17:49:34 | Re: patch: streaming of bytea parameter values |
Previous Message | Kris Jurka | 2004-05-21 17:15:30 | Re: Driver JDBC3 build 213 for postgreSQL 7.4 |