Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How often is SYS(2015) changed?
Message
 
À
26/08/2011 11:05:03
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01521892
Message ID:
01521996
Vues:
89
J'aime (1)
>SYS(2015) is guaranteed to give unique results, and so far I haven't had any problems with it.

Not quite.

It's guaranteed to give unique results only in a single process.

If you have two or more instances running side by side it's quite possible to get duplicate values for SYS(2015). Common problem in Web apps like Web Connection or even multi-threaded DLLs running in IIS in seperate apartments.

For this reason it's a good idea to add a Process or Thread Id to SYS(2015):
lcId = SYS(2015)+TRANS(Application.ThreadId)
Unfortunately this also changes the size of the id and because the value isn't a fixed length it's harder to optmize the id. ThreadIds can be up to 5 digits wide.

+++ Rick ---

>
>>Hi,
>>
>>I have a routine where the application gets (via SQL select) records into one cursor from one table, then into another cursor from another table, and then again into the 3rd one. For each cursor I use value of SYS(2015). Since the SQL Select time from one cursor to another may take a second or two or could be less than a second. Can I rely that each value of SYS(2015) is unique if it is called within less than a second?
>>
>>UPDATE: I did a test of running from one .prg SYS(2015) one after another (obviously with less than a second between each) and all names appear to be unique.
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform