Re: [PATCHES] JDBC2 Array Patch (New feature)
Re: [PATCHES] JDBC2 Array Patch (New feature)
От:
Bruce Momjian <pgman@candle.pha.pa.us>
Дата:
Your patch has been added to the PostgreSQL unapplied patches list at: http://candle.pha.pa.us/cgi-bin/pgpatches I will try to apply it within the next 48 hours. > Hello... > > This is my first contribution for Postgresql, so I hope its > found the proper home. > > The patch adds Array support to the JDBC2 library (to myknowledge > Arrays aren't part of JDBC 1.0(?)). Specifically you can now use > the ResultSet.getArray() method to return an java.sql.Array object. > Its a really convenient way to load up a Java array with one > columns' worth of results. > > It is mostly implemented, except for a few less common data types > that I wasn't sure how to correctly pack into the tuples. The > JDBC Array method variants that use type Map objects are likewise > unsupported because the corresponding code in ResultSet has yet > to be enabled. Other than that its all there. > > The patch is for the 7.1.2 "latest" build. I tried building the > snapshot build but for some reason it wouldn't compile for me, > so the "latest" was the best available. > > To apply the patch: > > > cd to /src/interfaces/jdbc/org/postgresql > > patch -p1 < /PATH_TO_PATCH_FILE/patch.txt > > cd ../.. > > ant > > This will build the new postgresql.jar in the jars directory. > Please forward any comments to gzoller@hotmail.com. > > Thanks > Greg Zoller > > ps. I would be very grateful if the owner/maintainer of the > JDBC interface would fire off a short email to tell me if my > Array code is worthy of inclusion in the next Postgresql > release! > > _________________________________________________________________ > Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp [ Attachment, skipping... ] > > ---------------------------(end of broadcast)--------------------------- > TIP 3: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026
Re: Re: [PATCHES] JDBC2 Array Patch (New feature)
От:
Rene Pijlman <rpijlman@wanadoo.nl>
Дата:
On Wed, 8 Aug 2001 11:19:32 -0400 (EDT), Greg Zoller wrote: >> Specifically you can now use the ResultSet.getArray() method >> to return an java.sql.Array object. Its a really convenient >> way to load up a Java array with one columns' worth of results. I don't think this patch is a correct implementation of the JDBC spec. I've mailed this to Greg: R>Isn't ResultSet.getArray() supposed to fetch *one* value R>(the value of one column in one row) and interpret that as R>a structured value of an SQL array field R>(http://www.postgresql.org/users-lounge/docs/7.1/postgres/arrays.html)? R>It looks like your code is looping through the ResultSet R>and gathering data from multiple rows. And received this reply: G>You know what... I may have misinterpreted the JDBC spec! G>My original understanding was that getArray was supposed to G>iterate through a ResultSet and load up a Java array with G>the contents of a given field (i.e. column). But now as G>I re-read the specification it does actually mean the G>interpretation you gave (load a single field of type array G>into a Java array object). G> G>So it seems that my implementation of Array is based on a G>misunderstanding. :-( G> G>Massive bummer. Please disregard my patch. Greg, I do hope you continue your efforts! Not bad for a first patch anyway, mine was only 2 lines. We still need Array support badly... (hint, hint) :-) Regards, René Pijlman