Re: Question - Mailing list pgsql-jdbc

From Oliver Jowett
Subject Re: Question
Date
Msg-id 41969009.2040804@opencloud.com
Whole thread Raw
In response to Re: Question  (Franco Bruno Borghesi <franco@akyasociados.com.ar>)
List pgsql-jdbc
Franco Bruno Borghesi wrote:

> As you see, in my current code I have no way to know to which datatype
> the field maps to. So, is there any easy/generic way to set NULLs, no
> matter what datatype the field is?

No. The driver has exactly the same problem as you ran into, namely that
there's no way to infer a type given just a bare null.

You should provide a SQL Types value via setNull(i,type) or
setObject(i,null,type). You may want to change your API to pass down
type information when you are dealing with nulls.

The backend does have a mechanism to infer the type of a parameter, but
it's sufficiently unpredictable for arbitary queries that we decided not
to use it in the driver, given that the rest of JDBC is quite strongly
typed.

-O

pgsql-jdbc by date:

Previous
From: Franco Bruno Borghesi
Date:
Subject: Re: Question
Next
From: Guido Fiala
Date:
Subject: Why is PGStream.flush() taking so much time?