Closed
Bug 279740
Opened 20 years ago
Closed 20 years ago
Move CountOpenDependencies out of globals.pl
Categories
(Bugzilla :: Creating/Changing Bugs, enhancement)
Tracking
()
RESOLVED
FIXED
Bugzilla 2.20
People
(Reporter: mkanat, Assigned: mkanat)
References
Details
Attachments
(1 file)
3.52 KB,
patch
|
Wurblzap
:
review+
|
Details | Diff | Splinter Review |
This function is only used in process_bug.cgi, that I can see. It should also be renamed, probably OpenDependencyList or get_open_deps.
Assignee | ||
Updated•20 years ago
|
Severity: normal → enhancement
Status: NEW → ASSIGNED
Assignee | ||
Comment 1•20 years ago
|
||
Just a simple move, and I changed the SendSQL calls to DBI calls. It's only used in process_bug, so it was easy to test the change.
Attachment #172342 -
Flags: review?
Comment 2•20 years ago
|
||
Comment on attachment 172342 [details] [diff] [review] Move it and make it use DBI Tested; works. I can't think of a way to make that IN part use bound parameters, so let's keep it the way it is. It's a pity we can't get rid of &::OpenStates in favour of Bugzilla::Util::OpenStates yet :) >+ my $sth = $dbh->prepare( >+ "SELECT blocked, count(bug_status) " . >+ "FROM bugs, dependencies " . >+ "WHERE blocked IN (" . (join "," , @bug_list) . ") " . >+ "AND bug_id = dependson " . >+ "AND bug_status IN ('" . (join "','", &::OpenStates()) . "') " . >+ "GROUP BY blocked "); >+ $sth->execute(); >+ >+ while (my ($bug_id, $dependencies) = $sth->fetchrow_array()) { >+ push(@dependencies, { bug_id => $bug_id, >+ dependencies => $dependencies }); >+ } >+ >+ return @dependencies; Nit: how about >+ return @{$dbh->selectall_arrayref('SELECT blocked AS bug_id ...', >+ {'Slice' => {}})}; for readability and efficience?
Attachment #172342 -
Flags: review? → review+
Assignee | ||
Comment 3•20 years ago
|
||
Yeah, I looked at the DBI docs, and they practically say outright that you can't use placeholders with an IN clause. I prefer the way that the code is written now, instead of the modified return statement, overall. I agree that the Slice thing might be better, but I don't really want to re-work the patch to use it. Anyhow, I think that this ends up being clearer, overall, for those who aren't as familiar with DBI.
Flags: approval?
Updated•20 years ago
|
Flags: approval? → approval+
Target Milestone: --- → Bugzilla 2.20
Comment 4•20 years ago
|
||
Checking in globals.pl; /cvsroot/mozilla/webtools/bugzilla/globals.pl,v <-- globals.pl new revision: 1.294; previous revision: 1.293 done Checking in process_bug.cgi; /cvsroot/mozilla/webtools/bugzilla/process_bug.cgi,v <-- process_bug.cgi new revision: 1.231; previous revision: 1.230 done Checking in Bugzilla/Bug.pm; /cvsroot/mozilla/webtools/bugzilla/Bugzilla/Bug.pm,v <-- Bug.pm new revision: 1.51; previous revision: 1.50 done
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•