mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-22 18:43:02 +01:00
Fixed CORE-6034 - The original time zone should be set to the current time zone at routine invocation.
This commit is contained in:
parent
c2fe37df9f
commit
a64b202dad
@ -8,6 +8,8 @@ The session time zone, as the name implies, can be a different one for each data
|
|||||||
|
|
||||||
It can then be changed with `SET TIME ZONE` statement to a given time zone or reset to its original value with `SET TIME ZONE LOCAL`.
|
It can then be changed with `SET TIME ZONE` statement to a given time zone or reset to its original value with `SET TIME ZONE LOCAL`.
|
||||||
|
|
||||||
|
The original time zone value is initially defined equal to the current time zone in session initialization and cannot be changed manually. But the original time zone is internally changed when a routine (function, procedure or trigger) is called to the value of the current time zone and restored to its previous value at routine exit. That means that a routine that changes the current time zone and later run `SET TIME ZONE LOCAL` will restore the current time zone to its initially received value.
|
||||||
|
|
||||||
A time zone may be a string with a time zone region (for example, `America/Sao_Paulo`) or a hours:minutes displacement (for example, `-03:00`) from GMT.
|
A time zone may be a string with a time zone region (for example, `America/Sao_Paulo`) or a hours:minutes displacement (for example, `-03:00`) from GMT.
|
||||||
|
|
||||||
A time/timestamp with time zone is considered equal to another time/timestamp with time zone if their conversion to UTC are equal, for example, `time '10:00 -02' = time '09:00 -03'`, since both are the same as `time '12:00 GMT'`. This is also valid in the context of `UNIQUE` constraints and for sorting purposes.
|
A time/timestamp with time zone is considered equal to another time/timestamp with time zone if their conversion to UTC are equal, for example, `time '10:00 -02' = time '09:00 -03'`, since both are the same as `time '12:00 GMT'`. This is also valid in the context of `UNIQUE` constraints and for sorting purposes.
|
||||||
|
@ -12712,6 +12712,10 @@ dsc* UdfCallNode::execute(thread_db* tdbb, jrd_req* request) const
|
|||||||
Arg::Gds(isc_modnotfound));
|
Arg::Gds(isc_modnotfound));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AutoSetRestore<USHORT> autoOriginalTimeZone(
|
||||||
|
&tdbb->getAttachment()->att_original_timezone,
|
||||||
|
tdbb->getAttachment()->att_current_timezone);
|
||||||
|
|
||||||
// Evaluate the function.
|
// Evaluate the function.
|
||||||
|
|
||||||
if (function->fun_entrypoint)
|
if (function->fun_entrypoint)
|
||||||
|
@ -3203,6 +3203,10 @@ void ExecProcedureNode::executeProcedure(thread_db* tdbb, jrd_req* request) cons
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
AutoSetRestore<USHORT> autoOriginalTimeZone(
|
||||||
|
&tdbb->getAttachment()->att_original_timezone,
|
||||||
|
tdbb->getAttachment()->att_current_timezone);
|
||||||
|
|
||||||
procRequest->req_gmt_timestamp = request->req_gmt_timestamp;
|
procRequest->req_gmt_timestamp = request->req_gmt_timestamp;
|
||||||
|
|
||||||
EXE_start(tdbb, procRequest, transaction);
|
EXE_start(tdbb, procRequest, transaction);
|
||||||
|
@ -1163,6 +1163,10 @@ void EXE_execute_triggers(thread_db* tdbb,
|
|||||||
UserId* invoker = s->triggerInvoker ? s->triggerInvoker : tdbb->getAttachment()->att_ss_user;
|
UserId* invoker = s->triggerInvoker ? s->triggerInvoker : tdbb->getAttachment()->att_ss_user;
|
||||||
AutoSetRestore<UserId*> userIdHolder(&tdbb->getAttachment()->att_ss_user, invoker);
|
AutoSetRestore<UserId*> userIdHolder(&tdbb->getAttachment()->att_ss_user, invoker);
|
||||||
|
|
||||||
|
AutoSetRestore<USHORT> autoOriginalTimeZone(
|
||||||
|
&tdbb->getAttachment()->att_original_timezone,
|
||||||
|
tdbb->getAttachment()->att_current_timezone);
|
||||||
|
|
||||||
EXE_start(tdbb, trigger, transaction);
|
EXE_start(tdbb, trigger, transaction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,6 +110,10 @@ void ProcedureScan::open(thread_db* tdbb) const
|
|||||||
|
|
||||||
TraceProcExecute trace(tdbb, proc_request, request, m_targetList);
|
TraceProcExecute trace(tdbb, proc_request, request, m_targetList);
|
||||||
|
|
||||||
|
AutoSetRestore<USHORT> autoOriginalTimeZone(
|
||||||
|
&tdbb->getAttachment()->att_original_timezone,
|
||||||
|
tdbb->getAttachment()->att_current_timezone);
|
||||||
|
|
||||||
EXE_start(tdbb, proc_request, request->req_transaction);
|
EXE_start(tdbb, proc_request, request->req_transaction);
|
||||||
|
|
||||||
if (iml)
|
if (iml)
|
||||||
@ -184,6 +188,10 @@ bool ProcedureScan::getRecord(thread_db* tdbb) const
|
|||||||
|
|
||||||
TraceProcFetch trace(tdbb, proc_request);
|
TraceProcFetch trace(tdbb, proc_request);
|
||||||
|
|
||||||
|
AutoSetRestore<USHORT> autoOriginalTimeZone(
|
||||||
|
&tdbb->getAttachment()->att_original_timezone,
|
||||||
|
tdbb->getAttachment()->att_current_timezone);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
EXE_receive(tdbb, proc_request, 1, oml, om);
|
EXE_receive(tdbb, proc_request, 1, oml, om);
|
||||||
|
Loading…
Reference in New Issue
Block a user