Perl DBIx::SearchBuilder and pg_atoi: zero-length string? - Mailing list pgsql-general

From Steve Wampler
Subject Perl DBIx::SearchBuilder and pg_atoi: zero-length string?
Date
Msg-id 1080147900.2627.35.camel@weaver.tuc.noao.edu
Whole thread Raw
List pgsql-general
Hi,

I just discovered that perl module: DBIx::SearchBuilder 0.97
has a LoadByCols() method that builds a generic SELECT
query that seems to assume '' is a valid value to test on
any field.  (The code is :
------------------------------------------------------------------
sub LoadByCols  {
    my $self = shift;
    my %hash  = (@_);
    my (@bind, @phrases);
    foreach my $key (keys %hash) {
        if (defined $hash{$key} &&  $hash{$key} ne '') {
        my $op;
        my $value;
        if (ref $hash{$key} eq 'HASH') {
            $op = $hash{$key}->{operator};
            $value = $hash{$key}->{value};
       } else {
            $op = '=';
            $value = $hash{$key};
        }

                push @phrases, "$key $op ?";
                push @bind, $value;
        }
        else {
                push @phrases, "($key IS NULL OR $key = '')";
        }
    }

    my $QueryString = "SELECT  * FROM ".$self->Table." WHERE ".
    join(' AND ', @phrases) ;
    return ($self->_LoadFromSQL($QueryString, @bind));
}
-----------------------------------------------------------
)

PG 7.3.4 generates a "pg_atoi: zero-length string" error
when '' can't be coerced to the column type.  I understand
the reason for changing this behavior from 7.2...

Can anyone point me to a version of DBIx::SearchBuilder that
works with PG 7.3.4 and above?

Thanks!
Steve
--
Steve Wampler -- swampler@noao.edu
The gods that smiled on your birth are now laughing out loud.

pgsql-general by date:

Previous
From: Bill Harris
Date:
Subject: postmaster won't start under cygwin after password change
Next
From: Rich Hall
Date:
Subject: Stored Function EXCEPTION detection by Perl using DBI