Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
FLOCK() causes duplicate primary keys.
Message
 
À
26/08/2005 12:26:56
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows Server 2003
Database:
Visual FoxPro
Divers
Thread ID:
01043971
Message ID:
01044378
Vues:
14
>>>If you use semaphore (mutex?) then current values are not read to keys table.
>>>So it is not possible to use some semaphore.
>>
>>Huh? I've been using semaphore files since dBaseIII to insure primary key validity.
>
>Why you don't use FLOCK() or RLOCK() ?
>
>Can you provide some sample code ?
something like this:
fhSemaphore = fopen("d:\path\file",12)
if fhSemaphore > 0
   nKey2Use = VAL( fread(fhSemaphore,128) ) + 1
   insert into TARGET (field1,field2,fieldPK) values (cVar1, cVar2, nKey2Use)
   nWrote = fwrite(fhSemaphore, str( nKey2Use ))
   =fclose(fhSemaphore)
else
   =messagebox("File not available for appending",0,"Try again")
endif
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform