Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Making sure one occurence of the record is created
Message
De
25/04/2003 17:24:03
 
 
À
25/04/2003 17:13:53
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00781704
Message ID:
00781714
Vues:
23
>Can you establish a primary key for the table and trap the error in the case that a second person/process attempts to create a duplicate key?

The problem is not to trap is someone is creating a duplicate key. The problem is that many times a day, I'd have two users doing the same transaction at the same time. At the time they do it, they are both ok with the validation. So, they get inside the condition and proceed with the INSERT INTO command. I was thinking of using an alternate table to keep my lock in there on a specific record that would be related to the main table I have to insert into. So, I would lock a record in that alternate table based on a member ID. I mention member ID here as the situation occurs when a member is firing two clicks from the browser at the same time. As multiple WWC VFP applications can take over the request, they can all process the same kind of hit from the same user at the same time. I say same time but in reality it's that one WWC VFP process is not terminated when the other one kicks in. So, the first click of the user bypasses the validation and proceeds with the INSERT INTO. Which is ok in this case as no record for that particular user has been created so far. Then, the other click also bypasses the validation as the first click process is not completed yet. So, we end up with a duplicate record. Using an alternate table, I could issue a lock on a record over there just before doing the validation. Then, as long as the initial process is not completed, the validation won't proceed on any other process.

So, basically, the need here is to lock something somewhere in order to allow a process to execute a series of command before another process go into that same loop of commands. By doing that, it will assure that once the initial process is done, a record has been created and the second process won't be able to create the same record as it won't be able to get into the required code as long as the initial process is not completed.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform