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);
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 = ();
$connector = 'WHERE';
} else {
$query = qq{SELECT DISTINCT $fieldList
- FROM groups, user_group_map AS ugm
+ FROM groups
+ LEFT JOIN user_group_map AS ugm
+ ON groups.id = ugm.group_id
LEFT JOIN group_group_map AS ggm
ON ggm.member_id = ugm.group_id
AND ggm.grant_type = ?
WHERE user_id = ?
- AND ((id = group_id AND isbless = 1) OR
- (id = grantor_id))
+ AND (ugm.isbless = 1 OR groups.id = ggm.grantor_id)
};
@bindValues = (GROUP_BLESS, $userid);
$connector = 'AND';
my $mpart = $dotargetmilestone ? ", milestoneurl" : "";
- SendSQL("select name, description from classifications ORDER BY name");
+ SendSQL("SELECT name, description FROM classifications ORDER BY name");
while (@line = FetchSQLData()) {
my ($n, $d) = (@line);
$::classdesc{$n} = $d;
}
- SendSQL("select name, description, votesperuser, disallownew$mpart from products ORDER BY name");
+ SendSQL("SELECT name, description, votesperuser, disallownew$mpart " .
+ "FROM products ORDER BY name");
while (@line = FetchSQLData()) {
my ($p, $d, $votesperuser, $dis, $u) = (@line);
$::proddesc{$p} = $d;
}
if (!defined $::cachedNameArray{$id}) {
PushGlobalSQLState();
- SendSQL("select login_name from profiles where userid = $id");
+ SendSQL("SELECT login_name FROM profiles WHERE userid = $id");
my $r = FetchOneColumn();
PopGlobalSQLState();
if (!defined $r || $r eq "") {
my @stack = @{$deps{$target}};
while (@stack) {
my $i = shift @stack;
- SendSQL("select $target from dependencies where $me = " .
+ SendSQL("SELECT $target FROM dependencies WHERE $me = " .
SqlQuote($i));
while (MoreSQLData()) {
my $t = FetchOneColumn();
}
SendSQL("INSERT INTO longdescs (bug_id, who, bug_when, thetext, isprivate)
- VALUES ($id, " . SqlQuote($user->id) . ", $sql_timestamp, " .\r
+ VALUES ($id, " . SqlQuote($user->id) . ", $sql_timestamp, " .
SqlQuote($comment) . ", $privacy)");
# Insert the cclist into the database