Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
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 making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2015-07-08 03:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (94 votes), past polls