Page 1 of 1
Data lock on MySQL & PHP
Posted: Wed Jul 30, 2003 6:14 am
by ptshaft
I'm writing a dense project using MySQL as database engine, and PHP as script language.
Sometimes, I need what I think is called data-lock, for example, row-lock, or table-lock. Is there any easy way of doing it?
Posted: Wed Jul 30, 2003 7:48 am
by Stoker
Mysql 3.23 (not sure about 4.x) does not have row level locks, only table..
LOCK TABLES mytable [READ|WRITE];
bla bla
UNLOCK TABLES;
READ allows read and prevents write, WRITE locks completely.. read the mysql manual section 6.7.3
Posted: Wed Jul 30, 2003 7:57 am
by twigletmac
Moved to Databases.
Mac
Posted: Wed Jul 30, 2003 8:35 am
by kcomer
I believe InnoDB has row level locking, but MyIASM only has table level locking. So, looks liek you need InnoDB tables. I have never tried this so can't say for sure how it works.
Keith
Posted: Wed Jul 30, 2003 8:51 am
by ptshaft
That was what I was afraid of, cause that's what i thought, default MySQL tables only allow table-level lock. I knew InnoDB allowed both row and table level lock, I just didn't want to jump into InnoDB tables. Looks like I have no other choice!
Tks.