General information
Category:
Coding, syntax & commands
Hi David,
SNIP
>
>I just tested it with a program that uses a FOR NEXT loop to insert 20,000 records into a small table using SYS(2015) to generate a key. Two concurrent FoxPro sessions running this program simultaneously on a 866 Mhz PIII machine generated 33 duplicates. So I would say that this method is not good in a multiuser environment where keys are being generated very rapidly (Hundreds or more per second).
>
>Or trap the duplicate key error and try it again. That may be the best solution. I little slower, but more reliable.
Your test proves that it can present a problem but your conclusion that keys being generated very rapidly (hundreds or more per second) is incorrect.
It really only takes a two pC setup and two simultaneous actions for the case to occur. And in fact the actions do not technically have to be simultaneous - only the factors that cause the duplication need to occur simultaneously. For instance, if the result of SYS(2015) is dependent on the time then it seems possible that one machine with its clock exactly 5 minutes offset from the other could have the action done exactly 5 minutes later and still hit the problem.
Regards,
JimN
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only