Issues with Array interface?

Поиск
Список
Период
Сортировка
От Noel Rappin
Тема Issues with Array interface?
Дата
Msg-id 3CF640E6.6040201@sockeye.com
обсуждение исходный текст
Ответы Re: Issues with Array interface?  (Dave Cramer <Dave@micro-automation.net>)
Issues with Array interface (String parsing)  (d a <devajx@yahoo.com>)
Список pgsql-jdbc
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






В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Dave Cramer
Дата:
Сообщение: Re: Doubt more info
Следующее
От: Dave Cramer
Дата:
Сообщение: Re: Issues with Array interface?