Re: AbstractJdbc2Array - another patch

From: Kris Jurka <books(at)ejurka(dot)com>
To: Marek Lewczuk <newsy(at)lewczuk(dot)com>
Cc: pgsql-jdbc <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: AbstractJdbc2Array - another patch
Date: 2007-10-18 08:12:40
Message-ID: Pine.BSO.4.64.0710180401490.16749@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Thu, 11 Oct 2007, Marek Lewczuk wrote:

> Hello all,
> in the attachment you can find AbstractJdbc2Array with small patch (empty
> array was wrongly interpreted). Please test it and if possible add to cvs.
>

I've finally found some time to test this and...

1) It causes six failures in the regression tests, these need to be fixed.

2) It would be good to have new tests for this new functionality.

3) When determing if NULL in an array string is a null value, you need to
check the server version. Prior to 8.2 an unadorned NULL is the text
"null", not an actual null value.

4) Shouldn't toString(PgArrayList) be PgArrayList.toString() ?

5) Your coding style is a little hard to read because you try to cram a
lot of code into a single line. Clarity is valued more than compactness.

Ex1 (line 214)

if (b != null && (b.length() > 0 || wasInsideString))
curArray.add(useObjects && !wasInsideString && b.equals("NULL") ? null :
b);

Ex2 (line 348)
oa[length++] = multi && v != null ? buildArray((PgArrayList) v, 0, -1) :
(v == null ? null : connection.getTimestampUtils().toTime(null, (String)
v));

6) I was unable to recursively retrieve multidimensional arrays as
ResultSets as I thought I should be able to do (in the attached test).
Shouldn't you retain an array as the base type for the top level of a
multi-dimensional array and expose a dimension at a time via each
ResultSet?

Kris Jurka

Attachment Content-Type Size
ArrayTest.java text/plain 980 bytes

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Andrei Ilitchev 2007-10-18 13:17:07 Fw: postgresql experts please help
Previous Message Guy Rouillier 2007-10-17 21:18:25 Re: Getting started with jdbc3 and eclipse