[freetds] Odd statement execution problem

Lowden, James K LowdenJK at bernstein.com
Mon Jun 23 15:20:30 EDT 2003


> From: Will Saxon [mailto:WillS at housing.ufl.edu]
> Sent: June 23, 2003 12:54 PM
> 
> 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 ##.

Will, 

DBI includes a trace mechanism.  Between that and the TDSDUMP log, perhaps
you'll be able to tell what's wrong.  To me, it looks like $dbh is being
closed on you; $sql is probably fine.  You can generate that same message
this way:

$ perl -e'print $s->state'
Can't call method "state" on an undefined value at -e line 1.

Have you installed an error handler (syb_err_handler)?  If not, you might be
missing a runtime  error.  

HTH.  

--jkl

-----------------------------------------
The information contained in this transmission may contain privileged and confidential information and is intended only for the use of the person(s) named above. If you are not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, any review, dissemination, distribution or duplication of this communication is strictly prohibited. If you are not the intended recipient, please contact the sender immediately by reply e-mail and destroy all copies of the original message. Please note that we do not accept account orders and/or instructions by e-mail, and therefore will not be responsible for carrying out such orders and/or instructions.





More information about the FreeTDS mailing list