freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: "Will Saxon" <WillS AT housing.ufl.edu>
- To: <freetds AT lists.ibiblio.org>
- Subject: [freetds] Odd statement execution problem
- Date: Mon, 23 Jun 2003 12:53:55 -0400
Hello,
I have a perl script that is using DBD::Sybase 1.00 and DBI 1.47. I am using
FreeTDS 0.61 on a FreeBSD 4.8-STABLE machine with Perl 5.8.0. All of the
above are compiled from ports.
This script has one section where the code is similar to this:
unless ($hash{"key"}) {
my $sql = "select value from table where field1 = '$variable' order by
field2 desc";
@array = $dbh->selectrow_array($sql);
$hash{"key"} = $array[0];
Occasionally, select statements are failing with an error like this:
Can't call method "selectrow_array" on an undefined value at ./script
line ##.
I am not sure why this is happening. I have modified my script to first
prepare the statement:
unless ($hash{"key"}) {
my $sql = "select value from table where field1 = '$variable' order by
field2 desc";
my $sth = $dbh->prepare($sql);
$sth->execute;
@array = $sth->fetchrow_array;
$hash{"key"} = $array[0];
The weird thing is, $sql is defined directly prior to the statement(s), and I
can print it without difficulty. I have tried with an undefined $hash{"key"}
and when setting $hash{"key"} to ''. I was also getting a warning when just
declaring $hash{"key"} so I stopped doing that.
It does always fail with identical input. I am just not sure what to look for.
-Will
-
[freetds] Odd statement execution problem,
Will Saxon, 06/23/2003
- Re: [freetds] Odd statement execution problem, Michael Peppler, 06/24/2003
- <Possible follow-up(s)>
- RE: [freetds] Odd statement execution problem, Lowden, James K, 06/23/2003
- RE: [freetds] Odd statement execution problem, Will Saxon, 06/23/2003
- RE: [freetds] Odd statement execution problem, Will Saxon, 06/24/2003
Archive powered by MHonArc 2.6.24.