Commit 58e6f3b9 authored by lpsolit%gmail.com's avatar lpsolit%gmail.com

Bug 361870: SQL query in Bugzilla::Bug::EmitDependList() too complicated - Patch…

Bug 361870: SQL query in Bugzilla::Bug::EmitDependList() too complicated - Patch by Fré©ric Buclin <LpSolit@gmail.com> r=bkor a=justdave
parent 906283e0
...@@ -1363,18 +1363,15 @@ sub editable_bug_fields { ...@@ -1363,18 +1363,15 @@ sub editable_bug_fields {
return sort(@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 { sub EmitDependList {
my ($myfield, $targetfield, $bug_id) = (@_); my ($myfield, $targetfield, $bug_id) = (@_);
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
my $list_ref = my $list_ref = $dbh->selectcol_arrayref(
$dbh->selectcol_arrayref( "SELECT $targetfield FROM dependencies
"SELECT dependencies.$targetfield WHERE $myfield = ? ORDER BY $targetfield",
FROM dependencies, bugs undef, $bug_id);
WHERE dependencies.$myfield = ?
AND bugs.bug_id = dependencies.$targetfield
ORDER BY dependencies.$targetfield",
undef, ($bug_id));
return $list_ref; return $list_ref;
} }
......
...@@ -1273,11 +1273,8 @@ sub SnapShotBug { ...@@ -1273,11 +1273,8 @@ sub SnapShotBug {
sub SnapShotDeps { sub SnapShotDeps {
my ($i, $target, $me) = (@_); my ($bug_id, $target, $me) = (@_);
my $dbh = Bugzilla->dbh; my $list = Bugzilla::Bug::EmitDependList($me, $target, $bug_id);
my $list = $dbh->selectcol_arrayref(qq{SELECT $target FROM dependencies
WHERE $me = ? ORDER BY $target},
undef, $i);
return join(',', @$list); return join(',', @$list);
} }
......
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