Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 946919FB2BE for ; Fri, 27 Jul 2007 19:35:38 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 59554-01 for ; Fri, 27 Jul 2007 19:35:34 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from mail63.csoft.net (leary.csoft.net [205.205.214.5]) by postgresql.org (Postfix) with SMTP id 17AC59FB2B3 for ; Fri, 27 Jul 2007 19:35:33 -0300 (ADT) Received: (qmail 2709 invoked by uid 1112); 27 Jul 2007 22:35:32 -0000 Date: Fri, 27 Jul 2007 18:35:32 -0400 (EDT) From: Kris Jurka X-X-Sender: books@leary.csoft.net To: Mikko Tiihonen cc: pgsql-jdbc Subject: Re: Fix resultset results after updateBinaryStream In-Reply-To: <1185048755.1632.68.camel@dual.local> Message-ID: References: <1184972544.1632.55.camel@dual.local> <1185048755.1632.68.camel@dual.local> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200707/130 X-Sequence-Number: 17304 On Sat, 21 Jul 2007, Mikko Tiihonen wrote: > On Sat, 2007-07-21 at 11:40 -0400, Kris Jurka wrote: >> >> On Sat, 21 Jul 2007, Mikko Tiihonen wrote: >> >>> The current UpdateableResultSet tests did not properly test more complex >>> binary data updating. The following patch makes the test a bit harder >>> and fixes the driver to pass the test. >> >> I think this works for the single row update and then retrieve test, but >> if your ResultSet has two rows and you do update, next, and then getBytes, >> won't it have the wrong fields[i].getFormat() value? The problem is that >> we need to keep the format on a per row basis. Consider a scrollable >> updatable resultset, any row can have either text or binary format. The >> safest thing to do at the moment would be to encode the byte[] into the >> text format that the server returns, but this is clearly not an ideal >> solution. > > You are correct. Here's an updated patch that does just that. The newer unit > test tests for the new case too. I first tried cloning the "fields" field and > restoring it whenever the row moved. But that did not work when moving to a > row that was inserted or updated. So we really do need either types per row > or convert the fields into correct text/binary format during update. > > The actual fix is really hack. But at least it is passes the tests. > Fixed in CVS for 8.0, 8.1, 8.2, and HEAD. Kris Jurka