Re: AbstractJdbc2Array - another patch

From: Marek Lewczuk <newsy(at)lewczuk(dot)com>
To: Kris Jurka <books(at)ejurka(dot)com>
Cc: pgsql-jdbc <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: AbstractJdbc2Array - another patch
Date: 2007-11-27 09:02:07
Message-ID: 474BDD0F.6050609@lewczuk.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

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

Attachment Content-Type Size
AbstractJdbc2Array.patch.zip application/x-zip-compressed 8.6 KB

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message cncinfo@126.com 2007-11-27 15:03:41 cursor "curs" already in use ?
Previous Message Kris Jurka 2007-11-26 20:56:03 Re: How to add data with ResultSet object?