Index: modules/comment/comment.module =================================================================== RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v retrieving revision 1.822 diff -u -p -r1.822 comment.module --- modules/comment/comment.module 26 Dec 2009 16:50:08 -0000 1.822 +++ modules/comment/comment.module 30 Dec 2009 03:29:38 -0000 @@ -1960,7 +1960,7 @@ function comment_form_validate($form, &$ $query = db_select('users', 'u'); $query->addField('u', 'uid', 'uid'); $taken = $query - ->where('LOWER(name) = :name', array(':name' => $form_state['values']['name'])) + ->condition('name', db_like($form_state['values']['name']), 'LIKE') ->countQuery() ->execute() ->fetchField(); Index: modules/profile/profile.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/profile/profile.admin.inc,v retrieving revision 1.36 diff -u -p -r1.36 profile.admin.inc --- modules/profile/profile.admin.inc 2 Dec 2009 14:56:32 -0000 1.36 +++ modules/profile/profile.admin.inc 30 Dec 2009 03:29:38 -0000 @@ -419,7 +419,12 @@ function profile_field_delete_submit($fo */ function profile_admin_settings_autocomplete($string) { $matches = array(); - $result = db_query_range("SELECT category FROM {profile_field} WHERE LOWER(category) LIKE LOWER(:category)", 0, 10, array(':category' => $string . '%')); + $result = db_select('profile_field') + ->fields('profile_field', array('category')) + ->condition('category', db_like($string) . '%', 'LIKE') + ->range(0, 10) + ->execute(); + foreach ($result as $data) { $matches[$data->category] = check_plain($data->category); } Index: modules/profile/profile.module =================================================================== RCS file: /cvs/drupal/drupal/modules/profile/profile.module,v retrieving revision 1.284 diff -u -p -r1.284 profile.module --- modules/profile/profile.module 14 Dec 2009 20:38:15 -0000 1.284 +++ modules/profile/profile.module 30 Dec 2009 03:29:39 -0000 @@ -611,8 +611,7 @@ function _profile_get_fields($category, $query->condition('register', 1); } else { - // Use LOWER(:category) instead of PHP's strtolower() to avoid UTF-8 conversion issues. - $query->where('LOWER(category) = LOWER(:category)', array(':category' => $category)); + $query->condition('category', db_like($category), 'LIKE'); } if (!user_access('administer users')) { $query->condition('visibility', PROFILE_HIDDEN, '<>'); Index: modules/profile/profile.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/profile/profile.pages.inc,v retrieving revision 1.22 diff -u -p -r1.22 profile.pages.inc --- modules/profile/profile.pages.inc 22 Dec 2009 14:47:14 -0000 1.22 +++ modules/profile/profile.pages.inc 30 Dec 2009 03:29:39 -0000 @@ -125,10 +125,14 @@ function profile_autocomplete($field, $s $matches = array(); $autocomplete_field = (bool) db_query_range("SELECT 1 FROM {profile_field} WHERE fid = :fid AND autocomplete = 1", 0, 1, array(':fid' => $field))->fetchField(); if ($autocomplete_field) { - $values = db_query_range("SELECT value FROM {profile_value} WHERE fid = :fid AND LOWER(value) LIKE LOWER(:value) GROUP BY value ORDER BY value ASC", 0, 10, array( - ':fid' => $field, - ':value' => $string . '%', - ))->fetchCol(); + $values = db_select('profile_value') + ->fields('profile_value', array('value')) + ->condition('fid', $field) + ->condition('value', db_like($string) . '%', 'LIKE') + ->groupBy('value') + ->orderBy('value') + ->range(0, 10) + ->execute()->fetchCol(); foreach ($values as $value) { $matches[$value] = check_plain($value); } Index: modules/user/user.module =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user.module,v retrieving revision 1.1095 diff -u -p -r1.1095 user.module --- modules/user/user.module 26 Dec 2009 16:50:09 -0000 1.1095 +++ modules/user/user.module 30 Dec 2009 03:29:40 -0000 @@ -747,9 +747,11 @@ function user_access($string, $account = * @return boolean TRUE for blocked users, FALSE for active. */ function user_is_blocked($name) { - $deny = db_query("SELECT name FROM {users} WHERE status = 0 AND name = LOWER(:name)", array(':name' => $name))->fetchObject(); - - return $deny; + return db_select('users') + ->fields('users', array('name')) + ->condition('name', db_like($name), 'LIKE') + ->condition('status', 0) + ->execute()->fetchObject(); } /** @@ -1051,7 +1053,7 @@ function user_account_form_validate($for if ($error = user_validate_name($form_state['values']['name'])) { form_set_error('name', $error); } - elseif ((bool) db_query_range("SELECT 1 FROM {users} WHERE uid <> :uid AND LOWER(name) = LOWER(:name)", 0, 1, array(':uid' => $account->uid, ':name' => $form_state['values']['name']))->fetchField()) { + elseif ((bool) db_select('users')->fields('users', array('uid'))->condition('uid', $account->uid, '<>')->condition('name', db_like($form_state['values']['name']), 'LIKE')->range(0, 1)->execute()->fetchField()) { form_set_error('name', t('The name %name is already taken.', array('%name' => $form_state['values']['name']))); } }