Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Auto incr number or GUID?
Message
From
27/10/2003 12:05:52
 
 
To
27/10/2003 11:54:14
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00842581
Message ID:
00843045
Views:
23
>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform