Re: PreparedStatement clearParameters

From: Marc Herbert <Marc(dot)Herbert(at)continuent(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: PreparedStatement clearParameters
Date: 2006-02-21 10:21:59
Message-ID: khj64n9t3js.fsf@meije.emic.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Thomas Burdairon <tburdairon(at)entelience(dot)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.

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message David Gommeren 2006-02-21 10:33:52 getPrimaryKeys
Previous Message David Goodenough 2006-02-21 09:55:45 Re: setString and timestamps