Re: AbstractJdbc2Array - another patch

Поиск
Список
Период
Сортировка
Искать
От
Marek Lewczuk
Тема
Re: AbstractJdbc2Array - another patch
Дата
Msg-id
474562DB.6090802@lewczuk.com
Ответ на
Список
Дерево обсуждения
AbstractJdbc2Array - another patch Marek Lewczuk <newsy@lewczuk.com>
Re: AbstractJdbc2Array - another patch "Heikki Linnakangas" <heikki@enterprisedb.com>
Re: AbstractJdbc2Array - another patch Kris Jurka <books@ejurka.com>
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
В списке pgsql-jdbc по дате отправления
От: Kris Jurka
Дата:
От: Marek Lewczuk
Дата:
FAQ