From f5f31fc070588c2075dd13a0fbabe8117e3aad76 Mon Sep 17 00:00:00 2001 From: "mkanat%kerio.com" <> Date: Tue, 5 Apr 2005 04:52:03 +0000 Subject: Bug 286235: Implicit joins should be replaced by explicit joins - installment A Patch By Tomas Kopal r=joel, a=myk --- buglist.cgi | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'buglist.cgi') diff --git a/buglist.cgi b/buglist.cgi index d6567852b..cfcefee90 100755 --- a/buglist.cgi +++ b/buglist.cgi @@ -307,9 +307,11 @@ sub GetGroupsByUserId { # the columns for that row. my $groups = $dbh->selectall_arrayref( "SELECT DISTINCT groups.id, name, description, isactive - FROM groups, user_group_map - WHERE user_id = ? AND isbless = 0 - AND user_group_map.group_id = groups.id + FROM groups + INNER JOIN user_group_map + ON user_group_map.group_id = groups.id + WHERE user_id = ? + AND isbless = 0 AND isbuggroup = 1 ORDER BY description " , {Slice => {}}, ($userid)); @@ -873,14 +875,15 @@ while (my @row = $buglist_sth->fetchrow_array()) { # or because of human choice my %min_membercontrol; if (@bugidlist) { - my $sth = $dbh->prepare("SELECT DISTINCT bugs.bug_id, " . - "MIN(group_control_map.membercontrol) " . - "FROM bugs, bug_group_map " . - "LEFT JOIN group_control_map " . - "ON group_control_map.product_id=bugs.product_id " . - "AND group_control_map.group_id=bug_group_map.group_id " . - "WHERE bugs.bug_id = bug_group_map.bug_id " . - "AND bugs.bug_id IN (" . join(',',@bugidlist) . ") " . + my $sth = $dbh->prepare( + "SELECT DISTINCT bugs.bug_id, MIN(group_control_map.membercontrol) " . + "FROM bugs " . + "INNER JOIN bug_group_map " . + "ON bugs.bug_id = bug_group_map.bug_id " . + "LEFT JOIN group_control_map " . + "ON group_control_map.product_id = bugs.product_id " . + "AND group_control_map.group_id = bug_group_map.group_id " . + "WHERE bugs.bug_id IN (" . join(',',@bugidlist) . ") " . $dbh->sql_group_by('bugs.bug_id')); $sth->execute(); while (my ($bug_id, $min_membercontrol) = $sth->fetchrow_array()) { -- cgit v1.2.3-65-gdbad