|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Hello...
How can I lock a particular row(record) for reading and writing while I am updating it? How can other queries to that record wait until it gets unlocked? I mean is there a built-in mechanism for this in MySQL or do I have to do it programatically from my PHP script? The actual problem is this: I have a table with banner information and image blob. There is a variable that counts how many times the particular banner has been shown. Now the banner mechanism has to lock the entire record (entire banner) while updating the count value, and then unlock it. Same goes when administrating the banners table (adding new, removing unused, updating exposition counts etc...) While the banner (record) is locked none should have access to the record (reading nor writing). Thanks in advance... |
|
#2
|
|||
|
|||
|
Here's a link on the MySQL site...
Try using the LOCK/UNLOCK TABLES.. Hope it helps. It's a lot easier in Oracle: SELECT * FROM TABLE_NAME FOR UPDATE; The row is locked until you commit or rollback the transaction.
__________________
____________________________________________ Developer Shed Weekly Writer | DevArticles Forum Moderator Build Your Own KlipFolio Klip With PHP FrankManno.com - Under Construction Design Interactive Group - Under Construction |
![]() |
| Viewing: Dev Articles Community Forums > Databases > MySQL Development > Locking records in MySQL |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|