8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 14:43:03 +01:00

Implement #7818 : Extend rdb$get_context('SYSTEM', '***') with other info from MON$ATTACHMENT

This commit is contained in:
Vlad Khorsun 2023-10-29 23:22:38 +02:00
parent d3ff3c7dd5
commit 7a858e240e
2 changed files with 20 additions and 0 deletions

View File

@ -70,10 +70,14 @@ Usage:
CLIENT_HOST | The wire protocol host name of remote client. Value is
| returned for all supported protocols.
|
CLIENT_OS_USER | Remote OS user name
|
CLIENT_PID | Process ID of remote client application
|
CLIENT_PROCESS | Process name of remote client application
|
CLIENT_VERSION | Version of the client library used by client application
|
DB_NAME | Canonical name of current database. It is either alias
| name if connectivity via file names is not allowed or
| fully expanded database file name otherwise.

View File

@ -388,8 +388,10 @@ const char
WIRE_CRYPT_PLUGIN_NAME[] = "WIRE_CRYPT_PLUGIN",
CLIENT_ADDRESS_NAME[] = "CLIENT_ADDRESS",
CLIENT_HOST_NAME[] = "CLIENT_HOST",
CLIENT_OS_USER_NAME[] = "CLIENT_OS_USER",
CLIENT_PID_NAME[] = "CLIENT_PID",
CLIENT_PROCESS_NAME[] = "CLIENT_PROCESS",
CLIENT_VERSION_NAME[] = "CLIENT_VERSION",
CURRENT_USER_NAME[] = "CURRENT_USER",
CURRENT_ROLE_NAME[] = "CURRENT_ROLE",
SESSION_IDLE_TIMEOUT[] = "SESSION_IDLE_TIMEOUT",
@ -4641,6 +4643,13 @@ dsc* evlGetContext(thread_db* tdbb, const SysFunction*, const NestValueArray& ar
resultStr = attachment->att_remote_host;
}
else if (nameStr == CLIENT_OS_USER_NAME)
{
if (attachment->att_remote_os_user.isEmpty())
return NULL;
resultStr = attachment->att_remote_os_user;
}
else if (nameStr == CLIENT_PID_NAME)
{
if (!attachment->att_remote_pid)
@ -4655,6 +4664,13 @@ dsc* evlGetContext(thread_db* tdbb, const SysFunction*, const NestValueArray& ar
resultStr = attachment->att_remote_process.ToString();
}
else if (nameStr == CLIENT_VERSION_NAME)
{
if (attachment->att_client_version.isEmpty())
return NULL;
resultStr = attachment->att_client_version.ToString();
}
else if (nameStr == CURRENT_USER_NAME)
{
const MetaString& user = attachment->getUserName();