]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 361870: SQL query in Bugzilla::Bug::EmitDependList() too complicated - Patch...
authorlpsolit%gmail.com <>
Tue, 28 Nov 2006 01:59:13 +0000 (01:59 +0000)
committerlpsolit%gmail.com <>
Tue, 28 Nov 2006 01:59:13 +0000 (01:59 +0000)
Bugzilla/Bug.pm
process_bug.cgi

index 5c70b8c10963694901f4c41fce322f4793380b29..73dd5949143adfb762c2610acb65a2a16c35a78f 100755 (executable)
@@ -751,18 +751,15 @@ sub AppendComment {
              undef, $timestamp, $bugid);
 }
 
-# This method is private and is not to be used outside of the Bug class.
+# XXX - When Bug::update() will be implemented, we should make this routine
+#       a private method.
 sub EmitDependList {
     my ($myfield, $targetfield, $bug_id) = (@_);
     my $dbh = Bugzilla->dbh;
-    my $list_ref =
-        $dbh->selectcol_arrayref(
-          "SELECT dependencies.$targetfield
-             FROM dependencies, bugs
-            WHERE dependencies.$myfield = ?
-              AND bugs.bug_id = dependencies.$targetfield
-         ORDER BY dependencies.$targetfield",
-         undef, ($bug_id));
+    my $list_ref = $dbh->selectcol_arrayref(
+          "SELECT $targetfield FROM dependencies
+            WHERE $myfield = ? ORDER BY $targetfield",
+            undef, $bug_id);
     return $list_ref;
 }
 
index c10fec8a1a2f5596edc61d791627d1781d1bddbb..2c0331494ac18fe9e95ae26cfba8f97649a3997a 100755 (executable)
@@ -1310,13 +1310,9 @@ sub SnapShotBug {
 
 
 sub SnapShotDeps {
-    my ($i, $target, $me) = (@_);
-    SendSQL("SELECT $target FROM dependencies WHERE $me = $i ORDER BY $target");
-    my @list;
-    while (MoreSQLData()) {
-        push(@list, FetchOneColumn());
-    }
-    return join(',', @list);
+    my ($bug_id, $target, $me) = (@_);
+    my $list = Bugzilla::Bug::EmitDependList($me, $target, $bug_id);
+    return join(',', @$list);
 }