From: Kris Jurka <books@ejurka.com>
To: Xavier Poinsard <xpoinsard@free.fr>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Patch for jdbc escaped functions
Date: Fri, 19 Nov 2004 23:47:41 -0500 (EST)
Message-ID: <Pine.BSO.4.56.0411192332570.303@leary.csoft.net> (raw)
In-Reply-To: <cnkudq$37n$1@sea.gmane.org>
References: <cnkudq$37n$1@sea.gmane.org>
On Fri, 19 Nov 2004, Xavier Poinsard wrote:
> Hi,
> I saw that escaped functions were on the TODO list.
> Here is a patch that prepare for adding escaped functions.
> It supports nested escapes.
> As example I have coded the concat function.
> Tests and metadata updates are included.
> If the patch is accepted, I will add more functions.
> Any comments are welcome.
>
This code is not quite right in its determination of function arguments
because it stops checking for literal and identifier markers.
Consider that {fn concat('(', a."(")} should work.
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?
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: books@ejurka.com, xpoinsard@free.fr
Subject: Re: Patch for jdbc escaped functions
In-Reply-To: <Pine.BSO.4.56.0411192332570.303@leary.csoft.net>
References: <cnkudq$37n$1@sea.gmane.org> <Pine.BSO.4.56.0411192332570.303@leary.csoft.net>
* 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