Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Record lock issue
Message
From
29/08/2008 16:19:11
 
 
To
29/08/2008 16:03:59
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
01342876
Message ID:
01343378
Views:
40
>>>>While LOCATE FOR will work I need to count number of records that already locked to know how many active users are in the system. The file will never be too big, I think max number of users any of our clients have is 100 right now. Also I am using FOR.. NEXT loop because in case number of locked record reached maximum number of users I want to stop checking no matter how many records are in the table.
>>>
>>>So what? You can still break out of a SCAN, just like you can break out of a FOR loop. However, my proposal - LOCATE FOR RLOCK() - would no longer be acceptable, given the requirements.
>>
>>You are absolutely right, can use SCAN, but RLOCK() is still an issue.
>>I have hope again after Sergey found the article from Microsoft. Will let you know.
>
>Sure, that is the real issue.
>
>But I wanted to ask, do you really need to know exactly how many users are connected? Is this for some sort of statistic?
>
>If, on the other hand, you want to avoid more than "x" users to connect to the system (assuming they bought a license for "x" users), then LOCATE FOR RLOCK() should work; if the first record you manage to lock has recno() > x, that means there are already at least "x" users connected. In this case, you might display a message, "requires licenses for additional users".
>
>On the other hand, if you are having problems with rlock(), a single command that tries to lock every record may be more difficult to debug than a loop.


Thank you this is a good point.
I do want to limit to “x” users using the system simultaneously. I like your idea of using LOCATE for RLOCK(), and I guess I could do that and if all records are locked I would have to check for record count and decide if I will allow to add another record for a new user or deny them a connection, but now the code losing its beauty again. For now I have to figure out the RLOCK() problem.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform