Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How do you decide the length of GUID field?
Message
De
28/08/2008 15:03:50
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
28/08/2008 06:03:37
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01336497
Message ID:
01342751
Vues:
30
>And finally for a purist who wants integers as keys a "GUID" might exist (there is collision chance of less than 5 per 100000 as I have seen):
>
>
>Declare Integer UuidCreate In 'RPCRT4.dll' String @pguid
>Declare Integer StringFromGUID2 In 'Ole32.dll' ;
>	string rguid, String @lpsz, Integer cchMax
>
>CREATE CURSOR myIntGuids (guid i)
>LOCAL lnId
>FOR ix=1 TO 100000
>	lnId = val(sys(2007,guid(),1,1))
>	DO WHILE m.lnId > 0x7FFFFFFF
>		lnId = val(sys(2007,guid(),1,1))
>	enddo
>	INSERT into myIntGuids values(m.lnID)
>endfor
>SELECT guid FROM myIntGuids HAVING COUNT(*) > 1 group BY 1
>
>PROCEDURE guid
>	Local pguid,rguid
>	pguid=Replicate(Chr(0),16)
>	rguid=Replicate(Chr(0),80)
>
>	UuidCreate(@pguid)
>	StringFromGUID2(pguid,@rguid,40)
>	RETURN Strconv(Left(rguid,76),6)
>ENDPROC
>
Neat... I remember seeing the code to create GUID from VFE, but it seemed to be a bit longer... and they didn't have to loop until integer's right, because they went with an 8-byte as c(16) when converted to hex.

>Integer fields cannot store integer values is another problem but majority seems to be unaware of it:)

You can't store the upper half of the range of unsigned integers in a signed integer field. It seems to be a bit short for that.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform