FNC_DBSSessionAttrInfo Function | C Library Functions | Teradata Vantage - FNC_DBSSessionAttrInfo - Analytics Database - Teradata Vantage

SQL External Routine Programming

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2023-07-11
dita:mapPath
iiv1628111441820.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
B035-1147
lifecycle
latest
Product Category
Teradata Vantageā„¢

Allows table operators to retrieve information about the current session, such as system variables and session attributes.

Syntax

void 
FNC_DBSSessionAttrInfo (char  *jsonData);

Syntax Elements

jsonData
Session information returned by the function as a string in JSON format.

Usage Notes

The current session information returned by FNC_DBSSessionAttrInfo include the following:
  • Current user name
  • Current role name
  • Transaction mode
  • Collation

For current role name, a maximum of 127 role names are returned. If a user is granted more than 127 roles and the user issues a SET ROLE ALL statement to enable all of the roles, "ALL" is returned for the current role name. For example, the following sample output shows the session information returned for TESTUSER who has more than 127 roles enabled:

{"CurUserName":"TESTUSER","CurRoleName":"ALL","TransactionMode":"BTET","Collation":"ASCII"}

For users who specify SET ROLE ALL but have 127 roles or less, "ALL" is returned along with each of the role names. For example, TESTUSER2 has 3 roles: Role1, Role2, and Role3.

{"CurUserName":"TESTUSER2","CurRoleName":["ALL","Role1","Role2","Role3"],"TransactionMode":"BTET","Collation":"ASCII"}

Example

The following code fragment calls FNC_DBSSessionAttrInfo to get the current session information string.

...
char jsonData [4096] = {'\0'};
FNC_DBSSessionAttrInfo(jsonData);

The following sample output shows the current user name, current role name, transaction mode, and collation.

{"CurUserName":"TESTUSER","CurRoleName":"R1","TransactionMode":"BTET","Collation":"ASCII"}