summaryrefslogtreecommitdiff
path: root/modules/profile/profile.pages.inc
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2010-01-13 06:44:31 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2010-01-13 06:44:31 +0000
commit85213d3bee5c4373f12378c3fa910f0e93e6d678 (patch)
treed97cce804430817ebc6217fb25fb69e09171bf50 /modules/profile/profile.pages.inc
parent83c97345e8eada544d7da4586e2c77db469ed5b1 (diff)
downloadbrdo-85213d3bee5c4373f12378c3fa910f0e93e6d678.tar.gz
brdo-85213d3bee5c4373f12378c3fa910f0e93e6d678.tar.bz2
#279851 by catch, et al: Replace LOWER() with db_select() and LIKE() where possible.
Diffstat (limited to 'modules/profile/profile.pages.inc')
-rw-r--r--modules/profile/profile.pages.inc12
1 files changed, 8 insertions, 4 deletions
diff --git a/modules/profile/profile.pages.inc b/modules/profile/profile.pages.inc
index 9bb406bb4..bfc23e221 100644
--- a/modules/profile/profile.pages.inc
+++ b/modules/profile/profile.pages.inc
@@ -125,10 +125,14 @@ function profile_autocomplete($field, $string) {
$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);
}