Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Answer: How do I lock tables using DBI and mySQL?

( #111670=categorized answer: print w/ replies, xml ) Need Help??

Q&A > database programming > How do I lock tables using DBI and mySQL? contributed by filmo

Follow up question: Does the lock cover multiple statement handles? i.e.
$dbh->do("LOCK TABLES foo WRITE, bar READ"); $sth->prepare("SELECT x,y,z FROM bar"); $sth2->prepare("INSERT INTO foo SET a = ?"); while (@ary = $sth->fetchrow_array()) { $sth2->$execute($ary[0]); } $sth2->finish(); $sth->finish(); $dbh->do("UNLOCK TABLES");
Is this correct or will $sth2 not be able to access the tables because of the lock?

Comment on Answer: How do I lock tables using DBI and mySQL?
Download Code
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2015-07-04 23:07 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 (60 votes), past polls