Skip to content

Commit

Permalink
Merge pull request #6794 from FirebirdSQL/work/mon-att-session-timezone
Browse files Browse the repository at this point in the history
Improvement: add MON$SESSION_TIMEZONE to MON$ATTACHMENTS.
  • Loading branch information
dyemanov authored May 6, 2021
2 parents 1deaa8c + c875037 commit 0c56796
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
9 changes: 9 additions & 0 deletions src/jrd/Monitoring.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -961,6 +961,8 @@ void Monitoring::putAttachment(SnapshotData::DumpRecord& record, const Jrd::Atta
if (!attachment->att_user)
return;

const auto dbb = attachment->att_database;

record.reset(rel_mon_attachments);

PathName attName(attachment->att_filename);
Expand Down Expand Up @@ -1037,6 +1039,13 @@ void Monitoring::putAttachment(SnapshotData::DumpRecord& record, const Jrd::Atta
// statement timeout, milliseconds
record.storeInteger(f_mon_att_stmt_timeout, attachment->getStatementTimeout());

if (ENCODE_ODS(dbb->dbb_ods_version, dbb->dbb_minor_version) >= ODS_13_1)
{
char timeZoneBuffer[TimeZoneUtil::MAX_SIZE];
TimeZoneUtil::format(timeZoneBuffer, sizeof(timeZoneBuffer), attachment->att_current_timezone);
record.storeString(f_mon_att_session_tz, string(timeZoneBuffer));
}

record.write();

if (attachment->att_database->dbb_flags & DBB_shared)
Expand Down
2 changes: 2 additions & 0 deletions src/jrd/names.h
Original file line number Diff line number Diff line change
Expand Up @@ -451,3 +451,5 @@ NAME("RDB$CONFIG_VALUE", nam_cfg_value)
NAME("RDB$CONFIG_DEFAULT", nam_cfg_default)
NAME("RDB$CONFIG_IS_SET", nam_cfg_is_set)
NAME("RDB$CONFIG_SOURCE", nam_cfg_source)

NAME("MON$SESSION_TIMEZONE", nam_mon_session_tz)
6 changes: 4 additions & 2 deletions src/jrd/ods.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ const USHORT ODS_CURRENT12 = 0;
// Minor versions for ODS 13

const USHORT ODS_CURRENT13_0 = 0; // Firebird 4.0 features
const USHORT ODS_CURRENT13 = 0;
const USHORT ODS_CURRENT13_1 = 1; // Firebird 4.1 features
const USHORT ODS_CURRENT13 = 1;

// useful ODS macros. These are currently used to flag the version of the
// system triggers and system indices in ini.e
Expand All @@ -144,6 +145,7 @@ const USHORT ODS_11_1 = ENCODE_ODS(ODS_VERSION11, 1);
const USHORT ODS_11_2 = ENCODE_ODS(ODS_VERSION11, 2);
const USHORT ODS_12_0 = ENCODE_ODS(ODS_VERSION12, 0);
const USHORT ODS_13_0 = ENCODE_ODS(ODS_VERSION13, 0);
const USHORT ODS_13_1 = ENCODE_ODS(ODS_VERSION13, 1);

const USHORT ODS_FIREBIRD_FLAG = 0x8000;

Expand Down Expand Up @@ -171,7 +173,7 @@ const USHORT ODS_RELEASED = ODS_CURRENT13_0; // The lowest stable minor version
const USHORT ODS_CURRENT = ODS_CURRENT13; // The highest defined minor version
// number for this ODS_VERSION!

const USHORT ODS_CURRENT_VERSION = ODS_13_0; // Current ODS version in use which includes
const USHORT ODS_CURRENT_VERSION = ODS_13_1; // Current ODS version in use which includes
// both major and minor ODS versions!


Expand Down
1 change: 1 addition & 0 deletions src/jrd/relations.h
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,7 @@ RELATION(nam_mon_attachments, rel_mon_attachments, ODS_11_1, rel_virtual)
FIELD(f_mon_att_wire_compressed, nam_wire_compressed, fld_bool, 0, ODS_13_0)
FIELD(f_mon_att_wire_encrypted, nam_wire_encrypted, fld_bool, 0, ODS_13_0)
FIELD(f_mon_att_remote_crypt, nam_wire_crypt_plugin, fld_remote_crypt, 0, ODS_13_0)
FIELD(f_mon_att_session_tz, nam_mon_session_tz, fld_tz_name, 0, ODS_13_1)
END_RELATION

// Relation 35 (MON$TRANSACTIONS)
Expand Down

0 comments on commit 0c56796

Please # to comment.