Progress 4GL Code Samples · Index · Part 1 · 2 · 3 · 4 · 5 · Expand · Web Feed


UUID definition: A UUID is an identifier that is unique across both space and time1, with respect to the space of all UUIDs. A UUID can be used for multiple purposes, from tagging objects with an extremely short lifetime, to reliably identifying very persistent objects across a network.


Unfortunately, Progress« does not provide a build-in UUID generator. In DLC/bin you'll find genuuid, which uses a Java class to produce non-standard identifiers. You can't use genuuid to create unique primary key values, because this thing is incredible slow and the globally uniqueness is not guaranteed (KB#21175).

To populate primary keys, you could use sequence values instead of UUIDs, but there are disadvantages:
A Progress« sequence can produce 4 billion unique IDs, that is not enough if you need enterprise-wide unique object identifiers (OIDs).
Using integers to identify objects on the web (forms, links ...) enables hackers and bored users to update more stuff than they should have access to.
If you extend an environment where sequence values are used to identify tuples in tables, for example when you exchange data with vendors and customers, the (local) uniqueness is lost and you need to implement additional IDs.

Besides feeding of unique keys you can use UUIDs in file names, as instance identifier of transient objects, message identifier ...


getUUID.p is meant as a template demonstrating how UUIDs can be handled with Progress« 4GL. You can use getUUID.p to build a centralized UUID generator supplying unique IDs to all your databases, or within a session running as super procedure.

getUUID.p can supply Windows« GUIDs using either UuidCreate or UuidCreateSequential in rpcrt4.dll. It creates 'faked' UUIDs which should be unique when GUID creation fails. With 'faked' UUIDs you can pass strings like MAC addresses or table prefixes to replace the node part of the UUID. On UNIX boxes search for /usr/bin/uuidgen or another UUID generator and customize the internal procedure getUnixUUID.

Usage:

def var cUUID as char no-undo.                    
def var lGUID as log init false no-undo.
def var cConstantNode as char init ? no-undo.
def var cMode as char init "String":U no-undo.
RUN getUUID.p(
        INPUT cMode,         /* String or Binary */
        INPUT lGUID,         /* create GUID yes/no */
        INPUT cConstantNode, /* replace the node part, ?=no */    
        OUTPUT cUUID).


Download.



Previous PageConvert special characters to lower ASCII strings


Progress 4GL Code Samples · Index · Part 1 · 2 · 3 · 4 · 5 · Expand · Web Feed




1

To be precise, the UUID consists of a finite bit space. Thus the time value used for constructing a UUID is limited and will roll over in the future (approximately at A.D. 3400)




Author: Sebastian
Last Update: Friday, March 25, 2005   Web Feed

· Home

· Development

· P4GL Code

· Web Links

· Link to us

· Contact

· What's new

· Site map

· Get Help


Most popular:

· Site Feeds

· Database Design Guide

· Google Sitemaps

· smartDataPump

· Spider Support

· How To Link Properly


Free Tools:

· Sitemap Validator

· Simple Sitemaps

· Spider Spoofer

· Ad & Click Tracking



Search Google
Web Site

Add to My Yahoo!
Syndicate our Content via RSS FeedSyndicate our Content via RSS Feed



To eliminate unwanted email from ALL sources use SpamArrest!






Digg this · Add to del.icio.us · Add to Furl · We Can Help You!




Home · Categories · Articles & Tutorials · Syndicated News, Blogs & Knowledge Bases · Web Log Archives


Top of page

No Ads


Copyright © 2004, 2005 by Smart IT Consulting · Reprinting except quotes along with a link to this site is prohibited · Contact · Privacy