Re: PreparedStatement clearParameters - Mailing list pgsql-jdbc

From Marc Herbert
Subject Re: PreparedStatement clearParameters
Date
Msg-id khj64n9t3js.fsf@meije.emic.fr
Whole thread Raw
In response to PreparedStatement clearParameters  (Thomas Burdairon <tburdairon@entelience.com>)
List pgsql-jdbc
Thomas Burdairon <tburdairon@entelience.com> writes:

> 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.

> Then, i don't even know if it's a bug, maybe it's a feature (?)

I have never read anything in the specifications of the JDBC interface
that _guarantees_ anything concerning performance. I only found more
or less fuzzy statements like "it is pre-compiled" (what does that
mean formally? to what extent?) or that "execution can be faster".

The corresponding ODBC documentation is a bit more precise
 <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/odbcprepared_execution.asp>
except it specifically caters for the zero-preparation case:

  If the driver cannot emulate statement preparation, it stores the
  statement when SQLPrepare is called and submits it for execution when
  SQLExecute is called.
  Because emulated statement preparation is not perfect, SQLExecute can
  return any errors normally returned by SQLPrepare.

So this definitely look like a feature ;-)

Please correct me when I am wrong.

By the way ODBC does not confuse parametrization and preparation like
JDBC does.


pgsql-jdbc by date:

Previous
From: David Goodenough
Date:
Subject: Re: setString and timestamps
Next
From: David Gommeren
Date:
Subject: getPrimaryKeys