Re: patch: streaming of bytea parameter values
От | Oliver Jowett |
---|---|
Тема | Re: patch: streaming of bytea parameter values |
Дата | |
Msg-id | 409B3FB9.6060607@opencloud.com обсуждение исходный текст |
Ответ на | Re: patch: streaming of bytea parameter values (Kris Jurka <books@ejurka.com>) |
Список | pgsql-jdbc |
Kris Jurka wrote: > > 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. > > > Have you given any consideration to extending this to handle streaming > large text fields via setAsciiStream(), setUnicodeStream(), or > setObject(int, Object, Types.LONGVARCHAR) ? Also updateable ResultSets > have similar updateXXX to PreparedStatement's setXXX methods that could > benefit from a streaming interface. I think setObject() should use the changes when given a byte[], as it appears to delegate to setBytes() in that case.. although I find the setObject logic hard to follow at times (you are in a maze of twisty little case statements, all alike) updateBytes() delegates to setObject(). updateBinaryStream() won't stream, at a glance, but should be easy to change so it delegates to setBinaryStream(). From a quick look at the other streaming parameter types, it's not clear that we can stream them. setUnicodeStream and setCharacterStream can't be streamed under v3 as there's no simple relationship between the length parameter provided and the number of UTF8-encoded bytes we'd send to the backend. setAsciiStream could be streamed if we assume 7-bit ASCII (1:1 mapping to UTF8) but the JDBC javadoc doesn't say exactly what it means by "ASCII".. > There is also the implied assumption that V3 protocol implies a unicode > client encoding which implies a seven bit safe streaming option which > would be better spelled out in a comment or called in a way that used the > encoding variable to derive this fact. Fair comment. In my local tree, this patch has been superceded by changes to use the v3 extended query protocol and stream the data directly as a binary parameter. I thought it might make a good interim solution for the official driver though. -O
В списке pgsql-jdbc по дате отправления: