Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

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

by filmo (Scribe)
on Sep 11, 2001 at 09:01 UTC ( #111670=categorized answer: print w/replies, xml ) Need Help??

Q&A > database programming > How do I lock tables using DBI and mySQL? - Answer 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?

Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
[1nickt]: yes, Corion sees it too, and I see it when not logged in.
[Corion]: I think you can disable download links in your settings?
[1nickt]: Looking in settings to see if I disabled it in my profile ...
[1nickt]: There is "Don;t show embedded d/l links" in Display settings. It is unchecked.
[1nickt]: Oh, there is a minimum lines setting!

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2017-05-23 18:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?