Author: Gary Jeurink
Posted: 2012-08-24 at 10:40:31
Wow, way over my head, but I've got it and can use it as a stored procedure
and play with it, right? Thanks
Gary
-----Original Message-----
From: Dave Crozier [mailto:DaveC@Flexipol.co.uk]
Sent: Friday, August 24, 2012 3:52 AM
To: ProFox Email List
Subject: RE: auto increment
Why not use thee routines to produce true Guids like Paul has said, then
there is never a possibility of key duplicates:
****************
* Start Code
*
FUNCTION StringFromGUID(cGUID)
LOCAL cBuffer, nBufsize
nBufsize=128
cBuffer = REPLICATE(CHR(0), nBufsize*2)
= StringFromGUID2(cGUID, @cBuffer, nBufsize)
cBuffer = SUBSTR(cBuffer, 1, AT(CHR(0)+CHR(0), cBuffer))
RETURN STRCONV(cBuffer, 6)
function CreateGuid()
DECLARE INTEGER CoCreateGuid IN ole32 STRING @pguid
DECLARE INTEGER CLSIDFromString IN ole32;
STRING lpsz, STRING @pclsid
DECLARE INTEGER StringFromGUID2 IN ole32;
STRING rguid, STRING @lpsz, INTEGER cchMax
LOCAL cGUID, cGUIDString, cGUID1
cGUID = REPLICATE(CHR(0), 16) && 128 bits
IF CoCreateGuid(@cGUID) = 0
cGUIDString = StringFromGUID(cGUID)
*? cGUID
*? cGUIDString
* converting from String back to GUID
cGUID1 = REPLICATE(CHR(0), 16)
= CLSIDFromString(STRCONV(cGUIDString,5), @cGUID1)
*? cGuid1
endif
return Substr(cGuidString, 2, Len(cGuidString)-2)
*
endfunc
*
* End Code
**************
Dave
_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/B3CBDFE5EBC94B2EB971D94EB59AA77F@OwnerPC
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.