Skip site navigation (1) Skip section navigation (2)

Re: statement caching proof of concept

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: Dave Cramer <pg(at)fastcrypt(dot)com>
Cc: List <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: statement caching proof of concept
Date: 2006-06-20 10:00:31
Message-ID: 4497C73F.7040804@opencloud.com (view raw or flat)
Thread:
Lists: pgsql-jdbc
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

In response to

pgsql-jdbc by date

Next:From: Heikki LinnakangasDate: 2006-06-20 10:16:25
Subject: Re: statement caching proof of concept
Previous:From: Oliver JowettDate: 2006-06-20 09:51:35
Subject: Re: statement caching proof of concept

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group