-1

In drupal 7 db_query, when i use (LIKE), i add (COLLATE utf8_turkish_ci) after field. Because i want to search by Turkish characters. It works fine.

But i dont know how i use this in db_select. For example; I use that condition

$query->condition('title', '%' . db_like($some_text) . '%', 'LIKE');

And i use orderby like that

$query->orderBy('title', 'ASC')

How can i add COLLATE utf8_turkish_ci for condition and order?

0

I have a solution now.

For LIKE;

$query->where('n.title COLLATE utf8_turkish_ci LIKE :title', array(':title' => '%'.db_like($some_text).'%'));

For ORDER BY;

$query->orderBy('n.title COLLATE utf8_turkish_ci', 'ASC');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.