Re: mysql innodb transaction concurrency
Date: August 09, 2011 08:04AM
Hi Peter,
Thanks to your reply.
> So build that logic into the transaction
Placing logic in transaction would be enough? I think I have to lock the table or records.
$user_purchased = SELECT count(*) FROM purchases where user_id = 1 for update;
if (condition) {
UPDATE table SET column = "value" WHERE (...)
... other logic (including INSERT some data) ...
}
can I do this? Will this lock writing also until I commit the transaction?
I heard that there are many issues with locking table along with transactions. And they are suggesting to go with select for update. If I go with above logic, Will it solve my purpose?
Thanks in advance.
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.