[Svn] r4532 - trunk/roundcubemail/program/include

trac at roundcube.net trac at roundcube.net
Sat Feb 12 15:14:11 CET 2011


Author: thomasb
Date: 2011-02-12 08:14:11 -0600 (Sat, 12 Feb 2011)
New Revision: 4532

Modified:
   trunk/roundcubemail/program/include/rcube_user.php
Log:
Move BINARY modifier to make MYSQL use index again

Modified: trunk/roundcubemail/program/include/rcube_user.php
===================================================================
--- trunk/roundcubemail/program/include/rcube_user.php	2011-02-12 08:48:22 UTC (rev 4531)
+++ trunk/roundcubemail/program/include/rcube_user.php	2011-02-12 14:14:11 UTC (rev 4532)
@@ -359,13 +359,12 @@
         $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 = ?";
+        $query = "SELECT * FROM ".get_table_name('users')." WHERE mail_host = ? AND username = $mod ?";
+        $sql_result = $dbh->query($query, $host, $user);
 
-        $sql_result = $dbh->query(sprintf($query, $prefix.'username'), $host, $user);
-
         // query for matching alias
         if (!($sql_arr = $dbh->fetch_assoc($sql_result))) {
             $sql_result = $dbh->query(sprintf($query, $prefix.'alias'), $host, $user);

_______________________________________________
http://lists.roundcube.net/mailman/listinfo/svn



More information about the Svn mailing list