aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormyk%mozilla.org <>2004-01-26 12:04:28 +0000
committermyk%mozilla.org <>2004-01-26 12:04:28 +0000
commit9e902ebec4fb35ba8cd566905914adcd189dc99a (patch)
treedf00cfcda1baf454b66c868700586a72529353b4
parent088be66b9eb596c5faf21753a0b01b89161857cb (diff)
downloadbugs-9e902ebec4fb35ba8cd566905914adcd189dc99a.tar
bugs-9e902ebec4fb35ba8cd566905914adcd189dc99a.tar.gz
bugs-9e902ebec4fb35ba8cd566905914adcd189dc99a.tar.bz2
bugs-9e902ebec4fb35ba8cd566905914adcd189dc99a.tar.xz
bugs-9e902ebec4fb35ba8cd566905914adcd189dc99a.zip
Fix for bug 232150: Corrects "field changed" queries including [Bug creation] as one of the fields so that they actually work instead of taking forever. The query was structured as "[Bug creation] clause OR (bugs_activity JOIN clause OR (other field clauses))" when it should have been "bugs_activity JOIN CLAUSE AND ([Bug creation] clause OR other field clauses)"
r=bbaetz a=myk
-rw-r--r--Bugzilla/Search.pm29
1 files changed, 19 insertions, 10 deletions
diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm
index cf42e073f..75cb65af6 100644
--- a/Bugzilla/Search.pm
+++ b/Bugzilla/Search.pm
@@ -255,35 +255,44 @@ sub init {
push(@wherepart, "bugs.delta_ts >= $sql_chfrom") if ($sql_chfrom);
push(@wherepart, "bugs.delta_ts <= $sql_chto") if ($sql_chto);
} else {
- my $sql_bugschanged = '';
+ my $bug_creation_clause;
my @list;
foreach my $f (@chfield) {
if ($f eq "[Bug creation]") {
+ # Treat [Bug creation] differently because we need to look
+ # at bugs.creation_ts rather than the bugs_activity table.
my @l;
push(@l, "creation_ts >= $sql_chfrom") if($sql_chfrom);
push(@l, "creation_ts <= $sql_chto") if($sql_chto);
- $sql_bugschanged = "(" . join(' AND ', @l) . ")";
+ $bug_creation_clause = "(" . join(' AND ', @l) . ")";
} else {
push(@list, "\nactcheck.fieldid = " . &::GetFieldID($f));
}
}
+
+ # @list won't have any elements if the only field being searched
+ # is [Bug creation] (in which case we don't need bugs_activity).
if(@list) {
push(@supptables, "bugs_activity actcheck");
- $sql_bugschanged .= ' OR ' if($sql_bugschanged ne '');
- $sql_bugschanged .= "(actcheck.bug_id = bugs.bug_id AND " .
- "(" . join(' OR ', @list) . ")";
+ push(@wherepart, "actcheck.bug_id = bugs.bug_id");
if($sql_chfrom) {
- $sql_bugschanged .= " AND actcheck.bug_when >= $sql_chfrom";
+ push(@wherepart, "actcheck.bug_when >= $sql_chfrom");
}
if($sql_chto) {
- $sql_bugschanged .= " AND actcheck.bug_when <= $sql_chto";
+ push(@wherepart, "actcheck.bug_when <= $sql_chto");
}
if($sql_chvalue) {
- $sql_bugschanged .= " AND actcheck.added = $sql_chvalue";
+ push(@wherepart, "actcheck.added = $sql_chvalue");
}
- $sql_bugschanged .= ')';
}
- push(@wherepart, "($sql_bugschanged)");
+
+ # Now that we're done using @list to determine if there are any
+ # regular fields to search (and thus we need bugs_activity),
+ # add the [Bug creation] criterion to the list so we can OR it
+ # together with the others.
+ push(@list, $bug_creation_clause) if $bug_creation_clause;
+
+ push(@wherepart, "(" . join(" OR ", @list) . ")");
}
}