Try OpenEdge Now
skip to main content
ABL Reference
ABL Syntax Reference : USERID function
 

USERID function

Returns a character string representing the user ID for the specified database connection identity.

Syntax

USERID [ ( logical-dbname ) ]
logical-dbname
The logical name of the database from whose connection identity you want to retrieve the user ID. The logical database name must be a character string enclosed in quotes, or a character expression. If you do not specify this argument, the compiler inserts the name of the database that is connected when the procedure is compiled. If you omit this argument and more than one database is connected, ABL raises an error.

Example

This one-line procedure displays the current user ID for the database with the DICTDB alias:
r-userid.p
DISPLAY USERID("DICTDB") LABEL "You are logged in as" WITH SIDE-LABELS.

Notes

*The user ID returned by this function can be set for a database connection identity that is specified on the command line or when executing the CONNECT statement, the SECURITY-POLICY:SET-CLIENT( ) method, the SET-DB-CLIENT function, or the SETUSERID function.
*For a single-tenant database connection, the user ID returned by the USERID function is non-qualified; for a multi-tenant database connection, it is fully qualified, as shown in the following table.
Table 64. Values returned from the USERID function
This value is returned...
For...
""
A non-qualified user ID for the blank user name in the blank domain
"user-name"
A non-qualified user ID for a specific user name in the blank domain
"@domain-name"
A fully qualified user ID for the blank user name in a specific domain
"user-name@domain-name"
A fully qualified user ID for a specific user in a specific domain
The user ID returned by this function is always consistent with the user ID used in database identity audit trails, as well as for applying ABL table and field permissions and ABL Security Administrator rights.
*When using the USERID function, ABL returns a compiler error under the following conditions:
*There is no database connected
*You omit the logical-dbname argument and more than one database is currently connected
*When specifying the logical-dbname argument, you must provide the name of the logical database, not the physical database.
*After ABL starts running, you can use the SET-CLIENT( ) method, the SET-DB-CLIENT function, or the SETUSERID function to change the current user ID associated with an existing database connection.
*ABL user IDs in _User table accounts are case insensitive.
*See OpenEdge Getting Started: Identity Management, OpenEdge Development: Programming Interfaces, and OpenEdge Data Management: Database Administration for more information on user identity.

See also

CAN-DO function, CONNECT statement, QUALIFIED-USER-ID attribute, SET-CLIENT( ) method, SET-DB-CLIENT function, SETUSERID function, USER-ID attribute