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