Re: PreparedStatement clearParameters
| От | Kris Jurka |
|---|---|
| Тема | Re: PreparedStatement clearParameters |
| Дата | |
| Msg-id | Pine.BSO.4.63.0602201252290.23155@leary.csoft.net обсуждение исходный текст |
| Ответ на | PreparedStatement clearParameters (Thomas Burdairon <tburdairon@entelience.com>) |
| Ответы |
Re: PreparedStatement clearParameters
|
| Список | pgsql-jdbc |
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 > object. > > 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: ps.setInt(1, 1); ps.execute(); ps.setLong(1, 1); ps.execute(); 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. Kris Jurka
В списке pgsql-jdbc по дате отправления: