Perl DBIx::SearchBuilder and pg_atoi: zero-length string?
От | Steve Wampler |
---|---|
Тема | Perl DBIx::SearchBuilder and pg_atoi: zero-length string? |
Дата | |
Msg-id | 1080147900.2627.35.camel@weaver.tuc.noao.edu обсуждение исходный текст |
Список | 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 по дате отправления: