Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Case insensitive LIKE with PHQL

Hi

I'm porting my company's to Phalcon, We use MySQL, and when filtering data, use a query like this:

SELECT * from users where LOWER(name) LIKE LOWER(:name);

In the docs, I've seen that PHQL supports functions (TRIM, even custom ones) but I haven't been able to find a list of supported functions or how could one implement a custom one.

Any help would be appreciated.

Thanks



42.3k
Accepted
answer

MySQL is case insensitive, unless declared/collated as binary.

On custom functions, check out this: https://gist.github.com/andresgutierrez/2a729903f4b189e3ce75



1.7k

Thank you very much.



48.3k

Relevant collations to be familiar with are:

  • utf8_unicode_ci
  • utf8_bin
  • utf8_general_ci