Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Persistent Fault Tolerant SQL (MySQL + DBI) connections!

by expresspotato (Beadle)
on Dec 23, 2009 at 10:57 UTC ( #814072=perlmeditation: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my @results = &row_sql(qq~ select * from table where ...; ~);
    
    ...
    foreach my $row (@$rows){
      print "$row->{id}, $row->{somecolumn}\n";
    }
    
  2. or download this
        until (
        $dbh=DBI->connect_cached($connectionInfo,$user,$passwd, {PrintErro
    +r=>0} )
    ...
            }
        }
        ) { if ($sqlw){print "Retrying SQL Insert ($DBI::errstr)...";} sle
    +ep (1); $retry_count++;}
    
  3. or download this
    
    use DBI;
    ...
        
        return 1;
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://814072]
Front-paged by Arunbear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2014-08-30 11:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (293 votes), past polls