Hello,
In VFP, I used to use RLOCK("MyAlias") to lock a record, if I wanted to make sure another instance of the application would "know" that a record was being used, for instance when the appplication should display that a certain user was logged in.
USE Users
LOCATE FOR userName = "Christian"
IF NOT RLOCK("Users")
MESSAGEBOX("User already logged in")
ENDIF
Now after switching to MySQL, that simple functionality got more challenging. Then I found that Get_Lock can lock any name, so I used GET_LOCK(1,"Christian") to do the same thing as above in MySQL.
However, I found out that Get_Lock allows only one lock per database connection. Issuing a new Get_Lock unlocks the previous lock. So I would not be able to lock a user name, and additionally for instance the computer name as well.
Anybody knows what other methods I could use in MySQL to solve that problem?
Christian Isberner
Software Consultant