#1 2015-03-11 16:42:54

karolina
Member
Registered: 2014-08-09

case insensitive search

Hi,

I'd like to create a report that will return clients' data after a user inputs the client's name fragment into a text parameter field.
The query should be case-insensitive

So far I came to sth like that:

SELECT * FROM CLIENTS WHERE LOWER(NAME) LIKE '%$!{name.toLowerCase()}%'

However, using $!{parameter} is not recommended for security reasons, so my question is if there is a better way to do it.
The underlying database is Postgres and I set readOnly=true in URL.

Cheers,
karolina

Offline

#2 2015-03-11 16:49:21

Arno Mittelbach
datenwerke
Registered: 2012-02-14

Re: case insensitive search

Hi Karolina,

you should be able to use something like

SELECT * FROM CLIENTS WHERE LOWER(NAME) LIKE CONCAT('%',LOWER(${key}), '%')

Here key is the parameter's key.

Cheers,
Arno

Offline

#3 2015-03-11 16:55:31

karolina
Member
Registered: 2014-08-09

Re: case insensitive search

Thanks a lot for this super-fast hint!
karolina

Offline

Board footer

Powered by FluxBB