]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 289042: Implicit joins should be replaced by explicit joins - installment B
authormkanat%kerio.com <>
Sat, 2 Jul 2005 12:23:27 +0000 (12:23 +0000)
committermkanat%kerio.com <>
Sat, 2 Jul 2005 12:23:27 +0000 (12:23 +0000)
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit, r=joel, a=justdave

Bugzilla/Bug.pm
Bugzilla/Flag.pm
Bugzilla/FlagType.pm

index 39864d252a41fd8883a9d9c2160ebab533f4a306..675c2ec1567f2d4d913a7506d90f0f629f8dde32 100755 (executable)
@@ -163,12 +163,16 @@ sub initBug  {
       reporter_accessible, cclist_accessible,
       estimated_time, remaining_time, " .
       $dbh->sql_date_format('deadline', '%Y-%m-%d') . "
-    FROM bugs LEFT JOIN votes using(bug_id),
-      classifications, products, components
-    WHERE bugs.bug_id = ?
-      AND classifications.id = products.classification_id
-      AND products.id = bugs.product_id
-      AND components.id = bugs.component_id " .
+    FROM bugs
+       LEFT JOIN votes
+           USING (bug_id)
+      INNER JOIN components
+              ON components.id = bugs.component_id
+      INNER JOIN products
+              ON products.id = bugs.product_id
+      INNER JOIN classifications
+              ON classifications.id = products.classification_id
+      WHERE bugs.bug_id = ? " .
     $dbh->sql_group_by('bugs.bug_id', 'alias, products.classification_id,
       classifications.name, bugs.product_id, products.name, version,
       rep_platform, op_sys, bug_status, resolution, priority,
index 765ad9afad666001b9ba794f2e5df456a5cab1bb..464ddffafc2304d9d3fd25ebfb460991c52e265e 100644 (file)
@@ -112,9 +112,9 @@ my @base_columns =
 Which database(s) is the data coming from?
 
 Note: when adding tables to @base_tables, make sure to include the separator 
-(i.e. a comma or words like "LEFT OUTER JOIN") before the table name, 
-since tables take multiple separators based on the join type, and therefore 
-it is not possible to join them later using a single known separator.
+(i.e. words like "LEFT OUTER JOIN") before the table name, since tables take
+multiple separators based on the join type, and therefore it is not possible
+to join them later using a single known separator.
 B<Used by get, match, sqlify_criteria and perlify_record>
 
 =back
@@ -400,14 +400,16 @@ sub process {
     # no longer valid.
     my $flag_ids = $dbh->selectcol_arrayref(
         "SELECT flags.id 
-        FROM (flags INNER JOIN bugs ON flags.bug_id = bugs.bug_id)
-          LEFT OUTER JOIN flaginclusions i
-            ON (flags.type_id = i.type_id 
+           FROM flags
+     INNER JOIN bugs
+             ON flags.bug_id = bugs.bug_id
+      LEFT JOIN flaginclusions AS i
+             ON flags.type_id = i.type_id 
             AND (bugs.product_id = i.product_id OR i.product_id IS NULL)
-            AND (bugs.component_id = i.component_id OR i.component_id IS NULL))
-        WHERE bugs.bug_id = ?
-        AND flags.is_active = 1
-        AND i.type_id IS NULL",
+            AND (bugs.component_id = i.component_id OR i.component_id IS NULL)
+          WHERE bugs.bug_id = ?
+            AND flags.is_active = 1
+            AND i.type_id IS NULL",
         undef, $bug_id);
 
     foreach my $flag_id (@$flag_ids) { clear($flag_id) }
index fdf790e7580a24f21b4d3a732e7bfca99a5c9ea6..ceeb9a38a85e086de162d4349b57748d6ab4a63d 100644 (file)
@@ -101,9 +101,9 @@ my @base_columns =
 Which database(s) is the data coming from?
 
 Note: when adding tables to @base_tables, make sure to include the separator 
-(i.e. a comma or words like C<LEFT OUTER JOIN>) before the table name, 
-since tables take multiple separators based on the join type, and therefore 
-it is not possible to join them later using a single known separator.
+(i.e. words like "LEFT OUTER JOIN") before the table name, since tables take
+multiple separators based on the join type, and therefore it is not possible
+to join them later using a single known separator.
 B<Used by get, match, sqlify_criteria and perlify_record>
 
 =back