taomanjay has asked for the wisdom of the Perl Monks concerning the following question:
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; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: MSSQL and Perl - heavy load
by bv (Friar) on Jan 11, 2010 at 17:37 UTC | |
|
Re: MSSQL and Perl - heavy load
by almut (Canon) on Jan 11, 2010 at 17:46 UTC | |
by taomanjay (Novice) on Jan 11, 2010 at 18:46 UTC | |
by almut (Canon) on Jan 11, 2010 at 21:47 UTC | |
by taomanjay (Novice) on Jan 11, 2010 at 22:52 UTC | |
|
Re: MSSQL and Perl - heavy load
by NiJo (Friar) on Jan 11, 2010 at 17:34 UTC | |
by taomanjay (Novice) on Jan 11, 2010 at 18:02 UTC |