[freetds] Odd statement execution problem

Michael Peppler mpeppler at bluewin.ch
Tue Jun 24 10:35:34 EDT 2003


On Mon, 2003-06-23 at 18:53, Will Saxon wrote:
> 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 ##.

This means that $dbh isn't defined - i.e. you don't actually have an
open connection at this point.

BTW - don't change "my $sql = ..." to "local $sql = ..." - I very much
doubt that you need the "local" semantics here.

Michael





More information about the FreeTDS mailing list