JDBC Array Support, Take 2 - Mailing list pgsql-patches

From Greg Zoller
Subject JDBC Array Support, Take 2
Date
Msg-id F111rGGXP9ww1WySvX500005c86@hotmail.com
Whole thread Raw
Responses Re: JDBC Array Support, Take 2
List pgsql-patches
Ok, I've re-implemented Array.java in the JDBC2 driver.  This time
I think I've read the spec right! :-)  This functionality returns
an Array object from ResultSet that allows you to see this data as
either native Java arrays or as a ResultSet.  Access methods allow
you to capture slices of the array values.

As before, type maps are not supported in this version.  Another constraint
is that only single-dimension arrays are supported.  This is because the
JDBC slice parameters (index,count) seem to provide only a single-dimension
support to arrays.  [One might also make a strong argument that if you are
using n-dimensional arrays in a table you probably need a better database
design!]

Other behaviors:
-- Retrieving a single-value field (non-Array) field as an Array will
    result in an array containing a single element.
-- A null-valued field will return an empty array

Array driver support includes the following datatypes:

bool
int2
int4
int8
float4
float8
numeric
char
varchar
date
time
timestamp

The patchfile was created using this command:
>diff -bBdNrw -U5 OLD NEW > patch.txt

To install the patch:

>cd PATH_TO_PGSQL_SRC/src/interfaces/jdbc/org/postgresql/
>patch -p1 < PATH_TO_PATCH_FILE/patch.txt
>cd ../..
>ant

New postgresql.jar file is now built in the jars dir.

The patch process works for me against the 7.1.2 source release.
If for some reason it doesn't work for you, the changes are very
easy and can be done manually (add one line to error.properties,
create jdbc2/Array.java and a couple small edits to jdbc2/ResultSet.java).

Please send comments and feedback to gzoller@hotmailcom.

Greg

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp

Attachment

pgsql-patches by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: contrib/postgis spatial extensions
Next
From: Rene Pijlman
Date:
Subject: Re: JDBC Array Support, Take 2