Now as for the locking part, MySQL can have table level locking and row level locking. If you want to do table level locking exclusively at SQL level -my $dbh = DBI->connect($dsn, $user, $password, { RaiseError => 1, AutoCommit => 0 }); # do SQL's that forms the transaction my $sth = $dbh->prepare(...) $sth->execute; $dbh->do(...); # commit the transaction $dbh->do( "COMMIT" );
But I can't see that being useful to your application. You will best handle this with the default locking mechanism, and design your application carefully to avoid race conditions. You could perhaps draw a time-line diagram, outline what time does the record become available, and what time it is needed by other apps, and so on. Regardless which design you end up with, (atomic) transactions are almost certainly needed.LOCK TABLES table1 WRITE, table2 WRITE INSERT INTO table1 SELECT * FROM table2; UNLOCK TABLES
In reply to Re: OT: help with MySQL questions
by Roger
in thread OT: help with MySQL questions
by kiat
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |