DECLARE AUDIT INFO SET (Set user connection information)
Function
DECLARE AUDIT INFO SET specifies, for applications that access a HiRDB server, account information and other user connection information. The specified user connection information remains in effect until it is terminated, and is output to the HiRDB server's audit trail when the SQL code is executed.
Format
DECLARE AUDIT INFO SET POS=:embedded-variable, |
Operands
Specifies the number of additional user information items that are to be set as INTEGER type embedded variables. The numbers corresponding to each additional user information item are as follows:
Specifies the user connection information as an embedded variable declared as a VARCHAR type (area length of 100 bytes or less). Specify the null value to remove information that has already been set. Additional user information item 1 through additional user information item 3 is included in the user connection information, and all are output in the audit trail.
Character sets other than the default character set cannot be specified.
Common rules
Figure 6-6 Effective scope of user connection information set in DECLARE AUDIT INFO SET
Note
Examples
Example 1: Set user connection information (additional user information item 1 through 3) that is specified in an embedded variable.
EXEC SQL BEGIN DECLARE SECTION ;
SQL TYPE IS VARCHAR(100) udata ;
long pos ;
EXEC SQL END DECLARE SECTION ;
strcpy(udata.str,"userA") ;
udata.len = strlen(udata.str) ;
pos = 1;
EXEC SQL DECLARE AUDIT INFO SET POS=:pos, INF=:udata ;
strcpy(udata.str," user data B ") ;
udata.len = strlen(udata.str) ;
pos = 2;
EXEC SQL DECLARE AUDIT INFO SET POS=:pos, INF=:udata ;
strcpy(udata.str," user data C ") ;
udata.len = strlen(udata.str) ;
pos = 3;
EXEC SQL DECLARE AUDIT INFO SET POS=:pos, INF=:udata ;
Example 2: Clear the contents of the user connection information (additional user information items 1 through 3).
EXEC SQL BEGIN DECLARE SECTION ;
SQL TYPE IS VARCHAR(100) udata ;
long pos ;
short ind ;
EXEC SQL END DECLARE SECTION ;
ind = -1;
pos = 1;
EXEC SQL DECLARE AUDIT INFO SET POS=:pos, INF=:udata:ind ;
pos = 2;
EXEC SQL DECLARE AUDIT INFO SET POS=:pos, INF=:udata:ind ;
pos = 3;
EXEC SQL DECLARE AUDIT INFO SET POS=:pos, INF=:udata:ind ;