Re: stringtype=unspecified problem

From: Kris Jurka <books(at)ejurka(dot)com>
To: Chris Gamache <cgamache(at)gmail(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: stringtype=unspecified problem
Date: 2007-02-15 16:40:01
Message-ID: Pine.BSO.4.64.0702151136230.22285@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Thu, 15 Feb 2007, Chris Gamache wrote:

> On 2/14/07, Kris Jurka <books(at)ejurka(dot)com> wrote:
>> Here you're explicitly saying that it is a VARCHAR, not that you have a
>> String that you're not sure what the real type is. It would be possible
>> to adjust setNull to check the stringtype setting and use Oid.UNSPECIFIED
>> here, but I'm not sure that would be correct.
>
> We've been batting this around in the office as well. I wish I knew
> what the absolute correct behavior would be in this situation.
>
> An observation that might be insightful is if I can figure out how
>
> setString(1,null);
>
> differs from
>
> setNull(1,java.sql.Types.VARCHAR);
>

What would you expect to happen for these two:

setObject(1, "hi", Types.VARCHAR);
setObject(1, null, Types.VARCHAR);

compared with:

setObject(1, "hi");
setObject(1, null);

By specifying the type you're saying that it really is a VARCHAR, not
indicating that it's an unknown type in a String representation.

Kris Jurka

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Ken Johanson 2007-02-15 23:40:26 Re: Synthesize support for Statement.getGeneratedKeys()?
Previous Message Chris Gamache 2007-02-15 14:12:53 Re: stringtype=unspecified problem