Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Code only runs correctly in debug mode
Message
De
03/08/1998 11:06:39
Larry Long
ProgRes (Programming Resources)
Georgie, États-Unis
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00123317
Message ID:
00123544
Vues:
28
>>Jim,
>>Are you sure that two consecutive calls to SYS(2015) can return the same value? By the definition in the help, SYS(2015) returns unique values, even if the "clock" is in the same "tick".
>>Help text snippet-
>>"Calling SYS(2015) more than once during the same millisecond interval will return a unique character string."
>>
>>Have you actually seen the duplication happen? If so, I am going to have to re-code my keyfield generation routines!
>>//:^o
>
>Larry,
>
>I don't trust anything that is automatically supposed to return unique values. I use a primary key table with one record for each table in the databse. It has a integer field then all I need to do is look up the table, lock the record, increment the value in field, unlock the record and return the new value.
>
>It is possible that sys(2015) could return the same value to two different machines. The guarantee is only that on any one machine it will not return the same value.
>
>SYS(3) will even return the same value on one machine under certain codnitions. I just don't see any reason why I shoudl have code that might fail whne code that doesn't fail is so easy to write.

That's all well and good for single users and lans, but you cannot use the same strategy if you have a distributed app. For example a multi-lan wan, that may not be on-line all the time with a central location, that keeps a master invoice file. With my way of gen'ing unique numbers all I have to do is add a location/machine id to sys(2015)and I'm done.
//:^)
L.A.Long
ProgRes
lalong1@charter.net
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform