Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Preventing users from accessing tables
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00746351
Message ID:
00746385
Views:
20
>What is the best way to prevent someone from accessing tables if you want to make an emergency DB change that requires exclusive access? I heard of ways of adding timers to forms that constantly check for a file, then exit the app if it's there (to boot users from system). This doesn't seem that effective.

I assume ve are talking native VFP tables here.

There is no "simple" way to do this. If you need the exclusive use, then all other users which have this table open have to release it. Period. So you can:

1. Politely ask all the users to close the application.
2. Kill active user connections to the requred tables by the system administrator means.
3. Use the above mentioned timer method to force the users to leave the application smoothly.

Advantages and disadvantages:

1-st method.
(+) The safest method to release the tables and keep the data intact.
(-) The slowest method. User may be out for lunch (or out to lunch :) gone for the day, gone for vacation. :)

2-nd method.

(+) Guarantees relatively fast success , but
(--) at possible expense of application data integrity.


3-rd method.
(+)Almost guarantees full success since it forces the tables to close normally through the aplication.
(+) Fast enough in the emergency situations. In my case within one minute interval.
(+) Still faster than manually find and kill all users' connections on the server.

(-) Does not work in case some power user/developer has one of the tables open in the VFP development environment for any kind of maintenance/manual quieries.
(-) Requires additional coding and assumptions made for several situations like:
What to do if the user has the record in Edit mode? Revert the changes or Save the changes?
What to do if the user has the modal form or modal dialog window open that require user interaction before the application can quit?


Still, if you handle these situations with additional code, it seems the most effective way.
I myself use this timer approach in several VFP applications at work, that require exclusive use of the tables for some nightly processes and it all works fine for several years.
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro

"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison
Previous
Reply
Map
View

Click here to load this message in the networking platform