pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Retrieving arrays
11+ messages / 4 participants
[nested] [flat]

* Retrieving arrays
@ 2006-10-10 13:15 Bendik Rognlien Johansen <bensmailinglists@gmail.com>
  2006-10-10 17:59 ` Re: Retrieving arrays Mark Lewis <mark.lewis@mir3.com>
  2006-10-11 12:42 ` Re: Retrieving arrays Markus Schaber <schabi@logix-tt.com>
  0 siblings, 2 replies; 11+ messages in thread

From: Bendik Rognlien Johansen @ 2006-10-10 13:15 UTC (permalink / raw)
  To: pgsql-jdbc

Hello,
I wrote this method to read arrays from my result set.


public class MyClass {
   public <T> T[] getArray(ResultSet rs, String column) throws  
Exception {
     if(rs.getArray(column) != null) {
       return (T[]) rs.getArray(column).getArray();
     }
     return null;
   }
}



I call i like this:

String[] values = MyClass.<String>getArray(rs, "myStringArrayColumn"));

  This works fine. ( "myStringArrayColumn" is of type character  
varying(64)[])


But, when I call:

Integer[] values = MyClass.<Integer>getArray(rs,  
"myIntegerArrayColumn"));
( "myIntegerArrayColumn" is of type integer[])


I get a:
java.lang.ClassCastException: [I


Any ideas?

Thanks



^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: Retrieving arrays
  2006-10-10 13:15 Retrieving arrays Bendik Rognlien Johansen <bensmailinglists@gmail.com>
@ 2006-10-10 17:59 ` Mark Lewis <mark.lewis@mir3.com>
  2006-10-11 11:54   ` Re: Retrieving arrays Bendik Rognlien Johansen <bensmailinglists@gmail.com>
  1 sibling, 1 reply; 11+ messages in thread

From: Mark Lewis @ 2006-10-10 17:59 UTC (permalink / raw)
  To: Bendik Rognlien Johansen <bensmailinglists@gmail.com>; +Cc: pgsql-jdbc

Java 5 doesn't support auto-boxing an int[] as an Integer[].

-- Mark Lewis

On Tue, 2006-10-10 at 15:15 +0200, Bendik Rognlien Johansen wrote:
> Hello,
> I wrote this method to read arrays from my result set.
> 
> 
> public class MyClass {
>    public <T> T[] getArray(ResultSet rs, String column) throws  
> Exception {
>      if(rs.getArray(column) != null) {
>        return (T[]) rs.getArray(column).getArray();
>      }
>      return null;
>    }
> }
> 
> 
> 
> I call i like this:
> 
> String[] values = MyClass.<String>getArray(rs, "myStringArrayColumn"));
> 
>   This works fine. ( "myStringArrayColumn" is of type character  
> varying(64)[])
> 
> 
> But, when I call:
> 
> Integer[] values = MyClass.<Integer>getArray(rs,  
> "myIntegerArrayColumn"));
> ( "myIntegerArrayColumn" is of type integer[])
> 
> 
> I get a:
> java.lang.ClassCastException: [I
> 
> 
> Any ideas?
> 
> Thanks
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Have you searched our list archives?
> 
>                http://archives.postgresql.org



^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: Retrieving arrays
  2006-10-10 13:15 Retrieving arrays Bendik Rognlien Johansen <bensmailinglists@gmail.com>
  2006-10-10 17:59 ` Re: Retrieving arrays Mark Lewis <mark.lewis@mir3.com>
@ 2006-10-11 11:54   ` Bendik Rognlien Johansen <bensmailinglists@gmail.com>
  0 siblings, 0 replies; 11+ messages in thread

From: Bendik Rognlien Johansen @ 2006-10-11 11:54 UTC (permalink / raw)
  To: pgsql-jdbc

Ok, thanks! So, that probably means I can not do this sort of thing  
with Generics?

Is there any way the driver could get the same behavior as the driver  
used in PL/Java? In PL/Java i can do:
return (String[]) rs.getObject(column);

On Oct 10, 2006, at 7:59 PM, Mark Lewis wrote:

> Java 5 doesn't support auto-boxing an int[] as an Integer[].
>
> -- Mark Lewis
>
> On Tue, 2006-10-10 at 15:15 +0200, Bendik Rognlien Johansen wrote:
>> Hello,
>> I wrote this method to read arrays from my result set.
>>
>>
>> public class MyClass {
>>    public <T> T[] getArray(ResultSet rs, String column) throws
>> Exception {
>>      if(rs.getArray(column) != null) {
>>        return (T[]) rs.getArray(column).getArray();
>>      }
>>      return null;
>>    }
>> }
>>
>>
>>
>> I call i like this:
>>
>> String[] values = MyClass.<String>getArray(rs,  
>> "myStringArrayColumn"));
>>
>>   This works fine. ( "myStringArrayColumn" is of type character
>> varying(64)[])
>>
>>
>> But, when I call:
>>
>> Integer[] values = MyClass.<Integer>getArray(rs,
>> "myIntegerArrayColumn"));
>> ( "myIntegerArrayColumn" is of type integer[])
>>
>>
>> I get a:
>> java.lang.ClassCastException: [I
>>
>>
>> Any ideas?
>>
>> Thanks
>>
>> ---------------------------(end of  
>> broadcast)---------------------------
>> TIP 4: Have you searched our list archives?
>>
>>                http://archives.postgresql.org
>
> ---------------------------(end of  
> broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
>
>                http://www.postgresql.org/docs/faq




^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: Retrieving arrays
  2006-10-10 13:15 Retrieving arrays Bendik Rognlien Johansen <bensmailinglists@gmail.com>
@ 2006-10-11 12:42 ` Markus Schaber <schabi@logix-tt.com>
  2006-10-11 13:39   ` Re: Retrieving arrays Bendik Rognlien Johansen <bensmailinglists@gmail.com>
  1 sibling, 1 reply; 11+ messages in thread

From: Markus Schaber @ 2006-10-11 12:42 UTC (permalink / raw)
  To: Bendik Rognlien Johansen <bensmailinglists@gmail.com>; +Cc: pgsql-jdbc

Hi, bendik,

Bendik Rognlien Johansen wrote:

> I wrote this method to read arrays from my result set.
> 
> public class MyClass {
>   public <T> T[] getArray(ResultSet rs, String column) throws Exception {
>     if(rs.getArray(column) != null) {
>       return (T[]) rs.getArray(column).getArray();
>     }
>     return null;
>   }
> }

It seems that you misunderstand the concepts of Generics.

Your method will call the getArray() method, and then try to cast (not
convert) whatever this method returns into an T[]. And, due to erasure,
this cast is not even done in MyClass.getArray(), but in the code that
calls MyClass.getArray().

So getArray() does not even know about T, it just returns what its
mapping of the PostgreSQL types to java tells it to.

http://www.angelikalanger.com/GenericsFAQ/JavaGenericsFAQ.html should be
a good reading, and in case of any doubts,
http://java.sun.com/docs/books/jls/index.html

> I call i like this:
> 
> String[] values = MyClass.<String>getArray(rs, "myStringArrayColumn"));
> 
>  This works fine. ( "myStringArrayColumn" is of type character
> varying(64)[])

Yes, it works fine. ResultSet.getArray maps the varchar[] to a String[],
and then your 'String[] values=' assignment casts that to String[],
which works fine.

> But, when I call:
> 
> Integer[] values = MyClass.<Integer>getArray(rs, "myIntegerArrayColumn"));
> ( "myIntegerArrayColumn" is of type integer[])
> 
> I get a:
> java.lang.ClassCastException: [I

This one fails. ResultSet.getArray maps the integer[] to a int[], not to
an Integer[]. And so, the cast will fail.


HTH,
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



^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: Retrieving arrays
  2006-10-10 13:15 Retrieving arrays Bendik Rognlien Johansen <bensmailinglists@gmail.com>
  2006-10-11 12:42 ` Re: Retrieving arrays Markus Schaber <schabi@logix-tt.com>
@ 2006-10-11 13:39   ` Bendik Rognlien Johansen <bensmailinglists@gmail.com>
  2006-10-11 13:43     ` Re: Retrieving arrays Markus Schaber <schabi@logix-tt.com>
  0 siblings, 1 reply; 11+ messages in thread

From: Bendik Rognlien Johansen @ 2006-10-11 13:39 UTC (permalink / raw)
  To: Markus Schaber <schabi@logix-tt.com>; +Cc: pgsql-jdbc

Hello,
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.

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.

Thanks!


On Oct 11, 2006, at 2:42 PM, Markus Schaber wrote:

> Hi, bendik,
>
> Bendik Rognlien Johansen wrote:
>
>> I wrote this method to read arrays from my result set.
>>
>> public class MyClass {
>>   public <T> T[] getArray(ResultSet rs, String column) throws  
>> Exception {
>>     if(rs.getArray(column) != null) {
>>       return (T[]) rs.getArray(column).getArray();
>>     }
>>     return null;
>>   }
>> }
>
> It seems that you misunderstand the concepts of Generics.
>
> Your method will call the getArray() method, and then try to cast (not
> convert) whatever this method returns into an T[]. And, due to  
> erasure,
> this cast is not even done in MyClass.getArray(), but in the code that
> calls MyClass.getArray().
>
> So getArray() does not even know about T, it just returns what its
> mapping of the PostgreSQL types to java tells it to.
>
> http://www.angelikalanger.com/GenericsFAQ/JavaGenericsFAQ.html  
> should be
> a good reading, and in case of any doubts,
> http://java.sun.com/docs/books/jls/index.html
>
>> I call i like this:
>>
>> String[] values = MyClass.<String>getArray(rs,  
>> "myStringArrayColumn"));
>>
>>  This works fine. ( "myStringArrayColumn" is of type character
>> varying(64)[])
>
> Yes, it works fine. ResultSet.getArray maps the varchar[] to a  
> String[],
> and then your 'String[] values=' assignment casts that to String[],
> which works fine.
>
>> But, when I call:
>>
>> Integer[] values = MyClass.<Integer>getArray(rs,  
>> "myIntegerArrayColumn"));
>> ( "myIntegerArrayColumn" is of type integer[])
>>
>> I get a:
>> java.lang.ClassCastException: [I
>
> This one fails. ResultSet.getArray maps the integer[] to a int[],  
> not to
> an Integer[]. And so, the cast will fail.
>
>
> HTH,
> 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




^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: Retrieving arrays
  2006-10-10 13:15 Retrieving arrays Bendik Rognlien Johansen <bensmailinglists@gmail.com>
  2006-10-11 12:42 ` Re: Retrieving arrays Markus Schaber <schabi@logix-tt.com>
  2006-10-11 13:39   ` Re: Retrieving arrays Bendik Rognlien Johansen <bensmailinglists@gmail.com>
@ 2006-10-11 13:43     ` Markus Schaber <schabi@logix-tt.com>
  2006-10-11 16:32       ` Re: Retrieving arrays Dave Cramer <pg@fastcrypt.com>
  2006-10-13 08:58       ` Re: Retrieving arrays Bendik Rognlien Johansen <bensmailinglists@gmail.com>
  0 siblings, 2 replies; 11+ messages in thread

From: Markus Schaber @ 2006-10-11 13:43 UTC (permalink / raw)
  To: Bendik Rognlien Johansen <bensmailinglists@gmail.com>; +Cc: pgsql-jdbc

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



^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: Retrieving arrays
  2006-10-10 13:15 Retrieving arrays Bendik Rognlien Johansen <bensmailinglists@gmail.com>
  2006-10-11 12:42 ` Re: Retrieving arrays Markus Schaber <schabi@logix-tt.com>
  2006-10-11 13:39   ` Re: Retrieving arrays Bendik Rognlien Johansen <bensmailinglists@gmail.com>
  2006-10-11 13:43     ` Re: Retrieving arrays Markus Schaber <schabi@logix-tt.com>
@ 2006-10-11 16:32       ` Dave Cramer <pg@fastcrypt.com>
  1 sibling, 0 replies; 11+ messages in thread

From: Dave Cramer @ 2006-10-11 16:32 UTC (permalink / raw)
  To: Markus Schaber <schabi@logix-tt.com>; +Cc: Bendik Rognlien Johansen <bensmailinglists@gmail.com>; pgsql-jdbc


On 11-Oct-06, at 9:43 AM, 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?
Yes, the spec, and the desire to not create a huge number of objects  
does promote one method over another

pp 285 from JDBC API Tutorial and Reference 3rd Edition states

"The data type for the elements is determined by the standard mapping  
from JDBC Types to Objects ... There is one very important exception  
to this rule. If the base type of the array maps to a primitive type  
in the Java programming language, the base type of the returned array  
will be the primitive type rather than the Object type"

So I'd suggest you file a bug with pl/java

Dave
>
> 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
>
> ---------------------------(end of  
> broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
>
>                http://www.postgresql.org/docs/faq
>




^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: Retrieving arrays
  2006-10-10 13:15 Retrieving arrays Bendik Rognlien Johansen <bensmailinglists@gmail.com>
  2006-10-11 12:42 ` Re: Retrieving arrays Markus Schaber <schabi@logix-tt.com>
  2006-10-11 13:39   ` Re: Retrieving arrays Bendik Rognlien Johansen <bensmailinglists@gmail.com>
  2006-10-11 13:43     ` Re: Retrieving arrays Markus Schaber <schabi@logix-tt.com>
@ 2006-10-13 08:58       ` Bendik Rognlien Johansen <bensmailinglists@gmail.com>
  2006-10-13 09:29         ` Re: Retrieving arrays Markus Schaber <schabi@logix-tt.com>
  2006-10-13 10:35         ` Re: Retrieving arrays Dave Cramer <pg@fastcrypt.com>
  1 sibling, 2 replies; 11+ messages in thread

From: Bendik Rognlien Johansen @ 2006-10-13 08:58 UTC (permalink / raw)
  To: Markus Schaber <schabi@logix-tt.com>; +Cc: 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




^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: Retrieving arrays
  2006-10-10 13:15 Retrieving arrays Bendik Rognlien Johansen <bensmailinglists@gmail.com>
  2006-10-11 12:42 ` Re: Retrieving arrays Markus Schaber <schabi@logix-tt.com>
  2006-10-11 13:39   ` Re: Retrieving arrays Bendik Rognlien Johansen <bensmailinglists@gmail.com>
  2006-10-11 13:43     ` Re: Retrieving arrays Markus Schaber <schabi@logix-tt.com>
  2006-10-13 08:58       ` Re: Retrieving arrays Bendik Rognlien Johansen <bensmailinglists@gmail.com>
@ 2006-10-13 09:29         ` Markus Schaber <schabi@logix-tt.com>
  2006-10-26 15:30           ` Re: Retrieving arrays Bendik Rognlien Johansen <bensmailinglists@gmail.com>
  1 sibling, 1 reply; 11+ messages in thread

From: Markus Schaber @ 2006-10-13 09:29 UTC (permalink / raw)
  To: Bendik Rognlien Johansen <bensmailinglists@gmail.com>; +Cc: pgsql-jdbc

Hi, Bendik,

Bendik Rognlien Johansen wrote:

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

What does getArray() return here?

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

And what does getObject return here?

Thanks,
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



^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: Retrieving arrays
  2006-10-10 13:15 Retrieving arrays Bendik Rognlien Johansen <bensmailinglists@gmail.com>
  2006-10-11 12:42 ` Re: Retrieving arrays Markus Schaber <schabi@logix-tt.com>
  2006-10-11 13:39   ` Re: Retrieving arrays Bendik Rognlien Johansen <bensmailinglists@gmail.com>
  2006-10-11 13:43     ` Re: Retrieving arrays Markus Schaber <schabi@logix-tt.com>
  2006-10-13 08:58       ` Re: Retrieving arrays Bendik Rognlien Johansen <bensmailinglists@gmail.com>
  2006-10-13 09:29         ` Re: Retrieving arrays Markus Schaber <schabi@logix-tt.com>
@ 2006-10-26 15:30           ` Bendik Rognlien Johansen <bensmailinglists@gmail.com>
  0 siblings, 0 replies; 11+ messages in thread

From: Bendik Rognlien Johansen @ 2006-10-26 15:30 UTC (permalink / raw)
  To: Markus Schaber <schabi@logix-tt.com>; +Cc: pgsql-jdbc

Hello again. I have been away for a while.

Column "stringarray" is VARCHAR[]
Column "integerarray" is INTEGER[]

System.out.println("getObject: " + rs.getObject 
("integerarray").getClass());
System.out.println("getObject: " + rs.getObject 
("stringarray").getClass());

System.out.println("getArray: " + rs.getArray("integerarray").getClass 
());
System.out.println("getArray: " + rs.getArray("stringarray").getClass 
());

Regular driver:

getObject: class org.postgresql.jdbc3.Jdbc3Array
getObject: class org.postgresql.jdbc3.Jdbc3Array
getArray: class org.postgresql.jdbc3.Jdbc3Array
getArray: class org.postgresql.jdbc3.Jdbc3Array


PL/Java
getObject: class [Ljava.lang.Integer;
getObject: class [Ljava.lang.String;
ERROR:  java.sql.SQLException: Cannot derive a value of class  
java.sql.Array from an object of class [Ljava.lang.Integer;
ERROR:  java.sql.SQLException: Cannot derive a value of class  
java.sql.Array from an object of class [Ljava.lang.String;

Thanks!


On Oct 13, 2006, at 11:29 AM, Markus Schaber wrote:

> Hi, Bendik,
>
> Bendik Rognlien Johansen wrote:
>
>> In PL/Java:
>> String[] values = (String[]) rs.getObject(column);
>
> What does getArray() return here?



>
>> Regular driver:
>> String[] values = (String[]) rs.getArray(column).getArray();
>
> And what does getObject return here?
>
> Thanks,
> 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




^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: Retrieving arrays
  2006-10-10 13:15 Retrieving arrays Bendik Rognlien Johansen <bensmailinglists@gmail.com>
  2006-10-11 12:42 ` Re: Retrieving arrays Markus Schaber <schabi@logix-tt.com>
  2006-10-11 13:39   ` Re: Retrieving arrays Bendik Rognlien Johansen <bensmailinglists@gmail.com>
  2006-10-11 13:43     ` Re: Retrieving arrays Markus Schaber <schabi@logix-tt.com>
  2006-10-13 08:58       ` Re: Retrieving arrays Bendik Rognlien Johansen <bensmailinglists@gmail.com>
@ 2006-10-13 10:35         ` Dave Cramer <pg@fastcrypt.com>
  1 sibling, 0 replies; 11+ messages in thread

From: Dave Cramer @ 2006-10-13 10:35 UTC (permalink / raw)
  To: Bendik Rognlien Johansen <bensmailinglists@gmail.com>; +Cc: Markus Schaber <schabi@logix-tt.com>; pgsql-jdbc

Patches are welcome

I haven't looked at the spec, but I also think this is outside of the  
spec, but we have discussed it and feel it is intuitive enough to  
accept.

Dave
On 13-Oct-06, at 4:58 AM, Bendik Rognlien Johansen wrote:

> 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
>
>
> ---------------------------(end of  
> broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings
>




^ permalink  raw  reply  [nested|flat] 11+ messages in thread


end of thread, other threads:[~2006-10-26 15:30 UTC | newest]

Thread overview: 11+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-10-10 13:15 Retrieving arrays Bendik Rognlien Johansen <bensmailinglists@gmail.com>
2006-10-10 17:59 ` Mark Lewis <mark.lewis@mir3.com>
2006-10-11 11:54   ` Bendik Rognlien Johansen <bensmailinglists@gmail.com>
2006-10-11 12:42 ` Markus Schaber <schabi@logix-tt.com>
2006-10-11 13:39   ` Bendik Rognlien Johansen <bensmailinglists@gmail.com>
2006-10-11 13:43     ` Markus Schaber <schabi@logix-tt.com>
2006-10-11 16:32       ` Dave Cramer <pg@fastcrypt.com>
2006-10-13 08:58       ` Bendik Rognlien Johansen <bensmailinglists@gmail.com>
2006-10-13 09:29         ` Markus Schaber <schabi@logix-tt.com>
2006-10-26 15:30           ` Bendik Rognlien Johansen <bensmailinglists@gmail.com>
2006-10-13 10:35         ` Dave Cramer <pg@fastcrypt.com>

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