From fb38873d8cb1fcfdd57d7dbe44fd72aa24ffa4e7 Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Tue, 28 Nov 2006 01:59:13 +0000 Subject: [PATCH] =?utf8?q?Bug=20361870:=20SQL=20query=20in=20Bugzilla::Bug?= =?utf8?q?::EmitDependList()=20too=20complicated=20-=20Patch=20by=20Fr?= =?utf8?q?=C3=83=C2=A9d=C3=83=C2=A9ric=20Buclin=20=20r?= =?utf8?q?=3Dbkor=20a=3Djustdave?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Bugzilla/Bug.pm | 15 ++++++--------- process_bug.cgi | 10 +++------- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index 5c70b8c109..73dd594914 100755 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -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; } diff --git a/process_bug.cgi b/process_bug.cgi index c10fec8a1a..2c0331494a 100755 --- a/process_bug.cgi +++ b/process_bug.cgi @@ -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); } -- 2.47.3