From: | Oliver Jowett <oliver(at)opencloud(dot)com> |
---|---|
To: | Steven Schlansker <stevenschlansker(at)gmail(dot)com> |
Cc: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Re: Accepting Object[] as an acceptable input to setObject with Types.ARRAY? |
Date: | 2011-06-03 22:47:03 |
Message-ID: | BANLkTikJ42vWwHutmBdPfAQN6O_ydRiwaA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
On 4 June 2011 08:04, Steven Schlansker <stevenschlansker(at)gmail(dot)com> wrote:
> It looks like adding support for such a fix to the Postgres driver would be extremely easy. In particular looking around AbstractJdbc2Statement.java:1732
>
> case Types.ARRAY:
> if (in instanceof Array)
> setArray(parameterIndex, (Array)in);
> else
> throw new PSQLException(GT.tr("Cannot cast an instance of {0} to type {1}", new Object[]{in.getClass().getName(),"Types.ARRAY"}), PSQLState.INVALID_PARAMETER_TYPE);
> break;
>
> it could check if in is an array type and if so synthesize the Array object necessary.
>
> Does this sound like a reasonable feature request? Did I miss an easier way to do this? It is probably outside of the JDBC spec but it at least has some traction with H2...
How do you determine the type of the (server-side) array elements?
i.e. what is the typename that setObject would pass to createArrayOf()
when it encountered an Object[]?
Oliver
From | Date | Subject | |
---|---|---|---|
Next Message | Steven Schlansker | 2011-06-03 23:05:45 | Re: Accepting Object[] as an acceptable input to setObject with Types.ARRAY? |
Previous Message | Steven Schlansker | 2011-06-03 22:42:50 | Re: Accepting Object[] as an acceptable input to setObject with Types.ARRAY? |