fetchrow_hashref stops returning data
- From: aprilmb@xxxxxxxxx (April Blumenstiel)
- Date: Thu, 28 Apr 2005 11:52:49 -0400
Hello,
I have a program in perl running on Linux, accessing a SQL Server database
via ODBC. It runs fine. But yesterday, the process had been running for six
days when suddenly, one specific select statement/fetchrow_hashref stopped
returning any data from the database. There were other very similar lines of
code that were still returning data. Just this one particular statement was
not. A manual restart of the perl process fixed the problem. And everything
is still working fine since then.
Reliability is important here, so I need to address this, but it's tough
because I don't know how to replicate it.
Any ideas/advice?
Here is the code that was failing (throws an exception):
-------------------------------------------------------------------
# Get partner info.
my $sql = "
SELECT *
FROM Partners
WHERE PartnerCode = $partnerCode
";
my $sh = $dbh->prepare($sql) || throw util::backEndException -value => {code
=> code('DATABASE_ERROR'), message => $dbh->errstr};
$sh->execute || throw util::backEndException -value => {code =>
code('DATABASE_ERROR'), message => $sh->errstr};
my $partnerInfo = $sh->fetchrow_hashref('NAME_lc');
$sh->finish;
if (!$partnerInfo) {
throw util::backEndException -value => {code => code('DATABASE_ERROR'),
message => "Unexpected error looking up partner for $item"};
}
-------------------------------------------------------
It's the check for $partnerInfo that fails. And prior to this code,
"$partnerCode" is checked, so the SQL code should be correct.
Thank you for any ideas,
April
- Follow-Ups:
- Re: fetchrow_hashref stops returning data
- From: Christian Merz
- Re: fetchrow_hashref stops returning data
- Prev by Date: RE: Can't locate DBI.pm
- Next by Date: Re: DBD::mysql 2.9007 and DBD::mysql 2.9015_3 (beta) released
- Previous by thread: DBD::Oracle and XMLType
- Next by thread: Re: fetchrow_hashref stops returning data
- Index(es):