MySQL Update query - Will the 'where' condition respected on race condition and row locking? (php, PDO, MySQL, InnoDB)

前端 未结 3 2012
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-09 03:59

I am trying to build a first-come first-get model sale page. We have n number of items of the same type. We want to assign these n items to the first n users who made the reques

3条回答
  •  执念已碎
    2021-02-09 04:25

    No since reservationCompleted is set to true true.Don t forget to COMMIT each successfull transaction. the next process will of course get the lock but will not satisfiy the WHERE condition and release the LOCK.If you want you want the next process to look for another available item You can wrap your Update statement around with a Sub Routine procedure to check whether reservationCompleted is FALSE.

提交回复
热议问题