Help: Detecting locks?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!


I'm writing a program (using mysql++) where I want users to be able to
lock a row while they are editing it. My problem is I don't know how
the 2nd user can detect the lock vs it looking like a failed query.

I have innodb_lock_wait_timeout set to 1 second, which works fine, but
mysql returns two errors when I try to update:

ERROR 1205 (HY000): Lock wait timeout exceeded....
ERROR 1064 (42000): You have an error in your SQL syntax....

Unfortunately, as far as I know, I can only get the *last* error from
the query which is 1064 - bad syntax. Since the 1064 overwrites the
1205 error, I can't differentiate the two.

Any ideas?


Site Timeline