I can't find anything related to using COLLATE in a DQL query with Doctrine (and ofcourse it doesn't seem to work).
My specific problem:
I have a table with utf8_general_ci
charset. I have one specific field in it which has accented characters (like 'á', 'ű', 'ő' etc.)
A basic comparison with utf8_general_ci
is not able to determine the difference between regular chars and their accented pairs (a = á, u = ű, o = ő), which is perfectly fine for me for the majority of the queries that land on that table! So if I have let's say:
col1 | col2
------|-------
1 | árvíz
------|-------
2 | arviz
This query will return both results:
SELECT * FROM `table` WHERE `col2` = 'arviz'
Again, this is perfectly fine for me for most of the use cases!
But there is one specific funcionality, where I need to determine the difference, and in regular MySQL I could use:
SELECT * FROM `table` WHERE `col2` COLLATE utf8_bin = 'arviz'
This returns only the unaccented version.
The question is, can something like this be done using either Doctrine's createQuery (write the dql), or query builder?
I think I've read throught all the relevant documentation, but cannot find a way to do this. Is is possible somehow?
ci
. I try to find a custom COLLATE dql. – hattila