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:
00009903
Vues:
43
>hi, tom.
>I am testing your generator, because i also need it.
>I put your generator in the default value of a field
>make a main index in that field
>and then run the follow:
>
>set talk off
>use test
>do while .t.
>append blank
>enddo
>
>it crash. with a "duplicated"
>
>if you make something like ( ? the value of the number ) after adding each
>record, it works fine.
>
>what about the automatic change of the time in summer/winter?
>
>
>My testing board is a P133 with W95 and 8mb running VFP 3.0b Spanish
>version.
>
>Is it a help to you?

Miguel

Well, thats why I still do a SEEK() routine to check for existing values... (s)

I don't trust anything so I check anyway. I never did a loop but I could see where there would be a problem. Yeah any code to force the system to do something else to 'kill time' would help -- Like my seek(). Change of time has absolutely no affect on the system.

Here is the complete code:

function kUniqueID
*-
lparameters tcTable,tcTag
*-
if empty(tcTable) or empty(tcTag)
*-
return(int(seconds() *100000 + day(date())))
endif
lcTable = tcTable
lcTag = tcTag
*-
if eof(lcTable)
lnRecNo = 0
else
lnRecNo = recno(lcTable)
endif
*-
do while TRUE
lnID = int(seconds() *100000 + day(date()))
go top
if seek(lnID,lcTable,lcTag)
loop
else
exit
endif
enddo
*-
if !empty(lnRecNo)
go (lnRecNo) in (lcTable)
endif
*-
return(lnID)

HTH,
Tom
Tom
--------------------------------
Tom O'Hare
407-299-4268 -- tom@redtile.com -- http://www.redtile.com/
Independent Programmer Using Visual FoxPro, Visual Basic & more...
Operations Manager -- Virtual FoxPro User Group (VFUG)
http://www.vfug.org/ -- tom@vfug.org
President -- Central Florida FoxPro User Group (CFFUG)
http://www.redtile.com/foxpro/
Universal Thread Most Valued Professional (MVP)
http://www.transformation.com/foxpro/
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform