]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Worked around bug in older versions of MySQL that caused a report of
authorterry%mozilla.org <>
Tue, 11 Jan 2000 08:26:21 +0000 (08:26 +0000)
committerterry%mozilla.org <>
Tue, 11 Jan 2000 08:26:21 +0000 (08:26 +0000)
one bug matching a keyword when there really are zero.

describekeywords.cgi
editkeywords.cgi

index 4da535c7c1b6b9c4465d92d2b3fe9896e6c7bfe4..bddf3b4234c51e17250b32b6b5c9f65ac682c1fa 100755 (executable)
@@ -41,14 +41,19 @@ print qq{
 };
 
 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
          GROUP BY keyworddefs.id
          ORDER BY keyworddefs.name");
 
 while (MoreSQLData()) {
-    my ($name, $description, $bugs) = FetchSQLData();
-    if ($bugs) {
+    my ($name, $description, $bugs, $onebug) = FetchSQLData();
+    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);
         $bugs = qq{<A HREF="buglist.cgi?keywords=$q">$bugs</A>};
     } else {
index 03525f7252aceac0a41857d732da73bef0170339..dcb72ae2e300eabb74ed31fe50379bb57cab52d2 100755 (executable)
@@ -135,14 +135,22 @@ if ($action eq "") {
 </TR>
 };
     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
              GROUP BY keyworddefs.id
              ORDER BY keyworddefs.name");
     while (MoreSQLData()) {
-        my ($id, $name, $description, $bugs) = FetchSQLData();
+        my ($id, $name, $description, $bugs, $onebug) = FetchSQLData();
         $description ||= "<FONT COLOR=\"red\">missing</FONT>";
         $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{
 <TR>
 <TH VALIGN="top"><A HREF="editkeywords.cgi?action=edit&id=$id">$name</TH>