Unix Technical Forum

ResultSet.getObject return type for smallint

This is a discussion on ResultSet.getObject return type for smallint within the pgsql Interfaces jdbc forums, part of the PostgreSQL category; --> According to Appendix B of the JDBC spec, ResultSet.getObject should use the mapping shown in table B-3 to determine ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Interfaces jdbc

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-15-2008, 11:19 PM
Kevin Grittner
 
Posts: n/a
Default ResultSet.getObject return type for smallint

According to Appendix B of the JDBC spec, ResultSet.getObject should use
the mapping shown in table B-3 to determine the object class returned.
Table B-3 shows SMALLINT mapping to Integer. In postgresql-jdbc-8.0-311
a Short is returned instead, which is causing problems for our software.
It looks like a one-line change will fix this -- in the
org.postgresql.jdbc2.AbstractJdbc2ResultSet.intern alGetObject method.

Index: AbstractJdbc2ResultSet.java
================================================== =================
RCS file:
/usr/local/cvsroot/pgjdbc/pgjdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java,v

retrieving revision 1.74
diff -u -r1.74 AbstractJdbc2ResultSet.java
--- AbstractJdbc2ResultSet.java8 May 2005 23:50:56 -00001.74
+++ AbstractJdbc2ResultSet.java7 Jun 2005 22:53:02 -0000
@@ -115,7 +115,7 @@
case Types.BIT:
return getBoolean(columnIndex) ? Boolean.TRUE :
Boolean.FALSE;
case Types.SMALLINT:
- return new Short(getShort(columnIndex));
+ return new Integer(getShort(columnIndex));
case Types.INTEGER:
return new Integer(getInt(columnIndex));
case Types.BIGINT:



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-15-2008, 11:19 PM
Oliver Jowett
 
Posts: n/a
Default Re: ResultSet.getObject return type for smallint

Kevin Grittner wrote:
>
> According to Appendix B of the JDBC spec, ResultSet.getObject should use
> the mapping shown in table B-3 to determine the object class returned.
> Table B-3 shows SMALLINT mapping to Integer. In
> postgresql-jdbc-8.0-311 a Short is returned instead, which is causing
> problems for our software. It looks like a one-line change will fix
> this -- in the
> org.postgresql.jdbc2.AbstractJdbc2ResultSet.intern alGetObject method.


Thanks for the report. I've applied a fix for this, plus support for
various other types in the mapping table that getObject() didn't handle
at all (BOOLEAN, TINYINT, DECIMAL, LONGVARCHAR, LONGVARBINARY, CLOB,
BLOB) to CVS HEAD and the stable 8.0 branch.

-O

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 08:40 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com