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

Re: Retrieving arrays

From: Bendik Rognlien Johansen <bensmailinglists(at)gmail(dot)com>
To: Markus Schaber <schabi(at)logix-tt(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Retrieving arrays
Date: 2006-10-13 08:58:53
Message-ID: 06A202FE-D5CB-4087-9838-C3E2AB4181DE@gmail.com (view raw or flat)
Thread:
Lists: pgsql-jdbc
Hello,

In PL/Java:
String[] values = (String[]) rs.getObject(column);

Regular driver:
String[] values = (String[]) rs.getArray(column).getArray();

Strange..

On Oct 11, 2006, at 3:43 PM, Markus Schaber wrote:

> Hi, Bendik,
>
> Bendik Rognlien Johansen wrote:
>
>> yes you are right, I don't really understand Generics that well.  
>> But it
>> is a little clearer now :-)
>>
>> Anyway, I was hoping there would be a clean way to get arrays from  
>> the
>> result set, Generics or not, using a single method. I would like  
>> to avoid:
>> getStringArray, getIntegerArray etc.
>
> Usually, ResultSet.getArray() should do it.
>
>> The reason I need to do this is that I use two different drivers for
>> PostgreSQL with the same code, and they handle arrays differently.
>
> So you say that the the other one (pljava, IIRC) maps a postgresql
> integer[] to an java.lang.Integer[] in java, and not an int[] like  
> pgjdbc?
>
> Looks strange.
>
> Does the jdbc spec promote one or the other behaviour?
>
> However, I don't know a clean solution.
>
> Markus
> -- 
> Markus Schaber | Logical Tracking&Tracing International AG
> Dipl. Inf.     | Software Development GIS
>
> Fight against software patents in Europe! www.ffii.org
> www.nosoftwarepatents.org


In response to

Responses

pgsql-jdbc by date

Next:From: Markus SchaberDate: 2006-10-13 09:29:14
Subject: Re: Retrieving arrays
Previous:From: Guillaume CottenceauDate: 2006-10-13 07:48:40
Subject: 'now' is sometimes not now - but current_timestamp is

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