Re: anyone know why this is failing - Mailing list pgsql-jdbc

From Kris Jurka
Subject Re: anyone know why this is failing
Date
Msg-id Pine.LNX.4.33.0402102225270.26959-100000@leary.csoft.net
Whole thread Raw
In response to anyone know why this is failing  (Dave Cramer <pg@fastcrypt.com>)
List pgsql-jdbc

>     ResultSet rs = pstmt.executeQuery("select (final-initial) as diff
> from test_interval");
>     while (rs.next() )
>     {
>       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


pgsql-jdbc by date:

Previous
From: wsmeyer@ibest.com.br
Date:
Subject: unsubscribe
Next
From: Ian Clarito
Date:
Subject: unsubscribe