Updating Local Database
[Previous] [Main] [Next]

Updating Local Database


I have made the assumption you have remote sites and they have local databases. As a result some attention must be made to updating the database remotely. In pseudo code here is how I usually do this:

·One row in a table contains a "database level" field and a "who has the database locked" field.  
·When users start the application each one checks the database level the application needs with the one listed in the database.  
·   If they are different, the application looks at the "Lock" field. If there is something there, the user is shown the lock field info and the application exits.  
· If the lock field is empty, the application tires to update the lock field with his or her user name and a date/time.  
· If the update does not work, someone else got there first. The user is shown the lock field and the application exits.  
· If the update works, the application goes to work carrying out the changes needed. At the end the "database level" field is updated and the lock field is cleared.