Skip to content

Commit 248f115

Browse files
committed
Implement #7818 : Extend rdb$get_context('SYSTEM', '***') with other info from MON$ATTACHMENT
1 parent 3bd7400 commit 248f115

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

doc/sql.extensions/README.context_variables2

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,14 @@ Usage:
7070
CLIENT_HOST | The wire protocol host name of remote client. Value is
7171
| returned for all supported protocols.
7272
|
73+
CLIENT_OS_USER | Remote OS user name
74+
|
7375
CLIENT_PID | Process ID of remote client application
7476
|
7577
CLIENT_PROCESS | Process name of remote client application
7678
|
79+
CLIENT_VERSION | Version of the client library used by client application
80+
|
7781
DB_NAME | Canonical name of current database. It is either alias
7882
| name if connectivity via file names is not allowed or
7983
| fully expanded database file name otherwise.

src/jrd/SysFunction.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,8 +379,10 @@ const char
379379
WIRE_CRYPT_PLUGIN_NAME[] = "WIRE_CRYPT_PLUGIN",
380380
CLIENT_ADDRESS_NAME[] = "CLIENT_ADDRESS",
381381
CLIENT_HOST_NAME[] = "CLIENT_HOST",
382+
CLIENT_OS_USER_NAME[] = "CLIENT_OS_USER",
382383
CLIENT_PID_NAME[] = "CLIENT_PID",
383384
CLIENT_PROCESS_NAME[] = "CLIENT_PROCESS",
385+
CLIENT_VERSION_NAME[] = "CLIENT_VERSION",
384386
CURRENT_USER_NAME[] = "CURRENT_USER",
385387
CURRENT_ROLE_NAME[] = "CURRENT_ROLE",
386388
SESSION_IDLE_TIMEOUT[] = "SESSION_IDLE_TIMEOUT",
@@ -4564,6 +4566,13 @@ dsc* evlGetContext(thread_db* tdbb, const SysFunction*, const NestValueArray& ar
45644566

45654567
resultStr = attachment->att_remote_host;
45664568
}
4569+
else if (nameStr == CLIENT_OS_USER_NAME)
4570+
{
4571+
if (attachment->att_remote_os_user.isEmpty())
4572+
return NULL;
4573+
4574+
resultStr = attachment->att_remote_os_user;
4575+
}
45674576
else if (nameStr == CLIENT_PID_NAME)
45684577
{
45694578
if (!attachment->att_remote_pid)
@@ -4578,6 +4587,13 @@ dsc* evlGetContext(thread_db* tdbb, const SysFunction*, const NestValueArray& ar
45784587

45794588
resultStr = attachment->att_remote_process.ToString();
45804589
}
4590+
else if (nameStr == CLIENT_VERSION_NAME)
4591+
{
4592+
if (attachment->att_client_version.isEmpty())
4593+
return NULL;
4594+
4595+
resultStr = attachment->att_client_version.ToString();
4596+
}
45814597
else if (nameStr == CURRENT_USER_NAME)
45824598
{
45834599
const MetaString& user = attachment->getUserName();

0 commit comments

Comments
 (0)