diff options
author | mkanat%kerio.com <> | 2005-04-08 03:18:52 +0200 |
---|---|---|
committer | mkanat%kerio.com <> | 2005-04-08 03:18:52 +0200 |
commit | 004d0c1cf93ac47317b490f83523c799f8651afd (patch) | |
tree | 40c95565f39cb0b2dc6990278cdf63aeb5d8f716 /Bugzilla | |
parent | 95973482f21efcac37d4c608bf6c47d67d9bfca3 (diff) | |
download | bugzilla-004d0c1cf93ac47317b490f83523c799f8651afd.tar.gz bugzilla-004d0c1cf93ac47317b490f83523c799f8651afd.tar.xz |
Bug 286686: ORDER BY column needs to be selected or grouped
Patch By Tomas Kopal <Tomas.Kopal@altap.cz> r=mkanat, a=justdave
Diffstat (limited to 'Bugzilla')
-rw-r--r-- | Bugzilla/User.pm | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm index 0d1b815c0..2096db407 100644 --- a/Bugzilla/User.pm +++ b/Bugzilla/User.pm @@ -598,7 +598,8 @@ sub match { # Build the query. my $sqlstr = &::SqlQuote($wildstr); - my $query = "SELECT DISTINCT userid, realname, login_name " . + my $query = "SELECT DISTINCT userid, realname, login_name, " .
+ "LENGTH(login_name) AS namelength " . "FROM profiles "; if (&::Param('usevisibilitygroups')) { $query .= ", user_group_map "; @@ -613,7 +614,7 @@ sub match { "AND grant_type <> " . GRANT_DERIVED; } $query .= " AND disabledtext = '' " if $exclude_disabled; - $query .= "ORDER BY length(login_name) "; + $query .= "ORDER BY namelength "; $query .= $dbh->sql_limit($limit) if $limit; # Execute the query, retrieve the results, and make them into @@ -648,7 +649,8 @@ sub match { my $sqlstr = &::SqlQuote(uc($str)); - my $query = "SELECT DISTINCT userid, realname, login_name " . + my $query = "SELECT DISTINCT userid, realname, login_name, " .
+ "LENGTH(login_name) AS namelength " . "FROM profiles"; if (&::Param('usevisibilitygroups')) { $query .= ", user_group_map"; @@ -665,7 +667,7 @@ sub match { " AND grant_type <> " . GRANT_DERIVED; } $query .= " AND disabledtext = ''" if $exclude_disabled; - $query .= " ORDER BY length(login_name)"; + $query .= " ORDER BY namelength"; $query .= " " . $dbh->sql_limit($limit) if $limit; &::PushGlobalSQLState(); &::SendSQL($query); |