in reply to OT: help with MySQL questions
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: OT: help with MySQL questions
by Abigail-II (Bishop) on Nov 25, 2003 at 09:06 UTC | |
|
Re: Re: OT: help with MySQL questions
by kiat (Vicar) on Nov 25, 2003 at 03:14 UTC | |
by Roger (Parson) on Nov 25, 2003 at 03:24 UTC |