CreateUUID

Description

Returns a Universally Unique Identifier (UUID) in the format 'XXXXXXXX-XXXX-XXXX-XXXXXXXXXXXXXXX' where 'X' stands for a hexadecimal digit (0-9 or A-F).

Category

Other functions

Syntax


CreateUUID() 

Usage

A UUID, returned by CreateUUID, is a 35-character string representation of a unique 128-bit integer. Use CreateUUID when you need a string to use as 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. With ColdFusion, you can use UUIDs as primary table keys for applications in which data is stored on shared databases. In such cases, using numeric keys may cause primary key constraint violations during table merges. Using UUIDs, you can eliminate these violations, because each UUID is unique.

Example

<!--- This example shows how to use CreateUUID --->

<html>

<head>

<title>CreateUUID Example</title>

</head>

<body>

<H3>CreateUUID Example</H3>

<P>

This example uses CreateUUID to generate a UUID when you submit

the form. You can submit the form as many times as you wish.

</P>

<!--- This code checks whether the form was submitted, then creates a 

  UUID if it was. --->



<cfif IsDefined("Form.CreateUUID") Is True>

  <hr>

  <P>Your new UUID is: <cfoutput>#CreateUUID()#</cfoutput></P>

</cfif>



<form action = "createuuid.cfm" method = "post">

<P><input type = "Submit" name = "CreateUUID"> </P>

</FORM>



</body>

</html> 



Banner.Novgorod.Ru