pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oliver Jowett <oliver@opencloud.com>
To: Franco Bruno Borghesi <franco@akyasociados.com.ar>
Cc: Kris Jurka <books@ejurka.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Question
Date: Sat, 13 Nov 2004 22:51:53 +0000
Message-ID: <41969009.2040804@opencloud.com> (raw)
In-Reply-To: <41965186.4040300@akyasociados.com.ar>
References: <41963B7A.8080900@akyasociados.com.ar>
	<Pine.BSO.4.56.0411131201340.26@leary.csoft.net>
	<41965186.4040300@akyasociados.com.ar>

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



view thread (17+ messages)

Message-ID: <41969009.2040804@opencloud.com>
Permalink:  ../41969009.2040804@opencloud.com/
Also on:    postgresql.org/message-id/41969009.2040804@opencloud.com

 · 

reply

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: oliver@opencloud.com, franco@akyasociados.com.ar, books@ejurka.com
  Subject: Re: Question
  In-Reply-To: <41969009.2040804@opencloud.com>
  References: <41963B7A.8080900@akyasociados.com.ar> <Pine.BSO.4.56.0411131201340.26@leary.csoft.net> <41965186.4040300@akyasociados.com.ar> <41969009.2040804@opencloud.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