aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgerv%gerv.net <>2002-08-10 16:53:29 +0000
committergerv%gerv.net <>2002-08-10 16:53:29 +0000
commita52f0b4135b629b9651145ad51bc2791b7feaeac (patch)
treeda80765868d51a7280af95db2e523ac6937b62ff /duplicates.cgi
parentFixing bustage - missing %]. (diff)
downloadbugzilla-a52f0b4135b629b9651145ad51bc2791b7feaeac.tar.gz
bugzilla-a52f0b4135b629b9651145ad51bc2791b7feaeac.tar.bz2
bugzilla-a52f0b4135b629b9651145ad51bc2791b7feaeac.zip
Bug 155584 - Opening duplicates.cgi with no frequent bugs causes SQL syntax error. Patch by gerv; r=bbaetz.
Diffstat (limited to 'duplicates.cgi')
-rwxr-xr-xduplicates.cgi80
1 files changed, 41 insertions, 39 deletions
diff --git a/duplicates.cgi b/duplicates.cgi
index 52e611cbf..3d0875313 100755
--- a/duplicates.cgi
+++ b/duplicates.cgi
@@ -135,48 +135,50 @@ if (!tie(%before, 'AnyDBM_File', "data/duplicates/dupes$whenever",
$dobefore = 1;
}
-# Don't add CLOSED, and don't add VERIFIED unless they are INVALID or
-# WONTFIX. We want to see VERIFIED INVALID and WONTFIX because common
-# "bugs" which aren't bugs end up in this state.
-my $query = "
- SELECT bugs.bug_id, component, bug_severity, op_sys, target_milestone,
- short_desc, bug_status, resolution
- FROM bugs
- WHERE (bug_status != 'CLOSED')
- AND ((bug_status = 'VERIFIED' AND resolution IN ('INVALID', 'WONTFIX'))
- OR (bug_status != 'VERIFIED'))
- AND bugs.bug_id IN (" . join(", ", keys %count) . ")";
-
-# Limit to a single product if requested
-$query .= (" AND product = " . SqlQuote($product)) if $product;
-
-SendSQL(SelectVisible($query,
- $userid,
- $usergroupset));
-
my @bugs;
my @bug_ids;
-while (MoreSQLData()) {
- # Note: maximum row count is dealt with in the template.
-
- my ($id, $component, $bug_severity, $op_sys, $target_milestone,
- $short_desc, $bug_status, $resolution) = FetchSQLData();
-
- # Limit to open bugs only if requested
- next if $openonly && ($resolution ne "");
-
- push (@bugs, { id => $id,
- count => $count{$id},
- delta => $delta{$id},
- component => $component,
- bug_severity => $bug_severity,
- op_sys => $op_sys,
- target_milestone => $target_milestone,
- short_desc => $short_desc,
- bug_status => $bug_status,
- resolution => $resolution });
- push (@bug_ids, $id);
+if (scalar(%count)) {
+ # Don't add CLOSED, and don't add VERIFIED unless they are INVALID or
+ # WONTFIX. We want to see VERIFIED INVALID and WONTFIX because common
+ # "bugs" which aren't bugs end up in this state.
+ my $query = "
+ SELECT bugs.bug_id, component, bug_severity, op_sys, target_milestone,
+ short_desc, bug_status, resolution
+ FROM bugs
+ WHERE (bug_status != 'CLOSED')
+ AND ((bug_status = 'VERIFIED' AND resolution IN ('INVALID', 'WONTFIX'))
+ OR (bug_status != 'VERIFIED'))
+ AND bugs.bug_id IN (" . join(", ", keys %count) . ")";
+
+ # Limit to a single product if requested
+ $query .= (" AND product = " . SqlQuote($product)) if $product;
+
+ SendSQL(SelectVisible($query,
+ $userid,
+ $usergroupset));
+
+ while (MoreSQLData()) {
+ # Note: maximum row count is dealt with in the template.
+
+ my ($id, $component, $bug_severity, $op_sys, $target_milestone,
+ $short_desc, $bug_status, $resolution) = FetchSQLData();
+
+ # Limit to open bugs only if requested
+ next if $openonly && ($resolution ne "");
+
+ push (@bugs, { id => $id,
+ count => $count{$id},
+ delta => $delta{$id},
+ component => $component,
+ bug_severity => $bug_severity,
+ op_sys => $op_sys,
+ target_milestone => $target_milestone,
+ short_desc => $short_desc,
+ bug_status => $bug_status,
+ resolution => $resolution });
+ push (@bug_ids, $id);
+ }
}
$vars->{'bugs'} = \@bugs;