[Rt-commit] r7989 - rt/branches/3.6-RELEASE/lib/RT
ruz at bestpractical.com
ruz at bestpractical.com
Wed Jun 6 23:07:45 EDT 2007
Author: ruz
Date: Wed Jun 6 23:07:12 2007
New Revision: 7989
Modified:
rt/branches/3.6-RELEASE/lib/RT/Tickets_Overlay.pm
Log:
* revert fix for searches like 'Requestor = X AND Requestor = Y',
unless we have correct bundling of conditions searches by requestors
with OR aggregator are very slow.
Modified: rt/branches/3.6-RELEASE/lib/RT/Tickets_Overlay.pm
==============================================================================
--- rt/branches/3.6-RELEASE/lib/RT/Tickets_Overlay.pm (original)
+++ rt/branches/3.6-RELEASE/lib/RT/Tickets_Overlay.pm Wed Jun 6 23:07:12 2007
@@ -244,6 +244,7 @@
_sql_transalias
_sql_trattachalias
_sql_u_watchers_alias_for_sort
+ _sql_u_watchers_aliases
);
}
@@ -935,15 +936,24 @@
);
}
} else {
- my $group_members = $self->_GroupMembersJoin( GroupsAlias => $groups );
- my $users = $self->NewAlias('Users');
- $self->SUPER::Limit(
- LEFTJOIN => $group_members,
- ALIAS => $group_members,
- FIELD => 'MemberId',
- VALUE => "$users.id",
- QUOTEVALUE => 0,
+ my $group_members = $self->_GroupMembersJoin(
+ GroupsAlias => $groups,
+ New => 0,
);
+
+ my $users = $self->{'_sql_u_watchers_aliases'}{$group_members};
+ unless ( $users ) {
+ $users = $self->{'_sql_u_watchers_aliases'}{$group_members} =
+ $self->NewAlias('Users');
+ $self->SUPER::Limit(
+ LEFTJOIN => $group_members,
+ ALIAS => $group_members,
+ FIELD => 'MemberId',
+ VALUE => "$users.id",
+ QUOTEVALUE => 0,
+ );
+ }
+
$self->_SQLLimit(
ALIAS => $users,
FIELD => $rest{SUBKEY},
@@ -969,13 +979,13 @@
return $self->{'_sql_role_group_aliases'}{ $args{'Type'} }
if $self->{'_sql_role_group_aliases'}{ $args{'Type'} } && !$args{'New'};
+ # XXX: this has been fixed in DBIx::SB-1.48
# XXX: if we change this from Join to NewAlias+Limit
- # then Pg will complain because SB build wrong query.
+ # then Pg and mysql 5.x will complain because SB build wrong query.
# Query looks like "FROM (Tickets LEFT JOIN CGM ON(Groups.id = CGM.GroupId)), Groups"
# Pg doesn't like that fact that it doesn't know about Groups table yet when
# join CGM table into Tickets. Problem is in Join method which doesn't use
# ALIAS1 argument when build braces.
- # XXX: this should be fixed in DBIx::SB-1.46
# we always have watcher groups for ticket, so we use INNER join
my $groups = $self->Join(
More information about the Rt-commit
mailing list