Re: tightening up on use of oid 0 - Mailing list pgsql-jdbc

From Oliver Jowett
Subject Re: tightening up on use of oid 0
Date
Msg-id 416DB1CA.5090005@opencloud.com
Whole thread Raw
In response to Re: tightening up on use of oid 0  ("Iain" <iain@mst.co.jp>)
List pgsql-jdbc
Iain wrote:
> Hi,
>
> For my part, I've never used any of those calls.
>
> FWIW, I always use reference objects such as "Integer" as opposed to
> "int" so I've never done it that way. All calls to setObject or
> set<Anything> would always use a variable which is typed (and may be
> null) my assumption is that I avoid all such ambiguities that way.

Just to clarify.. these calls are typed:

   setInt(i, 42);
   setObject(i, new Integer(42));
   setObject(i, new Integer(42), Types.INTEGER);
   setObject(i, null, Types.INTEGER);
   setNull(i, Types.INTEGER);
   setObject(i, new PGline(...), Types.OTHER);

These calls are not (sufficiently) typed:

   setObject(i, null);
   setObject(i, (Integer)null);     // (*)
   setObject(i, null, Types.OTHER);
   setNull(i, Types.OTHER);

Types.OTHER on its own is not specific enough to identify a particular
backend type, and Java nulls have no inherent type ('instanceof' will
always return false).

 From your description it sounds like you may use the case marked (*) ?

-O

pgsql-jdbc by date:

Previous
From: "Tornroth, Phill"
Date:
Subject: Re: FW: Question about the postgres resultset
Next
From: Oliver Jowett
Date:
Subject: Re: tightening up on use of oid 0