Re: PreparedStatement clearParameters and setTimestamp

From: Kris Jurka <books(at)ejurka(dot)com>
To: Akira Sato <sato(dot)akira(at)oss(dot)ntt(dot)co(dot)jp>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: PreparedStatement clearParameters and setTimestamp
Date: 2006-08-06 18:05:13
Message-ID: Pine.BSO.4.63.0608061304350.31226@leary2.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Tue, 25 Jul 2006, Kris Jurka wrote:

> On Tue, 25 Jul 2006, Akira Sato wrote:
>
>> With case of setTimestamp(), it seem to always do "Parse".
>> (setDate() and setTime() too)
>>
>
> When determining if a statement must be reparsed the driver checks that the
> parameters it currently has match with the previous execution. This
> comparison is being done with the values returned from the server for the
> previous execution, not the values sent to the server. So you parse once
> with oid 0 and it comes back with the oid of the resolved type, say 1184 for
> timestamptz. The next time through you again have oid 0 from setTimestamp,
> and it compares 0 == 1184? and it determines they don't match and it must be
> reparsed.
>
> The attached patch fixes your test case for me, but I haven't applied it yet
> as I'd like to do some more testing. It doesn't allows oid 0 to match any
> type the server resolves.
>

Applied to 8.0, 8.1, and 8.2dev.

Kris Jurka

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Kris Jurka 2006-08-06 18:15:16 Re: Callablestatement's resulting resultset not scrollable
Previous Message Bruce Momjian 2006-08-05 17:39:06 Re: [HACKERS] [PATCHES] log_statement output for protocol