pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kris Jurka <books@ejurka.com>
To: Dave Cramer <pg@fastcrypt.com>
Cc: pgsql-jdbc@postgresql.org <pgsql-jdbc@postgresql.org>
Subject: Re: getXXX methods
Date: Tue, 6 Jul 2004 13:46:07 -0500 (EST)
Message-ID: <Pine.BSO.4.56.0407061336560.12042@leary.csoft.net> (raw)
In-Reply-To: <1088795907.1536.118.camel@localhost.localdomain>
References: <1088795907.1536.118.camel@localhost.localdomain>



On Fri, 2 Jul 2004, Dave Cramer wrote:

> There is a table in the jdbc spec which suggests that
> there is a preferred method for getting the column information, and at
> non-preferred method.
> 
> would all the numeric values be truncated ?
> 
> What do we do with char, varchar, longvarchar ?

It's tough to say.  Looking at the current situation for retrieving double 
values with getInt() the current driver will throw an Exception on a out 
of range value because it starts with a String and uses Integer.parseInt() 
on it.  Contrast this with the result of 

Double d = new Double(Double.MAX_VALUE);
System.out.println(d.intValue());

which truncates the double to Integer.MAX_VALUE.  The javadocs are 
useless, but I prefer the Exception to silent truncation, so I would 
suggest getByte can be used on any integer value of -128 to 127 regardless 
of its storage form (like text).  The question of comparing floating point 
numbers should be the same, but we may run into problems when 1 is 
represented as 1.00000001.

Kris Jurka



view thread (17+ messages)  latest in thread

Message-ID: <Pine.BSO.4.56.0407061336560.12042@leary.csoft.net>
Permalink:  ../Pine.BSO.4.56.0407061336560.12042@leary.csoft.net/
Also on:    postgresql.org/message-id/Pine.BSO.4.56.0407061336560.12042@leary.csoft.net

 · 

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: books@ejurka.com, pg@fastcrypt.com
  Subject: Re: getXXX methods
  In-Reply-To: <Pine.BSO.4.56.0407061336560.12042@leary.csoft.net>
  References: <1088795907.1536.118.camel@localhost.localdomain> <Pine.BSO.4.56.0407061336560.12042@leary.csoft.net>

* 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