Unix Technical Forum

implementing setObject(n, java array[])

This is a discussion on implementing setObject(n, java array[]) within the pgsql Interfaces jdbc forums, part of the PostgreSQL category; --> There are a number of people who would like to be able to do Statement.setObject( n, int[] ) as ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Interfaces jdbc

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-15-2008, 11:41 PM
Dave Cramer
 
Posts: n/a
Default implementing setObject(n, java array[])

There are a number of people who would like to be able to do

Statement.setObject( n, int[] )

as well as most other java primitive arrays.

The array implementation seems to be quite a stumbling block to non
java people . I certainly see the merit in doing this.

What do others think ?

Dave

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-15-2008, 11:46 PM
Jojo Paderes
 
Posts: n/a
Default Re: implementing setObject(n, java array[])

I've been looking for a way to pass array values of Java primitive
types to a PL/pgSQL function that accepts an array parameter. I keep
on getting this exception:

org.postgresql.util.PSQLException: Can't infer the SQL type to use for
an instance of [I. Use setObject() with an explicit Types value to
specify the type to use.

Also, I'm looking for a technical resource from the PGSQL JDBC site on
how to pass primitive array values to functions using the
CallableStatement class. Any tips on how to do this?

On 10/18/05, Dave Cramer <pg@fastcrypt.com> wrote:
> There are a number of people who would like to be able to do
>
> Statement.setObject( n, int[] )
>
> as well as most other java primitive arrays.
>
> The array implementation seems to be quite a stumbling block to non
> java people . I certainly see the merit in doing this.
>
> What do others think ?
>
> Dave


---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-15-2008, 11:46 PM
Dave Cramer
 
Posts: n/a
Default Re: implementing setObject(n, java array[])

Jojo,

The setObject array is not implemented. This is something we should
do. The spec suggests that you implement the java.sql.Array interface
on your object and
use setArray(n,Array)

Enough people have complained that I guess it's time we implemented it.

Patches are welcome!


Dave
On 20-Nov-05, at 11:01 AM, Jojo Paderes wrote:

> I've been looking for a way to pass array values of Java primitive
> types to a PL/pgSQL function that accepts an array parameter. I keep
> on getting this exception:
>
> org.postgresql.util.PSQLException: Can't infer the SQL type to use for
> an instance of [I. Use setObject() with an explicit Types value to
> specify the type to use.
>
> Also, I'm looking for a technical resource from the PGSQL JDBC site on
> how to pass primitive array values to functions using the
> CallableStatement class. Any tips on how to do this?
>
> On 10/18/05, Dave Cramer <pg@fastcrypt.com> wrote:
>> There are a number of people who would like to be able to do
>>
>> Statement.setObject( n, int[] )
>>
>> as well as most other java primitive arrays.
>>
>> The array implementation seems to be quite a stumbling block to non
>> java people . I certainly see the merit in doing this.
>>
>> What do others think ?
>>
>> Dave

>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings



---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 04:32 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com