| Contents > CFML Reference > ColdFusion Functions > CreateUUID |
|
|
|
|
||
Creates a Universally Unique Identifier (UUID). A UUID is a 35-character string representation of a unique 128-bit integer.
A ColdFusion format UUID, in the format xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxxxxxx, where x is a hexadecimal digit (0-9 or A-F). (The character groups are 8-4-4-4-16.)
CreateUUID()
The ColdFusion UUID generation algorithm uses the unique time-of-day value, the IEEE 802 Host ID, and a cryptographically strong random number generator to generate UUIDs that conform to the principles laid out in the draft IEEE RFC "UUIDs and GUIDs."
The ColdFusion UUID format is as follows:
xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxxxxxx (8-4-4-16).
This does not conform to the Microsoft/DCE standard, which is as follows:
xxxxxxxx-xxxx-xxxx-xxxxxx-xxxxxxxxxx (8-4-4-4-12)
There are UUID test tools and a user-defined function called CreateGUID, which converts CFML UUIDs to UUID/Microsoft GUID format, available on the web at www.cflib.org.
Use this function to generate a persistent identifier in a distributed environment. To a very high degree of certainty, this function returns a unique value; no other invocation on the same or any other system returns the same value.
UUIDs are used by distributed computing frameworks, such as DCE/RPC, COM+, and CORBA. In ColdFusion, you can use UUIDs as primary table keys for applications in which data is stored in shared databases. In such cases, using numeric keys can cause primary-key constraint violations during table merges. Using UUIDs, you can eliminate these violations.
<h3>CreateUUID Example</h3> <p> This example uses CreateUUID to generate a UUID when you submit the form.
You can submit the form more than once. </p> <!--- Checks whether the form was submitted; if so, creates UUID. ---> <cfif IsDefined("Form.CreateUUID") Is True> <hr> <p>Your new UUID is: <cfoutput>#CreateUUID()#</cfoutput></p> </cfif> <form action = "createuuid.cfm"> <p><input type = "Submit" name = "CreateUUID"> </p> </form>
|
|
||
| Contents > CFML Reference > ColdFusion Functions > CreateUUID |
|
|
ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting
Version 6.1
Comments are no longer accepted for ColdFusion MX 6.1. ColdFusion 8 is the current version.
RSS feed | Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/coldfusion/6.1/htmldocs/functi54.htm
Comments
isaac dealey said on Dec 29, 2003 at 7:29 PM : AdeptDeveloper said on Dec 19, 2004 at 8:30 AM : stonecliz said on Mar 20, 2005 at 2:07 AM : IvyClark said on Jul 13, 2005 at 8:56 PM : No screen name said on Aug 17, 2005 at 3:14 AM : Glizman said on Mar 22, 2006 at 9:08 AM :