Skip site navigation (1) Skip section navigation (2)

Re: anyone know why this is failing

From: Kris Jurka <books(at)ejurka(dot)com>
To: Dave Cramer <pg(at)fastcrypt(dot)com>
Cc: "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: anyone know why this is failing
Date: 2004-02-11 03:31:38
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-jdbc

>     ResultSet rs = pstmt.executeQuery("select (final-initial) as diff
> from test_interval");
>     while ( )
>     {
>       String str = (String)rs.getString(1);
>       assertNotNull(str);
>       str = (String)rs.getObject(1);
>       assertNotNull(str);
>     }
>   }

The difference of two timestamps is an interval, a type which has no
equivalent Java class.  The driver tries to determine a custom class
mapping (like those for the geometry types) in

AbstractJdbc1Connection.getObject(String type, String value)

which has a bug in it.  I'm not sure I agree with your expectation that it
return a String, but that is certainly a position which could be argued.
I would have expected this to throw an Exception indicating that it
couldn't determine what to do with it.  Another option would be to provide
a PGInterval class and map it appropriately.

Kris Jurka

In response to

pgsql-jdbc by date

Next:From: Ian ClaritoDate: 2004-02-11 09:08:15
Subject: unsubscribe
Previous:From: wsmeyerDate: 2004-02-11 02:05:03
Subject: unsubscribe

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group