From: | Kris Jurka <books(at)ejurka(dot)com> |
---|---|
To: | Marek Lewczuk <newsy(at)lewczuk(dot)com> |
Cc: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Re: patch - support for multi-dimensional arrays and NULL values |
Date: | 2007-07-16 04:40:19 |
Message-ID: | Pine.BSO.4.64.0707160030520.28414@leary.csoft.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Kris Jurka | 2007-07-16 05:17:54 | Re: robust handling of initial connection with net interfaces down |
Previous Message | Kris Jurka | 2007-07-16 04:12:02 | Re: Patch to improve Cloneable implementation on classes which extend PGobject. |