summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authormyk%mozilla.org <>2004-01-26 13:04:28 +0100
committermyk%mozilla.org <>2004-01-26 13:04:28 +0100
commit9e902ebec4fb35ba8cd566905914adcd189dc99a (patch)
treedf00cfcda1baf454b66c868700586a72529353b4 /Bugzilla
parent088be66b9eb596c5faf21753a0b01b89161857cb (diff)
downloadbugzilla-9e902ebec4fb35ba8cd566905914adcd189dc99a.tar.gz
bugzilla-9e902ebec4fb35ba8cd566905914adcd189dc99a.tar.xz
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
Diffstat (limited to 'Bugzilla')
-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) . ")");
}
}