Re: Issues with Array interface?

From: Dave Cramer <Dave(at)micro-automation(dot)net>
To: Noel Rappin <nrappin(at)sockeye(dot)com>
Cc: "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Issues with Array interface?
Date: 2002-05-30 15:20:23
Message-ID: 1022772023.24869.78.camel@inspiron.cramers
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Noel,

It would be helpful if you could provide sample code, and table
definitions (just enough to reproduce the problem) .

Dave
On Thu, 2002-05-30 at 11:10, Noel Rappin wrote:
> I'm having some problems with the Array interface in 7.2, and I'm
> wondering if somebody can point me to a workaround.
>
> Issue 1:
>
> The array in the database is of type real[]. The code:
>
> Array dataArray = rs.getArray("value");
> Float[] data = (Float[]) dataArray.getArray();
>
> gives me a class cast exception. This seems to be true no matter what I
> try to cast the array to (even Object[]), When I work around by using
> dataArray.getResultSet(), it correctly casts the individual elements of
> the result to Float. I have an analagous problem when the array is of
> type smallint. Since I can work around this with the result set, it's
> less of a problem, but it is strange.
>
> Issue 2:
>
> The array in the database is of type timestamp with time zone [].
>
> Array timeArray = rs.getArray("time");
> Timestamp[] times = (Timestamp[]) timeArray.getArray();
>
> runs without a class cast exception, however every element in the array
> is set to the same value -- the value that would be at times[0]. This
> problem persists even if I use getResultSet() -- even when I next()
> through the array, the data value does not change. I can't seem to
> access the later values in the array at all.
>
> Has anybody else seen this problem? Any suggestions for workarounds?
> The data can be accessed correctly through psql, so I believe the
> problem must be in the driver.
>
> Thanks,
>
> Noel Rappin
>
>
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
>
>

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Noel Rappin 2002-05-30 15:35:48 Re: Issues with Array interface?
Previous Message Noel Rappin 2002-05-30 15:10:30 Issues with Array interface?