From: Kevin Grittner <Kevin.Grittner@wicourts.gov>
To: pgsql-jdbc@postgresql.org
Subject: ResultSet.getObject return type for smallint
Date: Tue, 07 Jun 2005 17:57:43 -0500
Message-ID: <s2a5e01f.063@gwmta.wicourts.gov> (raw)
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.
Index: AbstractJdbc2ResultSet.java
===================================================================
RCS file:
/usr/local/cvsroot/pgjdbc/pgjdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java,v
retrieving revision 1.74
inline patch 1: AbstractJdbc2ResultSet.java7 Jun 2005 22:53:02 -0000 (+0/-0 lines) download inline-1.patchdiff -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:
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: Kevin.Grittner@wicourts.gov
Subject: Re: ResultSet.getObject return type for smallint
In-Reply-To: <s2a5e01f.063@gwmta.wicourts.gov>
References: <s2a5e01f.063@gwmta.wicourts.gov>
* 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