Thread: LIKE and ESCAPING in JDBC Select Statement

LIKE and ESCAPING in JDBC Select Statement

From
Andrew Lindesay
Date:
Hello;

I am trying to use the JDBC LIKE escape clause with PG 8.4 and the PG 8.4 JDBC driver.

So far I have tried;

SELECT ... WHERE ... AND (t0.MESSAGE ILIKE ? {escape '|'}) LIMIT 50
SELECT ... WHERE ... AND (t0.MESSAGE ILIKE ?) {escape '|'} LIMIT 50
SELECT ... WHERE ... AND (t0.MESSAGE ILIKE ?) LIMIT 50 {escape '|'}

It seems that there is a problem with all of them.  If anybody has used this before and could give me some guidance,
thatwould be great. 

Regards;

___
Andrew Lindesay
www.lindesay.co.nz


Re: LIKE and ESCAPING in JDBC Select Statement

From
Kris Jurka
Date:

On Sat, 30 Jan 2010, Andrew Lindesay wrote:

> I am trying to use the JDBC LIKE escape clause with PG 8.4 and the PG
> 8.4 JDBC driver.
>
> So far I have tried;
>
> SELECT ... WHERE ... AND (t0.MESSAGE ILIKE ? {escape '|'}) LIMIT 50

This works for me as attached.  Please be more clear what your problem is.

Kris Jurka

Attachment

Re: LIKE and ESCAPING in JDBC Select Statement

From
Andrew Lindesay
Date:
Hi Kris;

I am very sure that was my first attempt and it didn't work yesterday, but I have now done exactly this and the
statementhas parsed.  Thanks for looking at it for me. 

cheers.

>> I am trying to use the JDBC LIKE escape clause with PG 8.4 and the PG 8.4 JDBC driver.
>> So far I have tried;
>> SELECT ... WHERE ... AND (t0.MESSAGE ILIKE ? {escape '|'}) LIMIT 50
> This works for me as attached.  Please be more clear what your problem is.


___
Andrew Lindesay
www.lindesay.co.nz