Re: Patch for jdbc escaped functions

Lists: pgsql-jdbc
From: Kris Jurka <books(at)ejurka(dot)com>
To: Xavier Poinsard <xpoinsard(at)free(dot)fr>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Patch for jdbc escaped functions
Date: 2004-12-06 13:24:39
Message-ID: Pine.BSO.4.56.0412060803570.3258@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

On Fri, 3 Dec 2004, Xavier Poinsard wrote:

> Here is the (final ?) patch adding escaped functions support.
> - soundex and difference (based on phonetics and I saw nothing like that
> in PostgreSql)

contrib/fuzzystrmatch has something along these lines. We can't assume
that's installed naturally and dynamically checking for it seems
excessive, but perhaps we could put in the mapping if someone wants to use
it, but just not report it in the DatabaseMetaData function?

> - timestampadd and timestampdiff

Yes, it is unclear what SQL_TSI_* really are.

> Note that the implementations for some functions may cause problem if an
> argument is a prepared statement argument since arguments may be
> duplicated and the order changed, but I don't know if this should be
> implemented for compliance.

This is a serious problem. Duplicating the argument and erroring out is
bad, and switching argument order and giving incorrect results is worse.
How many functions does this affect. Remapping could be done, but it
seems like a lot of work.

Another issue is that this doesn't compile with a 1.2 or 1.3 JDK because
of the code in AbstractJdbc2Statement.escapeFunction that calls
Exception.getCause which is a 1.4 addition.

One other minor thing I noticed is that 7.2 servers do not have the
current_database function. This is a very minor thing, but I'm not sure
what the best way to work around it is because right now the regression
test suite does pass against a 7.2 server and I'd like to keep it that
way.

Kris Jurka


From: "Xavier Poinsard" <xpoinsard(at)free(dot)fr>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Patch for jdbc escaped functions
Date: 2004-12-08 09:53:56
Message-ID: 41B6CF34.6050904@free.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

Kris Jurka wrote:
>>- soundex and difference (based on phonetics and I saw nothing like that
>>in PostgreSql)
> contrib/fuzzystrmatch has something along these lines. We can't assume
> that's installed naturally and dynamically checking for it seems
> excessive, but perhaps we could put in the mapping if someone wants to use
> it, but just not report it in the DatabaseMetaData function?

done.

> This is a serious problem. Duplicating the argument and erroring out is
> bad, and switching argument order and giving incorrect results is worse.
> How many functions does this affect. Remapping could be done, but it
> seems like a lot of work.

since only three functions are affected : insert, locate et right
I removed them from the supported list, but left the implementation.
I will document this later.

>
> Another issue is that this doesn't compile with a 1.2 or 1.3 JDK because
> of the code in AbstractJdbc2Statement.escapeFunction that calls
> Exception.getCause which is a 1.4 addition.

Fixed

> One other minor thing I noticed is that 7.2 servers do not have the
> current_database function. This is a very minor thing, but I'm not sure
> what the best way to work around it is because right now the regression
> test suite does pass against a 7.2 server and I'd like to keep it that
> way.

I only report it as supported for >=7.3 and same for the tests.

Additionnaly I rewrote the messages to reduce translation effort.

Xavier Poinsard.

Attachment Content-Type Size
escapedfunctions4.diff.gz application/x-gzip 7.7 KB

From: Kris Jurka <books(at)ejurka(dot)com>
To: Xavier Poinsard <xpoinsard(at)free(dot)fr>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Patch for jdbc escaped functions
Date: 2004-12-14 06:35:53
Message-ID: Pine.BSO.4.56.0412140132310.11386@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

On Wed, 8 Dec 2004, Xavier Poinsard wrote:

> [here's a patch to implement standard escaped functions]
>

Applied with some minor modifications. Notably:

Replace and insert don't work on 7.2 databases.

In junit code when writing assertEquals(x, y). x should be the expected
value and y is the variable value you are testing.

Kris Jurka