Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Auto incr number or GUID?
Message
De
27/10/2003 12:05:52
 
 
À
27/10/2003 11:54:14
Nancy Folsom
Pixel Dust Industries
Washington, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00842581
Message ID:
00843045
Vues:
25
>Gregory, et. al.
>
>>pmfji, but you can reduce the size of the guid key to 16 bytes (see CoCreateGuid() )
>
>Just an addition on the field size issue, which can be a little confusing. A GUID is stored as a 16-byte _binary_ character. It has a 38-byte string representation, which wouldn't need to be stored, or probably even displayed. Here's an example from the code sample I posted elsewhere,
>
>Bcid              Cid
>¯J:µÇ†A«iŸ5¥‰C  {B53A4AAF-1DC7-4186-AB69-9F35A5158943}
>
Correct.

If you want it readable, you can strip out the dashes etc, this reduces it to 32 bytes which is the hex represention
*--------------------------------------------------------
Function Guid_String()

	declare integer CoCreateGuid in ole32 string @	
	declare integer StringFromGUID2 in ole32 string,string @,integer 
	
	local guid, guidString, n, s
	guid = space(16)
	do case
	case empty(CoCreateGuid(@guid))
		guidString = space(78)
		n = StringFromGUID2(guid, @guidString,len(guidString))
		do case
		case n = len(guidString)/2
			s = chrtran(guidString, chr(0) + '-{}', '')
			return s
		otherwise
			assert FALSE
			return Null
		endcase
	
	otherwise
		assert FALSE
		return Null
	endcase

endfunc
*--------------------------------------------------------------------------
Gregory
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform