summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2007-09-23 04:09:33 +0200
committerlpsolit%gmail.com <>2007-09-23 04:09:33 +0200
commit3dd93a04e5eb64e5a3ae2e23ed76c191dd55bc2c (patch)
tree276b1408da5eae798c7fc539bae1b79184e83f1d /Bugzilla
parent6059e78c80326d2880f272e6b2faa03e7ef0f6a6 (diff)
downloadbugzilla-3dd93a04e5eb64e5a3ae2e23ed76c191dd55bc2c.tar.gz
bugzilla-3dd93a04e5eb64e5a3ae2e23ed76c191dd55bc2c.tar.xz
Bug 319466: commenter "contains" and "was me" fails with: Not unique table/alias: 'longdescs_0' - Patch by GavinS <bugzilla@chimpychompy.org> r=joel a=LpSolit
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/Search.pm49
1 files changed, 24 insertions, 25 deletions
diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm
index 9b31f8b54..33ccc9d9e 100644
--- a/Bugzilla/Search.pm
+++ b/Bugzilla/Search.pm
@@ -166,7 +166,7 @@ sub init {
}
if (grep($_ =~/AS (actual_time|percentage_complete)$/, @$fieldsref)) {
- push(@supptables, "INNER JOIN longdescs AS ldtime " .
+ push(@supptables, "LEFT JOIN longdescs AS ldtime " .
"ON ldtime.bug_id = bugs.bug_id");
}
@@ -534,20 +534,20 @@ sub init {
"^long_?desc,changedby" => sub {
my $table = "longdescs_$chartid";
- push(@supptables, "INNER JOIN longdescs AS $table " .
+ push(@supptables, "LEFT JOIN longdescs AS $table " .
"ON $table.bug_id = bugs.bug_id");
my $id = login_to_id($v, THROW_ERROR);
$term = "$table.who = $id";
},
"^long_?desc,changedbefore" => sub {
my $table = "longdescs_$chartid";
- push(@supptables, "INNER JOIN longdescs AS $table " .
+ push(@supptables, "LEFT JOIN longdescs AS $table " .
"ON $table.bug_id = bugs.bug_id");
$term = "$table.bug_when < " . $dbh->quote(SqlifyDate($v));
},
"^long_?desc,changedafter" => sub {
my $table = "longdescs_$chartid";
- push(@supptables, "INNER JOIN longdescs AS $table " .
+ push(@supptables, "LEFT JOIN longdescs AS $table " .
"ON $table.bug_id = bugs.bug_id");
$term = "$table.bug_when > " . $dbh->quote(SqlifyDate($v));
},
@@ -567,7 +567,7 @@ sub init {
{
$extra = "AND $table.isprivate < 1";
}
- push(@supptables, "INNER JOIN longdescs AS $table " .
+ push(@supptables, "LEFT JOIN longdescs AS $table " .
"ON bugs.bug_id = $table.bug_id $extra");
# Create search terms to add to the SELECT and WHERE clauses.
@@ -666,7 +666,7 @@ sub init {
{
$extra = "AND $table.isprivate < 1";
}
- push(@supptables, "INNER JOIN longdescs AS $table " .
+ push(@supptables, "LEFT JOIN longdescs AS $table " .
"ON $table.bug_id = bugs.bug_id $extra");
$f = "$table.thetext";
},
@@ -678,13 +678,13 @@ sub init {
{
$extra = "AND $table.isprivate < 1";
}
- push(@supptables, "INNER JOIN longdescs AS $table " .
+ push(@supptables, "LEFT JOIN longdescs AS $table " .
"ON $table.bug_id = bugs.bug_id $extra");
$f = "$table.isprivate";
},
"^work_time,changedby" => sub {
my $table = "longdescs_$chartid";
- push(@supptables, "INNER JOIN longdescs AS $table " .
+ push(@supptables, "LEFT JOIN longdescs AS $table " .
"ON $table.bug_id = bugs.bug_id");
my $id = login_to_id($v, THROW_ERROR);
$term = "(($table.who = $id";
@@ -692,21 +692,21 @@ sub init {
},
"^work_time,changedbefore" => sub {
my $table = "longdescs_$chartid";
- push(@supptables, "INNER JOIN longdescs AS $table " .
+ push(@supptables, "LEFT JOIN longdescs AS $table " .
"ON $table.bug_id = bugs.bug_id");
$term = "(($table.bug_when < " . $dbh->quote(SqlifyDate($v));
$term .= ") AND ($table.work_time <> 0))";
},
"^work_time,changedafter" => sub {
my $table = "longdescs_$chartid";
- push(@supptables, "INNER JOIN longdescs AS $table " .
+ push(@supptables, "LEFT JOIN longdescs AS $table " .
"ON $table.bug_id = bugs.bug_id");
$term = "(($table.bug_when > " . $dbh->quote(SqlifyDate($v));
$term .= ") AND ($table.work_time <> 0))";
},
"^work_time," => sub {
my $table = "longdescs_$chartid";
- push(@supptables, "INNER JOIN longdescs AS $table " .
+ push(@supptables, "LEFT JOIN longdescs AS $table " .
"ON $table.bug_id = bugs.bug_id");
$f = "$table.work_time";
},
@@ -738,7 +738,7 @@ sub init {
if(lsearch(\@fields, "bugs.remaining_time") == -1) {
push(@fields, "bugs.remaining_time");
}
- push(@supptables, "INNER JOIN longdescs AS $table " .
+ push(@supptables, "LEFT JOIN longdescs AS $table " .
"ON $table.bug_id = bugs.bug_id");
my $expression = "(100 * ((SUM($table.work_time) *
COUNT(DISTINCT $table.bug_when) /
@@ -1389,21 +1389,20 @@ sub init {
my $suppstring = "bugs";
my @supplist = (" ");
foreach my $str (@supptables) {
- if (!$suppseen{$str}) {
- if ($str =~ /^(LEFT|INNER|RIGHT)\s+JOIN/i) {
- $str =~ /^(.*?)\s+ON\s+(.*)$/i;
- my ($leftside, $rightside) = ($1, $2);
- if ($suppseen{$leftside}) {
- $supplist[$suppseen{$leftside}] .= " AND ($rightside)";
- } else {
- $suppseen{$leftside} = scalar @supplist;
- push @supplist, " $leftside ON ($rightside)";
- }
+
+ if ($str =~ /^(LEFT|INNER|RIGHT)\s+JOIN/i) {
+ $str =~ /^(.*?)\s+ON\s+(.*)$/i;
+ my ($leftside, $rightside) = ($1, $2);
+ if (defined $suppseen{$leftside}) {
+ $supplist[$suppseen{$leftside}] .= " AND ($rightside)";
} else {
- # Do not accept implicit joins using comma operator
- # as they are not DB agnostic
- ThrowCodeError("comma_operator_deprecated");
+ $suppseen{$leftside} = scalar @supplist;
+ push @supplist, " $leftside ON ($rightside)";
}
+ } else {
+ # Do not accept implicit joins using comma operator
+ # as they are not DB agnostic
+ ThrowCodeError("comma_operator_deprecated");
}
}
$suppstring .= join('', @supplist);