Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Avoiding duplicate records, continuation
Message
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Avoiding duplicate records, continuation
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Divers
Thread ID:
01322454
Message ID:
01322454
Vues:
74
I gave up using auto increment integer fiels for a while

I continue my war also giving up using a second table to keep
records

I user a timer that executing 2 forms at the same time,
adding data to a table (very quickly, as test)

At the end of the tests I have 2000 records, with no duplications
Seems perfect...

However if I use 3 forms, duplicate numbers accour in some records

I wonder if 2 forms tests are enough or is there anything I could change
below to improve the code

Moises


********** form 1 ***********

SELECT ped

DO WHILE !FLOCK()
ENDDO

dimension lctemp[1]
select max(n) from ped ;
into array lctemp
lcTemp[1] = nvl(lcTemp[1],0)+1
replace ped.n WITH lcTemp
replace ped.n_id WITH "USER 1"

FLUSH
UNLOCK

********** form 2 ***********

SELECT ped

DO WHILE !FLOCK()
ENDDO

dimension lctemp[1]
select max(n) from ped ;
into array lctemp
lcTemp[1] = nvl(lcTemp[1],0)+1
replace ped.n WITH lcTemp
replace ped.n_id WITH "USER 2"

FLUSH
UNLOCK
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform