From 9d202f2d562c0cb8299c832158811f2131c73e27 Mon Sep 17 00:00:00 2001 From: "mkanat%kerio.com" <> Date: Tue, 3 May 2005 01:52:02 +0000 Subject: Bug 289043: Implicit joins should be replaced by explicit joins - installment C Patch By Tomas Kopal r=joel, a=justdave --- editproducts.cgi | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'editproducts.cgi') diff --git a/editproducts.cgi b/editproducts.cgi index ac54ab517..be0842912 100755 --- a/editproducts.cgi +++ b/editproducts.cgi @@ -336,14 +336,14 @@ if (!$action && !$product) { FROM products"; if (Param('useclassification')) { - $query .= ", classifications"; + $query .= " INNER JOIN classifications " . + "ON classifications.id = products.classification_id"; } $query .= " LEFT JOIN bugs ON products.id = bugs.product_id"; if (Param('useclassification')) { - $query .= " WHERE classifications.name = ? " . - " AND classifications.id = products.classification_id"; + $query .= " WHERE classifications.name = ? "; # trick_taint is OK because we use this in a placeholder in a SELECT trick_taint($classification); @@ -1038,14 +1038,15 @@ if ($action eq 'updategroupcontrols') { my @mandatory_groups = (); if (@now_mandatory) { SendSQL("SELECT groups.name, COUNT(bugs.bug_id) - FROM bugs, groups - LEFT JOIN bug_group_map - ON bug_group_map.group_id = groups.id - AND bug_group_map.bug_id = bugs.bug_id - WHERE groups.id IN(" . join(', ', @now_mandatory) . ") - AND bugs.product_id = $product_id - AND bug_group_map.bug_id IS NULL " . - $dbh->sql_group_by('groups.name')); + FROM bugs + LEFT JOIN bug_group_map + ON bug_group_map.bug_id = bugs.bug_id + INNER JOIN groups + ON bug_group_map.group_id = groups.id + WHERE groups.id IN(" . join(', ', @now_mandatory) . ") + AND bugs.product_id = $product_id + AND bug_group_map.bug_id IS NULL " . + $dbh->sql_group_by('groups.name')); while (MoreSQLData()) { my ($groupname, $bugcount) = FetchSQLData(); my %g = (); -- cgit v1.2.3-24-g4f1b