Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
The Mother of Unique IDs
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00009899
Message ID:
00009909
Vues:
51
I just made some tests and it seems to me that the random function RAND() is near 10000000 reliable than yours. But I'm not very sure that I correctly tested. It's too much...

Anyway, what you need is something like that:
This should replace your day(date()):

Function Last2Digits
Local CurrDate, AproxDayOfYear
CurrDate=date()
AproxDayOfYear=(month(CurrDate)*31+day(CurrDate)*100+;
mod(year(CurrDate),100)
Return chr(int(AproxDayOfYear/256))+chr(mod(AproxDayOfYear,256))


Function UniqueKey
Local RetValue, L2D
RetValue=seconds()
L2D=Last2Digits()
do while RetValue = seconds() && Waits until seconds is changed
enddo
Return str(Retvalue*1000,8)+L2D

This is a real unique value in a century!!!

Vlad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform