Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How does REPROCESS work

Status
Not open for further replies.

webpager

Programmer
Joined
Mar 27, 2001
Messages
166
Location
GB
Could someone please clarify what actually goes whilst REPROCESSING
during attempts to LOCK a record in a table.

My question relates to a school register where multiple users APPEND records to
a table at the same time but only at certain times of the day.

The query:-

As I understand it, before a record is written to a table it checks to see
if any other user has locked the table. If the table header is not locked
a users attempt to APPEND a new record and populate it
with data will be successful. If the table is locked, access to the table
is denied and the attempt to add a record the the table fails.

I hope I am on the right track so far.

If a number of users are a attempting to perform the same task at the same time
how does the SET REPROCESS deal with these multiple attempts.

????????????
All the attempts to create a new file are effectively made to form a queue and
VFP creates each one of the user's records in turn and no data is lost.

or

Each user's application will attempt to write to the file and if the process runs
out of time and some data is lost.

How do I optimize the use of SET REPROCESS to obtain the most efficient use.

Thanks in anticipation

Keith
 
Keith,

SET REPROCESS assigns the number of attempts - or period of time - for the LOCK() functions. Here's the excert from the VFP Help file:

SET REPROCESS Command
Specifies how many times and for how long Visual FoxPro attempts to lock a file or record after an unsuccessful locking attempt.
...
The first attempt to lock a record or file isn't always successful. Frequently, a record or file is locked by another user on the network. SET REPROCESS determines whether Visual FoxPro makes additional attempts to lock the record or file when the initial attempt is unsuccessful. You can specify either how many times additional attempts are made or for how long the attempts are made.

HTH.


Regards,

Ilya
 
Thanks for that Ilya

What happens to the data when all the 'REPROCESS' commands have been used and the file still isn't available?

Are there any general rules for SET REPROCESS settings ie. set it to the maximum number of users on the system for example.
 
webpager (Programmer):
Are there any general rules for SET REPROCESS settings ie. set it to the maximum number of users on the system for example.

No, Keith, REPROCESS means number of repetitions per request from a user to lock a file. Number of users currently connected to the file is irrelevant for the case.

Here's the address for the MSDN article on the subject:
HTH.

BTW, since it's APPEND and not REPLACE, I wonder why do you need to lock the table? Also, have you considered using INSERT (look up INSERT – SQL Command in VFP on-line Help) rather than APPEND?


Regards,

Ilya
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top