pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oliver Jowett <oliver@opencloud.com>
To: Saneesh Apte <san@calccit.org>
Cc: pgsql-bugs@postgresql.org
Cc: PostgreSQL - JDBC <pgsql-jdbc@postgresql.org>
Subject: Re: [JDBC] JDBC: 2 bugs: Getting a smallint array actually gets an integer array and return type of a boolean array is bit.
Date: Wed, 30 Jun 2010 13:10:33 +1200
Message-ID: <4C2A9989.2050302@opencloud.com> (raw)
In-Reply-To: <4C295503.5020506@calccit.org>
References: <4C295503.5020506@calccit.org>

Saneesh Apte wrote:

>     I think I found two bugs (and I hope I am not wasting everyone's time).
>     One is minor: the base type of a boolean[] is java.sql.Types.BIT 
> instead or java.sql.Types.BOOLEAN.  At the very least shouldn't these be 
> aliases for the same type?

Types.BOOLEAN does not exist before JDBC3. Client code can use either, 
but we have to pick one or the other when returning a value, so we 
return BIT.

>     And secondly the returned type from a smallint[] is an Integer[] 
> instead of a Short[].

smallint is a Types.SMALLINT which is mapped to java.lang.Integer by the 
JDBC spec. See appendix B of the spec:

> Note – The JDBC 1.0 specification defined the Java object mapping for the
> SMALLINT and TINYINT JDBC types to be Integer. The Java language did not
> include the Byte and Short data types when the JDBC 1.0 specification was
> finalized. The mapping of SMALLINT and TINYINT to Integer is maintained to
> preserve backwards compatibility.

-O



view thread (5+ messages)

Message-ID: <4C2A9989.2050302@opencloud.com>
Permalink:  ../4C2A9989.2050302@opencloud.com/
Also on:    postgresql.org/message-id/4C2A9989.2050302@opencloud.com

 · 

reply

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: oliver@opencloud.com, san@calccit.org, pgsql-bugs@postgresql.org
  Subject: Re: [JDBC] JDBC: 2 bugs: Getting a smallint array actually gets an integer array and return type of a boolean array is bit.
  In-Reply-To: <4C2A9989.2050302@opencloud.com>
  References: <4C295503.5020506@calccit.org> <4C2A9989.2050302@opencloud.com>

* 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