Perl DBIx::SearchBuilder and pg_atoi: zero-length string?

From: Steve Wampler <swampler(at)noao(dot)edu>
To: Postgres-General <pgsql-general(at)postgresql(dot)org>
Subject: Perl DBIx::SearchBuilder and pg_atoi: zero-length string?
Date: 2004-03-24 17:05:00
Message-ID: 1080147900.2627.35.camel@weaver.tuc.noao.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)noao(dot)edu
The gods that smiled on your birth are now laughing out loud.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rich Hall 2004-03-24 17:27:43 Stored Function EXCEPTION detection by Perl using DBI
Previous Message Bill Harris 2004-03-24 16:48:30 postmaster won't start under cygwin after password change