From: Markus Schaber <schabi@logix-tt.com>
To: Jeff Hubbach <jeff.hubbach@chha.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Possible regression: setNull() usage changed from 7.4
Date: Fri, 14 Apr 2006 17:32:31 +0200
Message-ID: <443FC08F.8020505@logix-tt.com> (raw)
In-Reply-To: <r02010500-1046-629BBFEECBC611DAA861000D93451082@[205.238.79.158]>
References: <r02010500-1046-629BBFEECBC611DAA861000D93451082@[205.238.79.158]>
Hi, Jeff,
Jeff Hubbach wrote:
> select count(*) from users where usernam = ? and
> (?::integer is null or userid != ?)
>
> stmt.setString(1,'blah');
> stmt.setNull(2,java.sql.Types.NULL);
> stmt.setNull(3,java.sql.Types.NULL);
>
> This code gives the server the type information it needs by doing an
> explicit cast. It seems to work, but was wondering if there are any
> problems you see with it (or if you have a better/cleaner way to go
> about it).
The correct way, IMHO, would be to use two different prepared
statements, one with the userid, and another one without.
HTH,
Markus
--
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf. | Software Development GIS
Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: schabi@logix-tt.com, jeff.hubbach@chha.com
Subject: Re: Possible regression: setNull() usage changed from 7.4
In-Reply-To: <443FC08F.8020505@logix-tt.com>
References: <r02010500-1046-629BBFEECBC611DAA861000D93451082@[205.238.79.158]> <443FC08F.8020505@logix-tt.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox