On Mon, 20 Feb 2006, Thomas Burdairon wrote:
> I've seen a strange comportment of implementation of PreparedStatement
> and especially the clearParameters method. The normal functionnement of
> this is that if I create a PreparedStatement, the query is sent once to
> the server, and then only parameters are sent to the server.
> clearParameters erase parameters already set in the PreparedStatement
> But, it seems the clearParameters method remove us all the benefit of
> prepare statements, because the query is sent again on each
> executeQuery/executeUpdate call. But without using clearParameters, the
> comportment is correct.
Yes, this is a problem. The coding of clearParameters clears the type
information associated with the PreparedStatement as well as the bind
values. This causes the query to get reprepared as it thinks the types
have changed. This code is necessary because the statement must
be replanned when something like this happens:
I suspect that just not clearing the type information will fix this, but
I'll need to test that a little. Thanks for the report.
In response to
pgsql-jdbc by date
|Next:||From: Warren Murray||Date: 2006-02-20 21:10:55|
|Subject: PostgreSQL and Struts Tutorial|
|Previous:||From: Kris Jurka||Date: 2006-02-20 17:42:16|
|Subject: Re: setString and timestamps|