From 4320afa0dcc396429b27bfb29dee9fc7c239765f Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" Date: Mon, 27 Nov 2006 17:48:56 +0000 Subject: [PATCH] =?UTF-8?q?Bug=20361870:=20SQL=20query=20in=20Bugzilla::Bu?= =?UTF-8?q?g::EmitDependList()=20too=20complicated=20-=20Patch=20by=20Fr?= =?UTF-8?q?=C3=83=C2=A9d=C3=83=C2=A9ric=20Buclin=20=20r?= =?UTF-8?q?=3Dbkor=20a=3Djustdave?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn://10.0.0.236/trunk@215869 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/webtools/bugzilla/Bugzilla/Bug.pm | 15 ++++++--------- mozilla/webtools/bugzilla/process_bug.cgi | 7 ++----- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/mozilla/webtools/bugzilla/Bugzilla/Bug.pm b/mozilla/webtools/bugzilla/Bugzilla/Bug.pm index 5e8392d9fd9..f09386a0c1c 100644 --- a/mozilla/webtools/bugzilla/Bugzilla/Bug.pm +++ b/mozilla/webtools/bugzilla/Bugzilla/Bug.pm @@ -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; } diff --git a/mozilla/webtools/bugzilla/process_bug.cgi b/mozilla/webtools/bugzilla/process_bug.cgi index 965e75a9f1d..c7ba981ff2a 100755 --- a/mozilla/webtools/bugzilla/process_bug.cgi +++ b/mozilla/webtools/bugzilla/process_bug.cgi @@ -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); }