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 B755DCCDB0 for ; Fri, 18 Jul 2003 19:44:08 +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 18573-05 for ; Fri, 18 Jul 2003 19:44:39 +0000 (GMT) Received: from exchange.hq.openratings.com (unknown [141.149.165.226]) by svr1.postgresql.org (Postfix) with ESMTP id 2F16ACCD64 for ; Fri, 18 Jul 2003 16:44:03 -0300 (ADT) Received: from openratings.com (cancun.hq.openratings.com [10.0.0.225]) by exchange.hq.openratings.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id 38QM49X9; Fri, 18 Jul 2003 15:44:36 -0400 Message-ID: <3F184E3D.8020905@openratings.com> Date: Fri, 18 Jul 2003 15:45:01 -0400 From: Dmitry Tkach User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021130 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Darin Ohashi Cc: pgsql-jdbc-list Subject: Re: Prepared Statements References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/155 X-Sequence-Number: 7539 Darin Ohashi wrote: >If I could throw in a question from the sidelines... > >Is this something that a PreparedStatement should be able to handle, in general? > > I think yes. Depends on your definiton of "in general", of course, Where I come from, at least "in general", the PreparedStatement should be able to handle *everything* you can do with sql. > > >With a PreparedStatement that gets precompiled, will a substitution like this >work? > Depends on the implementation... If the backend doesn't support it, the driver should take care of working around that (e.g. by switching to 'non-precompiled' version in this case) until the backend is able to support it (I don't see any reason why it just cannot be done theoretically). > Do other JDBC drivers support this kind of substitution? > Yes. They do (at least, the ones I worked with do). > >It looks like you are exploiting a bug (or perhaps an out of spec behaviour) in >the JDBC. If that is the case, then I don't have much sympathy for you losing >this functionality. > I am not going to lose it :-) Thanks to the driver being opensource I have control over what I am going to lose :-) > >Instead of creating your own driver, why not just subclass Statement into >something that looks like a PreparedStatement but just glues strings together? > Ummm... because it already exists? That's what postgres PreparedStatement does (by default in 7.3, and always in previous versions)... >That sounds like what you want anyway. It also seems like a much eaiser task, >especially for long term maintainance. > > No, that's not what I want... What I want is an abstraction of the implementation-specific details, that lets me effectively execute sql queries. If it can precompile my query, I want it to precompile it. If it cannot, I can live with that (for a while). I just don't want to *know* what it is doing. Dima