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: Tue, 27 Nov 2007 10:02:07 +0100
Message-ID: <474BDD0F.6050609@lewczuk.com> (raw)
In-Reply-To: <Pine.BSO.4.64.0711240055520.505@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>
<474562DB.6090802@lewczuk.com>
<Pine.BSO.4.64.0711240055520.505@leary.csoft.net>
Kris Jurka pisze:
> Doesn't seem to work. The attached case fails in two different ways
> depending on whether compatible is set or not. The JDK methods you can
> use depends on where the code you are adding goes. In this case you're
> adding code to a JDBC2 class, so you are restricted to JDK1.2 code.
> JDBC3 -> 1.4, JDBC3g -> 1.5, JDBC4 -> 1.6.
It should work right now (I've tested it using your examples). As for
java.lang.reflect package it was added in JDK1.1, so it should work for
all supported Java versions.
> Right now you use objects if either dims > 1 or useObjects. I'm
> suggesting that we should only use objects if useObjects. That way
> people who want to get int[][] returned can get that via setting
> compatible=8.2.
Well, my implementation works as you described, have a look at
Boolean/boolean:
if (dims > 1 || useObjects) // if more than one dimension or objects
{
// here I check if more than one dimension and if so
// I check for useObjects - if true, then Boolean[] if false then
boolean[]
ret = oa = (dims > 1 ? (Object[])
java.lang.reflect.Array.newInstance(useObjects ? Boolean.class :
boolean.class, dimsLength) : new Boolean[count]);
}
else // if one dimension primitive array
{
ret = pa = new boolean[count];
}
In the attachment you can find appropriate patch. Please review it
again. Btw, you didn't answer about
ResultSetMetaData.getColumnTypeName() - does it mean, that we won't do
anything with that in near future ?
Best wishes,
Marek
Attachments:
AbstractJdbc2Array.patch.zip (application/x-zip-compressed, 8.6K) download
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: <474BDD0F.6050609@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> <Pine.BSO.4.64.0711240055520.505@leary.csoft.net> <474BDD0F.6050609@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