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.

Model findFirst collations

I have a table column (pid) which is set to ascii_bin as collation, and when I run findFirstByPid, I get a general mysql error: #1267: Illegal mix of collations (ascii_bin,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation "="

Is there a way to circumvent this, or do I have to refactor it as a PHQL query?

(MariaDB 10, Phalcon 2.0.13)



35.6k
Accepted
answer
edited Apr '17

Sorry, as it turns out, it has nothing to do with Phalcon.

The code works fine if the findFirst parameter can be converted to ascii, but will throw this fit if it contains unmappable characters (which makes sense). Unfortunately the data vendor we are interfacing missed the whole point of unique identifiers, and uses accented characters for location ids...

Changing the charset to utf8_bin worked.