Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Upsizing GUID to UniqueIdentifier
Message
De
14/09/2005 15:49:02
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Divers
Thread ID:
01049183
Message ID:
01049617
Vues:
32
>Meanwhile Hi Cetin,
>i am using your code at my tables chr(38) and my stored procedure codes like below (your posted before)
>
>
>*In your database create a new function say GUID():
>Function guid()
>Local pGUID,rGUID
>Declare Integer UuidCreate In 'RPCRT4.dll' String @pguid
>Declare Integer StringFromGUID2 In 'Ole32.dll' ;
>	string rguid, String @lpsz, Integer cchMax
>
>pGUID=Replicate(Chr(0),16)
>rGUID=Replicate(Chr(0),80)
>
>Return Iif(Inlist(UuidCreate(@pGUID),0,1824),;
>	Iif(StringFromGUID2(pGUID,@rGUID,40) # 0, ;
>	Strconv(Left(rGUID,76),6), ""),"")
>Endfunc
>*Set your PK default value to GUID() - requires c(38). Original value is a 128bits integer which you might store in c(16). Check fox4um.com.
>*Cetin
>
>
>this codes generates like {BBB04901-9C4E-4F41-AB34-0D7D2D7ADD7C} keys. How is your suggestion
>for prevent enlarging the tables sizes. without {} and - chr's or mine ? and if short one how was your another codes for 16 byte ?
>
>TIA

In 36 bytes version only store dropping {}.
In 16 bytes version (c(16) nocptrans):
Function guid()
Local pGUID,rGUID
Declare Integer UuidCreate In 'RPCRT4.dll' String @pguid

pGUID=Replicate(Chr(0),16)

Return Iif(Inlist(UuidCreate(@pGUID),0,1824),pGUID,"")
Endfunc
I'd use 36 0r 38 bytes version.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform