summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2011-02-12 14:14:11 +0000
committerthomascube <thomas@roundcube.net>2011-02-12 14:14:11 +0000
commit7fb11ef6a91857ff37184487a994ea0017835d67 (patch)
treea0b9008efe3badd361d72e4eb59abe843971305f
parentf1e98a453d92ab2d495e7ea8a484c46b85c3cd98 (diff)
Move BINARY modifier to make MYSQL use index again
-rw-r--r--program/include/rcube_user.php7
1 files changed, 3 insertions, 4 deletions
diff --git a/program/include/rcube_user.php b/program/include/rcube_user.php
index ca4fb8b0c..ba5613554 100644
--- a/program/include/rcube_user.php
+++ b/program/include/rcube_user.php
@@ -359,12 +359,11 @@ class rcube_user
$dbh = rcmail::get_instance()->get_dbh();
// use BINARY (case-sensitive) comparison on MySQL, other engines are case-sensitive
- $prefix = preg_match('/^mysql/', $dbh->db_provider) ? 'BINARY ' : '';
+ $mod = preg_match('/^mysql/', $dbh->db_provider) ? 'BINARY' : '';
// query for matching user name
- $query = "SELECT * FROM ".get_table_name('users')." WHERE mail_host = ? AND %s = ?";
-
- $sql_result = $dbh->query(sprintf($query, $prefix.'username'), $host, $user);
+ $query = "SELECT * FROM ".get_table_name('users')." WHERE mail_host = ? AND username = $mod ?";
+ $sql_result = $dbh->query($query, $host, $user);
// query for matching alias
if (!($sql_arr = $dbh->fetch_assoc($sql_result))) {