Is MySQL `IF` statement atomic?

Viewed 27

Assuming the multiple applications use this statement to assure exclusivity with MySQL Locking Functions

SELECT IF(IS_USED_LOCK(:name) = CONNECTION_ID(), -1, GET_LOCK(:name, 0))

I'm wondering whether the IF statement is atomic (can it happen that lock gets acquired multiple times)

0 Answers
Related