Re: AbstractJdbc2Array - another patch - Mailing list pgsql-jdbc

From Kris Jurka
Subject Re: AbstractJdbc2Array - another patch
Date
Msg-id Pine.BSO.4.64.0710180401490.16749@leary.csoft.net
Whole thread Raw
In response to AbstractJdbc2Array - another patch  (Marek Lewczuk <newsy@lewczuk.com>)
List 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

pgsql-jdbc by date:

Previous
From: Guy Rouillier
Date:
Subject: Re: Getting started with jdbc3 and eclipse
Next
From: Julius Stroffek
Date:
Subject: Re: [BUGS] 'on insert do instead' rule with a where clause responds 'INSERT 0 0'