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

前端 未结 3 1502
再見小時候
再見小時候 2021-02-09 03:54

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:29

    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.

提交回复
热议问题