pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Marek Lewczuk <newsy@lewczuk.com>
To: Kris Jurka <books@ejurka.com>
Cc: pgsql-jdbc <pgsql-jdbc@postgresql.org>
Subject: Re: AbstractJdbc2Array - another patch
Date: Thu, 22 Nov 2007 12:07:07 +0100
Message-ID: <474562DB.6090802@lewczuk.com> (raw)
In-Reply-To: <Pine.BSO.4.64.0711211452310.24674@leary.csoft.net>
References: <470DE5E7.2090807@lewczuk.com>
	<Pine.BSO.4.64.0710180401490.16749@leary.csoft.net>
	<47172FF2.6070203@lewczuk.com>
	<4717A074.4000109@ejurka.com>
	<4721D42E.4060107@lewczuk.com>
	<Pine.BSO.4.64.0710261209350.18147@leary.csoft.net>
	<47222D11.5010006@lewczuk.com>
	<Pine.BSO.4.64.0710281511210.31092@leary.csoft.net>
	<4726F311.8090001@lewczuk.com>
	<Pine.BSO.4.64.0711211452310.24674@leary.csoft.net>

Kris Jurka pisze:
> Attached is a revised version of your patch after I worked on it a bit. 
> Things I've changed:
> 
> 1) Looking up the array type for a base type by using typelem doesn't 
> work because typelem is not unique.  Since no code was calling 
> getPGTypeArray, I just removed this code.
Agree.

> 
> 3) Fixed the regression tests and added new ones to verify that array 
> handling works.
I wanted to do it, but I was waiting for you comments about my code.
Thanks for that.

> 4) Changed Array.getResultSet to use generic coding rather than 
> hardcoding type oids for each java.sql.Types value.  This allows 
> getResultSet to be used on types that aren't known to the driver, like 
> aclitem[].  You still can't call getArray on this type, but we're 
> getting closer.
Agree.

> 
> 5) Array.getResultSet didn't respect index or offset parameters.
Sorry, my mistake.

> 
> 6) For TypeInfoCache I've added a new column to link the base and array 
> types instead of duplicating the whole rows.
Agree.

> 
> 7) Code did not correctly handle a string value of NULL in arrays for 
> 8.1 and earlier server versions.
I was concentrate on make it working for >= 8.2 - again my mistake, sorry.

> So with these changes, I think the code is pretty much ready to go, with 
> the exception of how multidimensional results are returned.  The way you 
> wrap the arrays in Object[] makes it impossible to cast to things like 
> Integer[][].  Also I think we should be able to return multidimensional 
> arrays of primitive type if the "compatible" option is set to 8.2.  I 
> think you should be using java.lang.reflect.Array#newInstance to create 
> the arrays you are returning to get the correct type instead of building 
> them up incrementally.
Well, I aware that java.lang.reflect.Array#newInstance can be used
however I didn't know for what versions of JDK reflect package can be 
used - if you have mentioned about it so I guess that I can - in the 
attachment you can find AbstractJdbc2Array patch - please review it.

I one to discuss one more thing - see below lines in the AbstractJdb2Array:
this.useObjects = connection.haveMinimumCompatibleVersion("8.3");
this.haveMinServer82 = connection.haveMinimumServerVersion("8.2");

We must clarify, when to use objects instead of primitive types ? Can 
you describe it ?

Regards,
Marek

Attachments:

  array-patch.zip (application/x-zip-compressed, 8.5K) download

view thread (20+ messages)  latest in thread

Message-ID: <474562DB.6090802@lewczuk.com>
Permalink:  ../474562DB.6090802@lewczuk.com/
Also on:    postgresql.org/message-id/474562DB.6090802@lewczuk.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: newsy@lewczuk.com, books@ejurka.com
  Subject: Re: AbstractJdbc2Array - another patch
  In-Reply-To: <474562DB.6090802@lewczuk.com>
  References: <470DE5E7.2090807@lewczuk.com> <Pine.BSO.4.64.0710180401490.16749@leary.csoft.net> <47172FF2.6070203@lewczuk.com> <4717A074.4000109@ejurka.com> <4721D42E.4060107@lewczuk.com> <Pine.BSO.4.64.0710261209350.18147@leary.csoft.net> <47222D11.5010006@lewczuk.com> <Pine.BSO.4.64.0710281511210.31092@leary.csoft.net> <4726F311.8090001@lewczuk.com> <Pine.BSO.4.64.0711211452310.24674@leary.csoft.net> <474562DB.6090802@lewczuk.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox