Re: Issues with Array interface?
От | Dave Cramer |
---|---|
Тема | Re: Issues with Array interface? |
Дата | |
Msg-id | 1022772023.24869.78.camel@inspiron.cramers обсуждение исходный текст |
Ответ на | Issues with Array interface? (Noel Rappin <nrappin@sockeye.com>) |
Список | 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 > >
В списке pgsql-jdbc по дате отправления: