# 22. Virtuoso Functions Guide - set_user_id

Chapter Contents | Prev | Next
Keyword Search:
www.openlinksw.com
docs.openlinksw.com
Book Home
Contents
Preface
Virtuoso Functions Guide
Administration
Aggregate Functions
Array Manipulation
BPEL APIs
Backup
Compression
Cursor
Date & Time Manipulation
Debug
Dictionary Manipulation
Encoding & Decoding
File Manipulation
Free Text
Hashing / Cryptographic
LDAP
Locale
Mail
Miscellaneous
Number
Remote SQL Data Source
Replication
SOAP
SQL
__any_grants
close
collation_define
complete_table_name
delay
end_result
exec
exec_next
exec_result
exec_result_names
identity_value
name_part
registry_get
registry_get_all
registry_name_is_pro...
registry_remove
registry_set
result
result_names
row_count
sequence_get_all
sequence_next
sequence_remove
sequence_set
set_identity_column
set_row_count
set_user_id
signal
sinv_create_inverse
sinv_create_key_mapp...
sinv_drop_inverse
sys_stat_analyze
sys_stat_histogram
table_drop_policy
table_set_policy
username
String
Transaction
Type Mapping
UDDI
User Defined Types & The CLR
Virtuoso Java PL API
Virtuoso Server Extension Interface (VSEI)
Web Server & Internet
XML
XPATH & XQUERY
Functions Index

## set_user_id

sets the current user for execution
integer set_user_id (in user_name varchar, in mode integer, in password varchar);
Description

This function changes the effective user and group to that of the user defined by user_name parameter. When called by a user with DBA group privileges, the optional password may be omitted. Otherwise it has to be the valid password for user_name. The mode parameter determines persistence (context) of effects of the call: If omitted or set to integer value 1, the effective user privileges will remain in effect within current stored procedure context only - upon returning, the effective user privileges will be automatically reset to state effctive before set_user_id. When mode is equal to integer value 0, the effective user privileges will remain set for duration of current ODBC session, current request in web server context, or until next call of set_user_id. This function is analogous to the UNIX 'su' command.

Parameters
user_name – the name of SQL user account to be used as effective user and group.
mode – optional, integer 1 (default) means change of privileges remains in effect only while within current stored procedure context.
password – this optional parameter is needed if calling the function without DBA privileges. Password of the user user_name.
Return Types

No return value