Re: patch - support for multi-dimensional arrays and NULL values

Поиск
Список
Период
Сортировка
От Kris Jurka
Тема Re: patch - support for multi-dimensional arrays and NULL values
Дата
Msg-id Pine.BSO.4.64.0707160030520.28414@leary.csoft.net
обсуждение исходный текст
Ответ на Re: patch - support for multi-dimensional arrays and NULL values  (Marek Lewczuk <newsy@lewczuk.com>)
Ответы Re: patch - support for multi-dimensional arrays and NULL values  (Oliver Jowett <oliver@opencloud.com>)
Re: patch - support for multi-dimensional arrays and NULL values  (Marek Lewczuk <newsy@lewczuk.com>)
Список pgsql-jdbc

On Mon, 9 Jul 2007, Marek Lewczuk wrote:

>> in the attachment you can find AbstractJdbc2Array class with two fixed
>> features: null value as element of an array and... multi-dimensional
>> arrays support. There are two things related with this two changes:
>> - all arrays are objects arrays (which means that e.g. boolean[] is
>> represented as Boolean[])
>> - when multi-dimensional array is processed then Object[] is returned by
>> getArray() - it's because we can't declare in Java an array of unknown
>> dimension (so if PostgreSQL returns char[][] then jdbc will return
>> Object[], that contains String[] elements)
>>

I gave this a read and have some comments:

1) Your null checking needs to be version dependent.  Releases prior to
8.2 do not support null elements and you'll get:

# select array['a','NULL'];
   array
----------
  {a,NULL}
(1 row)

2) Changing from returning arrays of primitive types to arrays of objects
is necessary for null and multi-dimension support, but will still break
users code all over the place.  Not sure what we can do about that other
than put a strong warning in the release notes.

3) A lot of the code doesn't look like it handles multiple dimensions.
What about things like fillIntegerResultSet?  No that we're dealing with
objects can't we abstract a lot of these copies away and provide one
implementation that is multi-dimension aware?  If you do
Array.getResultSet you should be able to call ResultSet.getArray and the
getResultSet on that, right?

Kris Jurka



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

Предыдущее
От: Kris Jurka
Дата:
Сообщение: Re: Patch to improve Cloneable implementation on classes which extend PGobject.
Следующее
От: Kris Jurka
Дата:
Сообщение: Re: robust handling of initial connection with net interfaces down