Answer the question
In order to leave comments, you need to log in
How to properly organize record locking?
Good afternoon! Suppose we have a table in the database with such a device:
int id
int user_id DEFAULT NULL
SELECT user_id FROM table WHERE id = ID что нам пришел от клиента
Если user_id == NULL
UPDATE table SET user_id = ID юзера что прислал запрос WHERE id = ID что нам пришел от клиента
Answer the question
In order to leave comments, you need to log in
Sergey "Why not add the user_id is NULL condition to the UPDATE?"
Here is the perfect answer :)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question