Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re: MSSQL and Perl - heavy load

by bv (Friar)
on Jan 11, 2010 at 17:37 UTC ( #816767=note: print w/replies, xml ) Need Help??

in reply to MSSQL and Perl - heavy load

If the connection is refused, then the prepare should cause an error that exits the script (right?).

Only if you told it to! There are 2.5 ways of doing this. First way (least pretty):

$sth = $dbh->prepare( "select blah from table" ) or die "Prepare failed: ", $dbh->errstr;

Second way:

$dbh->{RaiseError} = 1; $sth = $dbh->prepare( "select blah from table" )

Both previous ways work, but kill your script and don't offer a clean way to close the transaction (if you are using transactions). Try this, way 2.5:

$dbh->{RaiseError} = 1; eval { my $sth = $dbh->prepare("select blah from table"); $sth->execute(); }; if ($@) { warn "Transaction aborted: $@"; eval { $dbh->rollback }; die "Unable to rollback: $@" if $@; }

print map{substr'hark, suPerJacent other l',$_,1}(11,7,6,16,5,1,15,18..23,8..10,24,17,0,12,13,3,14,2,4);

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://816767]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2019-12-05 21:47 GMT
Find Nodes?
    Voting Booth?
    Strict and warnings: which comes first?

    Results (151 votes). Check out past polls.