From: Xavier Poinsard <xpoinsard@free.fr>
Cc: pgsql-jdbc@postgresql.org <pgsql-jdbc@postgresql.org>
Subject: Re: Patch for jdbc escaped functions
Date: Wed, 24 Nov 2004 16:45:46 +0100
Message-ID: <41A4ACAA.7040307@free.fr> (raw)
In-Reply-To: <Pine.BSO.4.56.0411240552480.6336@leary.csoft.net>
References: <cnkudq$37n$1@sea.gmane.org>
<Pine.BSO.4.56.0411192332570.303@leary.csoft.net>
<41A1F323.1070508@free.fr>
<Pine.BSO.4.56.0411240552480.6336@leary.csoft.net>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: xpoinsard@free.fr
Subject: Re: Patch for jdbc escaped functions
In-Reply-To: <41A4ACAA.7040307@free.fr>
References: <cnkudq$37n$1@sea.gmane.org> <Pine.BSO.4.56.0411192332570.303@leary.csoft.net> <41A1F323.1070508@free.fr> <Pine.BSO.4.56.0411240552480.6336@leary.csoft.net> <41A4ACAA.7040307@free.fr>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox