Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using GET_LOCK in MySQL
Message
From
17/06/2008 09:57:45
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Client/server
Title:
Using GET_LOCK in MySQL
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows XP
Database:
MySQL
Miscellaneous
Thread ID:
01324717
Message ID:
01324717
Views:
86
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
Next
Reply
Map
View

Click here to load this message in the networking platform