X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 4CDF0CCBD0 for ; Sat, 19 Jul 2003 01:25:43 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 12177-09 for ; Sat, 19 Jul 2003 01:26:11 +0000 (GMT) Received: from yass.opencloud.co.nz (yass.opencloud.co.nz [203.79.85.162]) by svr1.postgresql.org (Postfix) with ESMTP id B4177CCBF1 for ; Fri, 18 Jul 2003 22:25:40 -0300 (ADT) Received: from flood.opencloud.co.nz ([192.168.0.31] ident=mail) by yass.opencloud.co.nz with esmtp (Exim 3.35 #1 (Debian)) id 19dgU5-0005Wd-00; Sat, 19 Jul 2003 13:26:01 +1200 Received: from oliver by flood.opencloud.co.nz with local (Exim 3.35 #1 (Debian)) id 19dgTz-0005Ha-00; Sat, 19 Jul 2003 13:25:55 +1200 Date: Sat, 19 Jul 2003 13:25:55 +1200 To: Dmitry Tkach Cc: Kim Ho , Fernando Nasser , Barry Lind , pgsql-jdbc-list , Dave Cramer Subject: Re: Prepared Statements Message-ID: <20030719012555.GA20158@opencloud.com> References: <3F1801C5.9030104@openratings.com> <3F181A81.70208@xythos.com> <3F18259C.6090503@redhat.com> <1058548037.19658.159.camel@topanga.toronto.redhat.com> <3F183004.4010508@openratings.com> <3F1830F6.3020203@openratings.com> <1058550328.19657.168.camel@topanga.toronto.redhat.com> <3F183423.9030900@openratings.com> <1058551402.20165.177.camel@topanga.toronto.redhat.com> <3F183AE0.8060204@openratings.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3F183AE0.8060204@openratings.com> User-Agent: Mutt/1.5.4i From: Oliver Jowett X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/163 X-Sequence-Number: 7547 On Fri, Jul 18, 2003 at 02:22:24PM -0400, Dmitry Tkach wrote: > What I am concerned about is the "in" thing - > > select * from sometable where x in ?; > setObject (1, "(1,2,3,4,5)"); > > that works just fine right now, and will be irreperably broken by this > patch... How about: + create an org.postgresql.InSet class that wraps an Object[] array and java.sql.Types value + use setObject(N, new InSet(myArray, Types.INTEGER)); The Javadoc for PreparedStatement.setObject() says: Note that this method may be used to pass datatabase- specific abstract data types, by using a driver-specific Java type. so presumably this is the right way to do it. setObject() would handle an InSet by individually escaping the components of the array it wraps as if they had been passed to setObject() and turning them into an IN-like clause. For arrays we just need to fix setArray() so that it does the same sort of thing as described above, using the java.sql.Array methods to get the component objects. And maybe provide a simple implementation of Array that wraps a Java array (users can always provide their own, anyway). Any thoughts? I can try to sort out patches, but I'm a bit short on time right now so no promises. -O