Doctrine ORM – doctrine 2 case sensitive queries

For some reason, I need to query "case sensitive" 2 in MySQL principles Is it possible?

either

$em->find('UserEn','Bob')

either

$q = $this->em->createQuery('select u from UserEn u where u.name = :name');
$q->setParameter('name','Bob');
$result = $q->getResult();

at work. Any ideas?

Solution

Perhaps you are using a MySQL collation that ends with "_ci", such as "utf8_general_ci" "Ci" stands for "case insensitive"

see http://dev.mysql.com/doc/refman/5.0/en/case-sensitivity.html

"The default character set and collation are Latin1 and latin1_swedish_ci, so non binary string comparison is case insensitive by default."

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>