X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E0AD33A425C for ; Wed, 24 Nov 2004 15:45:53 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 26909-04 for ; Wed, 24 Nov 2004 15:45:48 +0000 (GMT) Received: from mallaury.noc.nerim.net (smtp-103-wednesday.noc.nerim.net [62.4.17.103]) by svr1.postgresql.org (Postfix) with ESMTP id 2FC3C3A420D for ; Wed, 24 Nov 2004 15:45:48 +0000 (GMT) Received: from [192.168.0.246] (secure.openpricer.com [80.65.224.34]) by mallaury.noc.nerim.net (Postfix) with ESMTP id 15CE56307C for ; Wed, 24 Nov 2004 16:45:43 +0100 (CET) Message-ID: <41A4ACAA.7040307@free.fr> Date: Wed, 24 Nov 2004 16:45:46 +0100 From: Xavier Poinsard User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20041007 Debian/1.7.3-5 X-Accept-Language: fr-fr, en-us, en MIME-Version: 1.0 Cc: "pgsql-jdbc@postgresql.org" Subject: Re: Patch for jdbc escaped functions References: <41A1F323.1070508@free.fr> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200411/192 X-Sequence-Number: 11614 Kris Jurka wrote: > > On Mon, 22 Nov 2004, Xavier Poinsard wrote: > > >>>I also don't like the prospect of a giant if/else block that has every >>>function that must do some kind of mapping/translation. What about a more >>>pluggable architecture perhaps along the lines of the following: >>> >>>public interface StandardFunction { >>> public void toSQL(StringBuffer sb, ArrayList args); >>>} >>> >>>Then a static HashMap of say lowercase function name -> StandardFunction >>>implementation can move all of the mapping/translation into a separate >>>place. Maybe that's overkill in the opposite direction. Thoughts? >> >>I used reflection to move the translation part to EscapedFunctions class. >>Right ? >> > > > I'm not sure why you are using reflection. The available functions will > be a static list, so I don't see what the purpose of dynamically > inspecting this class is. Having one class instead of dozens? Yes, considering the fact that each implementation would only consist of five lines of codes, it seems overkill to have one class per function. To avoid inspecting at every call, I could use a static HashMap containing references to Method objects. > > Kris Jurka