[SearchBuilder-devel] PostgreSQL incompatibility in DBIx::SearchBuilder::Record

Ruslan U. Zakirov Ruslan.Zakirov at miet.ru
Thu Jul 7 11:47:00 EDT 2005


This is fixed in HEAD and may be fix is in latest development snapshot
on the CPAN.

Florian Weimer wrote:
> Here's the relevant excerpt:
> 
>     sub LoadByCols  {
>         my $self = shift;
>         my %hash  = (@_);
>         my (@bind, @phrases);
>         foreach my $key (keys %hash) {  
>             if (defined $hash{$key} &&  $hash{$key} ne '') {
> 
>             ...
> 
>             else {
>                     push @phrases, "($key IS NULL OR $key = '')";
>             }
>         }
>         
>         my $QueryString = "SELECT  * FROM ".$self->Table." WHERE ". 
>         join(' AND ', @phrases) ;
>         return ($self->_LoadFromSQL($QueryString, @bind));
>     }
> 
> This means that when an undefined value is passed for a numeric
> column, a comparison against '' is inserted into the query, and
> PostgreSQL will croak.
> 
> Perhaps this piece of code should handle the undefined, empty and
> regular case separately.
> _______________________________________________
> SearchBuilder-devel mailing list
> SearchBuilder-devel at bestpractical.com
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/searchbuilder-devel
> 



More information about the SearchBuilder-devel mailing list