MySQL and row locking
Moderator: General Moderators
-
visionmaster
- Forum Contributor
- Posts: 139
- Joined: Wed Jul 14, 2004 4:06 am
MySQL and row locking
Hello,
I have a table where data can be changed by a call center agent as well as from a user who my want to change his/her data.
To avoid any collisions, the table row being changed or updated must be locked and my only be change by the "owner"? How do I realize this?
A extra field in my table row which marks a flag. So when a cca logs in and changes something I write 1 into the field. If a user logs in and wants to change something I write a 2 into the field. A 0 means this row is free and has no owner.
Or is there a mysql method I could use?
Thanks!
I have a table where data can be changed by a call center agent as well as from a user who my want to change his/her data.
To avoid any collisions, the table row being changed or updated must be locked and my only be change by the "owner"? How do I realize this?
A extra field in my table row which marks a flag. So when a cca logs in and changes something I write 1 into the field. If a user logs in and wants to change something I write a 2 into the field. A 0 means this row is free and has no owner.
Or is there a mysql method I could use?
Thanks!
-
visionmaster
- Forum Contributor
- Posts: 139
- Joined: Wed Jul 14, 2004 4:06 am
-
visionmaster
- Forum Contributor
- Posts: 139
- Joined: Wed Jul 14, 2004 4:06 am
-
ultraslacker
- Forum Newbie
- Posts: 3
- Joined: Tue Jul 20, 2004 2:11 pm
Re: MySQL and row locking
You cannot determine the order of table writes when there is a degree of concurrency, so you are better off using transactions than a column hack. Under mysql, this means the INNODB type mentioned above.visionmaster wrote:A extra field in my table row which marks a flag. So when a cca logs in and changes something I write 1 into the field. If a user logs in and wants to change something I write a 2 into the field. A 0 means this row is free and has no owner.
Or is there a mysql method I could use?