Commit 09035a15 authored by terry%mozilla.org's avatar terry%mozilla.org

Worked around bug in older versions of MySQL that caused a report of

one bug matching a keyword when there really are zero.
parent e7209209
...@@ -41,14 +41,19 @@ print qq{ ...@@ -41,14 +41,19 @@ print qq{
}; };
SendSQL("SELECT keyworddefs.name, keyworddefs.description, SendSQL("SELECT keyworddefs.name, keyworddefs.description,
COUNT(keywords.bug_id) COUNT(keywords.bug_id), keywords.bug_id
FROM keyworddefs LEFT JOIN keywords ON keyworddefs.id=keywords.keywordid FROM keyworddefs LEFT JOIN keywords ON keyworddefs.id=keywords.keywordid
GROUP BY keyworddefs.id GROUP BY keyworddefs.id
ORDER BY keyworddefs.name"); ORDER BY keyworddefs.name");
while (MoreSQLData()) { while (MoreSQLData()) {
my ($name, $description, $bugs) = FetchSQLData(); my ($name, $description, $bugs, $onebug) = FetchSQLData();
if ($bugs) { if ($bugs && $onebug) {
# This 'onebug' stuff is silly hackery for old versions of
# MySQL that seem to return a count() of 1 even if there are
# no matching. So, we ask for an actual bug number. If it
# can't find any bugs that match the keyword, then we set the
# count to be zero, ignoring what it had responded.
my $q = url_quote($name); my $q = url_quote($name);
$bugs = qq{<A HREF="buglist.cgi?keywords=$q">$bugs</A>}; $bugs = qq{<A HREF="buglist.cgi?keywords=$q">$bugs</A>};
} else { } else {
......
...@@ -135,14 +135,22 @@ if ($action eq "") { ...@@ -135,14 +135,22 @@ if ($action eq "") {
</TR> </TR>
}; };
SendSQL("SELECT keyworddefs.id, keyworddefs.name, keyworddefs.description, SendSQL("SELECT keyworddefs.id, keyworddefs.name, keyworddefs.description,
COUNT(keywords.bug_id) COUNT(keywords.bug_id), keywords.bug_id
FROM keyworddefs LEFT JOIN keywords ON keyworddefs.id = keywords.keywordid FROM keyworddefs LEFT JOIN keywords ON keyworddefs.id = keywords.keywordid
GROUP BY keyworddefs.id GROUP BY keyworddefs.id
ORDER BY keyworddefs.name"); ORDER BY keyworddefs.name");
while (MoreSQLData()) { while (MoreSQLData()) {
my ($id, $name, $description, $bugs) = FetchSQLData(); my ($id, $name, $description, $bugs, $onebug) = FetchSQLData();
$description ||= "<FONT COLOR=\"red\">missing</FONT>"; $description ||= "<FONT COLOR=\"red\">missing</FONT>";
$bugs ||= 'none'; $bugs ||= 'none';
if (!$onebug) {
# This is silly hackery for old versions of MySQL that seem to
# return a count() of 1 even if there are no matching. So, we
# ask for an actual bug number. If it can't find any bugs that
# match the keyword, then we set the count to be zero, ignoring
# what it had responded.
$bugs = 'none';
}
print qq{ print qq{
<TR> <TR>
<TH VALIGN="top"><A HREF="editkeywords.cgi?action=edit&id=$id">$name</TH> <TH VALIGN="top"><A HREF="editkeywords.cgi?action=edit&id=$id">$name</TH>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment