Ok, but actually I have to compose a very complex query and it would be better to be coherent between LIKE (case sensitive) and ILIKE (case insensitive) in such composition. As far as you know, is it possible to define a custom infix operator (as ILIKE)? I would prefer to perform the query as "field ILIKE value" and not as "ILIKE(field,value)".

Thank you


Il 26/05/2014 12.27, 'Jasper N. Brouwer' via doctrine-user ha scritto:
You can create a custom DQL function [1] to implement ILIKE.

[1]: 
http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/dql-doctrine-query-language.html#adding-your-own-functions-to-the-dql-language

--
Jasper N. Brouwer
(@jaspernbrouwer)


On 26 May 2014 at 11:49:43, Gianvito Pio ([email protected]) wrote:
Hi all.
I'm working with Symfony 2.3, Doctrine 2.4 and PostgreSQL 9.2.
I just want to perform two simple queries, according to the value of a
checkbox. Such queries are:
1) SELECT * FROM table WHERE field LIKE 'Something'
2) SELECT * FROM table WHERE field ILIKE 'Something'
In PostgreSQL, the first is case sensitive, while the second is case
insensitive. I know that in Doctrine ILIKE does not exist and that I should
use the LOWER function. However, if I specify some special characters in
the query (for example 'รจ'), I get an error when I use the case insensitive
version (that is, when using the LOWER function).
In particular, the error I get is the following: SQLSTATE[22021]: Character not in repertoire: 7 ERROR: invalid byte
sequence for encoding "UTF8": 0xe3 0xa8 0x20
Everything works fine when I do not use the LOWER function. I already
checked the encoding and it is UTF8 for both the database and the
client_encoding parameter of PostgreSQL.
Any suggestion? Thank you


--
You received this message because you are subscribed to the Google Groups 
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to