Searches do not work as expected. If I don't enter '%' into every
field, the allegedly null fields turn into empty strings and make their
way into the search query.
Solution? Don't add param values to the search query if they're either
undefined or the empty string. (0 is okay, that's why I didn't test
against just $params{$_})
*** CDBI.orig Fri Oct 29 18:07:07 2004
--- CDBI.pm Fri Oct 29 18:07:47 2004
***************
*** 158,164 ****
my $oper = "like"; # For now
my %params = %{ $r->{params} };
my %values = map { $_ => { $oper, $params{$_} } }
! grep { defined $params{$_} and $fields{$_} } keys %params;
$r->template("list");
if ( !%values ) { return $self->list($r) }
--- 158,165 ----
my $oper = "like"; # For now
my %params = %{ $r->{params} };
my %values = map { $_ => { $oper, $params{$_} } }
! grep { defined $params{$_} && $params{$_} ne '' && $fields{$_} }
! keys %params;
$r->template("list");
if ( !%values ) { return $self->list($r) }
__END__
Cheers,
Joshua
_______________________________________________
maypole mailing list
maypole at lists.netthink.co.uk
http://lists.netthink.co.uk/listinfo/maypole
This archive was generated by hypermail 2.1.3 : Thu Feb 24 2005 - 22:25:56 GMT