mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-22 16:43:03 +01:00
Improvement #6786 - Add session time zone to system context.
This commit is contained in:
parent
9436f57498
commit
5018dd6109
@ -131,6 +131,8 @@ Usage:
|
||||
EXT_CONN_POOL_ACTIVE_COUNT | Count of active connections, associated with pool
|
||||
|
|
||||
EXT_CONN_POOL_LIFETIME | Idle connection lifetime, in seconds
|
||||
|
|
||||
SESSION_TIMEZONE | Current session time zone.
|
||||
|
||||
Notes:
|
||||
To prevent DoS attacks against Firebird Server you are not allowed to have
|
||||
|
@ -329,6 +329,21 @@ select localtimestamp
|
||||
from rdb$database;
|
||||
```
|
||||
|
||||
### `SESSION_TIMEZONE` context variable
|
||||
|
||||
`RDB$GET_CONTEXT('SYSTEM', 'SESSION_TIMEZONE')` could be used to obtain the session current time zone.
|
||||
|
||||
#### Examples
|
||||
|
||||
```
|
||||
set time zone 'america/sao_paulo';
|
||||
select rdb$get_context('SYSTEM', 'SESSION_TIMEZONE') from rdb$database;
|
||||
-- Result: America/Sao_Paulo
|
||||
|
||||
set time zone '-3:00';
|
||||
-- Result: -03:00
|
||||
```
|
||||
|
||||
# Changes in `CURRENT_TIME` and `CURRENT_TIMESTAMP`
|
||||
|
||||
In version 4.0, `CURRENT_TIME` and `CURRENT_TIMESTAMP` are changed to return `TIME WITH TIME ZONE` and `TIMESTAMP WITH TIME ZONE` (with time zone set to the session time zone), different than previous versions, that returned the types without time zone.
|
||||
|
@ -384,6 +384,7 @@ const char
|
||||
SESSION_IDLE_TIMEOUT[] = "SESSION_IDLE_TIMEOUT",
|
||||
STATEMENT_TIMEOUT[] = "STATEMENT_TIMEOUT",
|
||||
EFFECTIVE_USER_NAME[] = "EFFECTIVE_USER",
|
||||
SESSION_TIMEZONE[] = "SESSION_TIMEZONE",
|
||||
// SYSTEM namespace: transaction wise items
|
||||
TRANSACTION_ID_NAME[] = "TRANSACTION_ID",
|
||||
ISOLATION_LEVEL_NAME[] = "ISOLATION_LEVEL",
|
||||
@ -4331,6 +4332,12 @@ dsc* evlGetContext(thread_db* tdbb, const SysFunction*, const NestValueArray& ar
|
||||
return NULL;
|
||||
resultStr = user.c_str();
|
||||
}
|
||||
else if (nameStr == SESSION_TIMEZONE)
|
||||
{
|
||||
char timeZoneBuffer[TimeZoneUtil::MAX_SIZE];
|
||||
TimeZoneUtil::format(timeZoneBuffer, sizeof(timeZoneBuffer), attachment->att_current_timezone);
|
||||
resultStr = timeZoneBuffer;
|
||||
}
|
||||
else
|
||||
{
|
||||
// "Context variable %s is not found in namespace %s"
|
||||
|
Loading…
Reference in New Issue
Block a user