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

ResultSet.getObject return type for smallint

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: <pgsql-jdbc(at)postgresql(dot)org>
Subject: ResultSet.getObject return type for smallint
Date: 2005-06-07 22:57:43
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-jdbc
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.internalGetObject method. 
RCS file:

retrieving revision 1.74 
diff -u -r1.74 
--- 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 :
         case Types.SMALLINT: 
-            return new Short(getShort(columnIndex)); 
+            return new Integer(getShort(columnIndex)); 
         case Types.INTEGER: 
             return new Integer(getInt(columnIndex)); 
         case Types.BIGINT: 


pgsql-jdbc by date

Next:From: Oliver JowettDate: 2005-06-08 01:48:37
Subject: Re: ResultSet.getObject return type for smallint
Previous:From: Oliver JowettDate: 2005-06-07 22:40:53
Subject: Re: Num of returned ROWS

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