This code generally works perfectly for my purposes. But, when the MSSQL server is under heavy load it seems to be incorrectly returning nothing for both elements in the lastsale array in some random instances. At first, I thought perhaps the server was refusing the connection (due to too many), but I don't believe this to be the case. If the connection is refused, then the prepare should cause an error that exits the script (right?). There are some instances that there will legitimately be nothing returned, and I need these. If anyone has a similar experience, or any ideas to help me troubleshoot this I would greatly appreciate it!sub getlast{ my $panel = shift; my @lastsale; my $dbh; my $sth; $dbh = DBI->connect( "dbi:Sybase:server=$ini{SQL01DB}{server}; database=$ini{SQL01DB}{database}", $ini{SQL01DB}{usern +ame}, $ini{SQL01DB}{password} ); $sth = $dbh->prepare( "select convert(varchar,max(dtmTimeEnter +),120), convert(varchar,max(dtmDateTime),120) from $table where intSiteID=$site and intPanelID=$panel and intAdditiveCode>0" ); $sth->execute(); @lastsale = $sth->fetchrow; $sth->finish; $dbh->disconnect; if ( $lastsale[0] || $lastsale[1] ){ return ( @lastsale ); } else{ return; } }
In reply to MSSQL and Perl - heavy load by taomanjay
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |