X-Original-To: pgsql-jdbc-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 8FD2E9FA378 for ; Tue, 20 Jun 2006 07:00:44 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 01088-04 for ; Tue, 20 Jun 2006 07:00:35 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from yass.opencloud.co.nz (yass.opencloud.co.nz [131.203.101.226]) by postgresql.org (Postfix) with ESMTP id 9BC889FA219 for ; Tue, 20 Jun 2006 07:00:35 -0300 (ADT) Received: from 221x253x225x162.ap221.ftth.ucom.ne.jp ([221.253.225.162] helo=[192.168.1.171]) by yass.opencloud.co.nz with asmtp (TLS-1.0:DHE_RSA_AES_128_CBC_SHA:16) (Exim 4.34) id 1Fsd29-0007qG-TC; Tue, 20 Jun 2006 22:00:34 +1200 Message-ID: <4497C73F.7040804@opencloud.com> Date: Tue, 20 Jun 2006 19:00:31 +0900 From: Oliver Jowett User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) MIME-Version: 1.0 To: Dave Cramer CC: List Subject: Re: statement caching proof of concept References: <4077BF73-482B-46C8-B65D-2E1FD2465294@fastcrypt.com> <44973024.4010204@opencloud.com> <4497C527.6090608@opencloud.com> In-Reply-To: <4497C527.6090608@opencloud.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200606/67 X-Sequence-Number: 15347 Oliver Jowett wrote: > Dave Cramer wrote: >> >> On 19-Jun-06, at 7:15 PM, Oliver Jowett wrote: >>> >>> The "wrapper" implementation approach suffers from the usual >>> difficulty that the "back links" such as ResultSet.getStatement() >>> point to the wrong object. It's actually quite a bit of work to get >>> this right.. >> Since result sets only live as long as the statement, wouldn't they >> point to the statement that is still open ? > > What I mean is that this won't work: > > PreparedStatement ps = conn.prepareStatement(...); > ResultSet rs = ps.executeQuery(); > assert rs.getStatement() == ps; > > since rs.getStatement() will return the real underlying statement, not > the wrapper that prepareStatement() creates. Oh, never mind, I didn't look at the code closely enough, you're returning the real statement not a wrapper. (that has some other problems with badly-behaved code as others have noted) -O