JDBC Array Support, Take 2

From: "Greg Zoller" <gzoller(at)hotmail(dot)com>
To: pgsql-patches(at)postgresql(dot)org
Subject: JDBC Array Support, Take 2
Date: 2001-08-10 16:38:43
Message-ID: F111rGGXP9ww1WySvX500005c86@hotmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)hotmailcom(dot)

Greg

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

Attachment Content-Type Size
patch.txt text/plain 18.9 KB

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Rene Pijlman 2001-08-10 17:57:33 Re: JDBC Array Support, Take 2
Previous Message Bruce Momjian 2001-08-10 15:07:10 Re: contrib/postgis spatial extensions