The output while the server is down looks like:my ($user, $password, $dsn); ### Set these to run code my $sql = "select * from tablename where id=?"; use strict; use warnings; use DBI; my $dbh = DBI->connect($dsn, $user, $password, {RaiseError => 1}); my $sth = $dbh->prepare($sql); my $result; for(1..1000) { eval { $result = &simple_query; }; if ($@) { print "Found error [$@]\n"; } else { use Data::Dumper; warn Dumper($result); } sleep 1; } sub simple_query { $sth->execute(int(rand(7000))); my $ref = $sth->fetchrow_hashref or return; return $ref; }
DBD::mysql::st fetchrow_hashref failed: fetch() without execute() at ./db_connect line 31. Found error DBD::mysql::st fetchrow_hashref failed: fetch() without execute() at ./db_connect line 31.The output when it comes back up looks like normal Data::Dumper results from a hash.
In reply to DBI connection springs back to life - how? by mp
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |