1 |
The LA Fox Developer
A Newsletter for
FoxPro
Application Developers in Southern California Visit our WebSite at:
http://www.lafox.org
|
May 2000
|
If you have an application where many different users may be making changes at the same time, then you need to be able to provide the ability to merge changes from these users. Here is a routine that does just that. The routine below can be put into a VFP method or used as a procedure in a program library.
An ideal application gives the user the ability to make changes, then cancel or save the changes. The easiest way to do this is to use VFP’s table buffering. A table buffer is actually a copy of the records that a user has changed, added or deleted. At some point (e.g. when the user clicks a “Save” button or exits the screen), you need to tell VFP to take what is in the buffer and write it out to the actual table on disk. However, what if a different user has also made a change to the same record since we buffered it? Then when we write out our buffer, we may undo or overwrite changes made by that other user.
Here is a simple example. We have a table with one record that has 2 fields
-
a name and a phone number. The name is “John Smith” and the phone number is “555-1212”. User A buffers the record and changes the name (in the buffered record) to “Mary Smith”. User B buffers the record (which still says “John Smith”) and changes the phone number to “555-111 1”. User A saves his change. Then user B saves his change. What is in the record? Name
=
“John Smith” and phone number
=
“555-1111”. We just undid the change that user A made.
The solution? When a user saves the changes he has made, then we need to compare his buffered records on a field-by-field basis with the data in the table on disk. If someone else has made a change that is not reflected in our buffered data, then we update our buffered data to reflect these changes BEFORE we write our buffered records to the table.
Using our same example above, here is how it would work. User A buffers the record and changes the name (in the buffered record) to “Mary Smith”. User B buffers the record (which still says “John Smith”) and changes the phone number to “555- 1111”. User A saves his change. Then user B saves his change. But this time, before we write the buffer out to disk, we check to
|
At LA Fox
May 15, 2000, 7:30 PM. Michael Cummings. Mike will be
speaking about Visual FoxPro’s advanced database features.
Building
Smart
Databases:
We will look at Rules, Triggers, Stored Procedures, and Default
Values. We can use these features to build some smarts into
VFP databases and make it easier to build applications. This is
a practical “Show Me the Code” session.
June 19, 2000, 7:30 PM. FoxFire
Unleashed!
Bill Wood, Program Manager and primary developer of the latest, just- released version of FoxFire! will be here to dazzle and delight.
July 17, 2000, 7:30 PM. Kristyne McDaniel. Kris will be here talking about configurable toolbars.
Elsewhere
May 14-18, 2000, VFP DevCon 2000, New Orleans Sheraton, New Orleans, LA. This new
event is going to have strong support from Microsoft and will be
on the same
scale!
level as Advisor’s DevCon in Miami. But it is offering
several innovative concepts. Content and direction has been determined by an advisory board made up primarily of speakers. People attending this conference will be allowed to “cross- pollinate” with the SQL conference, running concurrently at the same hotel, free of charge. This means that while an attendee
|
In this issue
|
ADO Jumpstart
MSDN Presents
Hot Tips
|
Page 3
Page 7
Page 7
|
Out and About
by Barty R. Lee
|
The May meeting of
LA Fox will be held on May 15, 2000, at 7:30 PM at our
new meeting
place (NCR, 100 N. Sepulveda Blvd., El Segundo, CA). For details on how to get there, see the map on the back page.
|
and much more
|
1 |