Skip site navigation (1) Skip section navigation (2)

Array helper patch

From: John Lister <john(dot)lister-ps(at)kickstone(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Array helper patch
Date: 2012-01-20 19:32:26
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-jdbc
When using a JPA provider such as EclipseLink, it is useful to be able 
to pass an array of values as a parameter, but they don't easily expose 
the raw Connection object in order to use createArrayOf to create a JDBC 
array. I've therefore attached a simple patch that modifies JDBC4 
statements to accept arrays of primitive objects (and their object form 
variants). Patched against latest cvs version.

Hopefully fairly obvious what it does, if an array is passed to 
setObject then it looks up the base type (rejecting mixed type arrays) 
and calls createArrayOf with the corresponding type. If an array of 
primitive types is passed, it converts these to their object form first. 
None primitive based types are rejected as well.

Thanks and comments



Attachment: pgjdbc.patch
Description: text/plain (5.0 KB)

pgsql-jdbc by date

Next:From: Kris JurkaDate: 2012-01-20 23:02:57
Subject: Re: test git conversion
Previous:From: Kris JurkaDate: 2012-01-20 19:25:52
Subject: Re: plpgsql function, comment with single quote, braces

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group