]> 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:48:56 +0000 (01:48 +0000)
committerlpsolit%gmail.com <>
Tue, 28 Nov 2006 01:48:56 +0000 (01:48 +0000)
Bugzilla/Bug.pm
process_bug.cgi

index 5e8392d9fd99176213cf2944866d3275c5613a9a..f09386a0c1c006c143c7b02bf064a91936273519 100755 (executable)
@@ -1363,18 +1363,15 @@ sub editable_bug_fields {
     return sort(@fields);
 }
 
-# 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 965e75a9f1d46d493549b7c7fb5190abd37e12c5..c7ba981ff2a44fb51a39b999578e369a613ffa6f 100755 (executable)
@@ -1273,11 +1273,8 @@ sub SnapShotBug {
 
 
 sub SnapShotDeps {
-    my ($i, $target, $me) = (@_);
-    my $dbh = Bugzilla->dbh;
-    my $list = $dbh->selectcol_arrayref(qq{SELECT $target FROM dependencies
-                                        WHERE $me = ? ORDER BY $target},
-                                        undef, $i);
+    my ($bug_id, $target, $me) = (@_);
+    my $list = Bugzilla::Bug::EmitDependList($me, $target, $bug_id);
     return join(',', @$list);
 }