Consultor Eletrônico



Kbase P117460: 4GL/ABL: Does the GENERATE-UUID function return a universally unique identifier?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   03/01/2011
Status: Verified

GOAL:

4GL/ABL: Does the GENERATE-UUID function return a universally unique identifier?

GOAL:

Can the BASE64-ENCODE function and the GENERATE-UUID function be used to generate a unique CHARACTER index?

GOAL:

Can the GUID function and the GENERATE-UUID function be used to generate a unique CHARACTER index?

FACT(s) (Environment):

All Supported Operating Systems
OpenEdge 10.x

FIX:

1. Yes, the GENERATE-UUID returns a universally unique 16-byte raw value as demonstrated by the following code:

DEFINE TEMP-TABLE test
FIELD rawField AS RAW
INDEX lcidx IS PRIMARY UNIQUE rawField ASCENDING.
DEFINE VARIABLE iVar AS INTEGER NO-UNDO.
DO iVar = 1 TO 1000000 ON ERROR UNDO, LEAVE:
CREATE test.
ASSIGN
rawField = GENERATE-UUID.
END.
MESSAGE iVar
VIEW-AS ALERT-BOX INFO BUTTONS OK.
2. Yes, the BASE64-ENCODE function and the GENERATE-UUID function may be used to generate a unique CHARACTER index as demonstrated by the following code:
DEFINE TEMP-TABLE test
FIELD lcField AS CHARACTER CASE-SENSITIVE
INDEX lcidx IS PRIMARY UNIQUE lcField ASCENDING.
DEFINE VARIABLE iVar AS INTEGER NO-UNDO.
DO iVar = 1 TO 1000000 ON ERROR UNDO, LEAVE:
CREATE test.
ASSIGN
lcField = SUBSTRING(BASE64-ENCODE(GENERATE-UUID), 1, 22).
END.
MESSAGE iVar
VIEW-AS ALERT-BOX INFO BUTTONS OK.
3. Yes, the GUID function and the GENERATE-UUID function may be used to generate a unique CHARACTER index as demonstrated by the following code:
DEFINE TEMP-TABLE test
FIELD lcField AS CHARACTER CASE-SENSITIVE
INDEX lcidx IS PRIMARY UNIQUE lcField ASCENDING.
DEFINE VARIABLE iVar AS INTEGER NO-UNDO.
DO iVar = 1 TO 1000000 ON ERROR UNDO, LEAVE:
CREATE test.
ASSIGN
lcField = GUID(GENERATE-UUID).
END.
MESSAGE iVar
VIEW-AS ALERT-BOX INFO BUTTONS OK.