[Rt-devel] DBIx::SearchBuilder and RT2

Florian Weimer fw at deneb.enyo.de
Tue May 25 23:55:02 EDT 2004


Our RT2 installation runs into an endless loop in the following
DBIx::SearchBuilder code in SearchBuild/Handler/Pg.pm (version 0.97):

# this code is all hacky and evil. but people desperately want _something_ and I'm 
# super tired. refactoring gratefully appreciated.

sub _BuildJoins {
    my $self = shift;
    my $sb   = shift;
    my %seen_aliases;

    $seen_aliases{'main'} = 1;

    my $join_clause =$sb->{'table'} . " main " ;

    my @keys = ( keys %{ $sb->{'left_joins'} } );

    while ( my $join = shift @keys ) {
        if ( $seen_aliases{ $sb->{'left_joins'}{$join}{'depends_on'} } ) {
            $join_clause  = "(" . $join_clause;
            $join_clause .= $sb->{'left_joins'}{$join}{'alias_string'} . " ON (";
            $join_clause .=
              join ( ') AND( ', values %{ $sb->{'left_joins'}{$join}{'criteria'} }
              );
            $join_clause .= ")) ";

            $seen_aliases{$join} = 1;
        }
        else {
            push ( @keys, $join );
        }

    }
    return (
                    join ( ", ", ($join_clause, @{ $sb->{'aliases'} }))) ;

}

@keys has got a single element, and the else branch of the if is
taken.  Which means, of course, that the single element in @keys is
constantly removed and added again.

What is the code supposed to do?

-- 
Current mail filters: many dial-up/DSL/cable modem hosts, and the
following domains: bigpond.com, di-ve.com, hotmail.com, jumpy.it,
libero.it, netscape.net, postino.it, simplesnet.pt, spymac.com,
tatanova.com, tiscali.co.uk, tiscali.cz, tiscali.it, voila.fr, yahoo.com.


More information about the Rt-devel mailing list