Added support for the ORA_SDTZ environment variable used to set the

session time zone used by the database.
This commit is contained in:
Anthony Tuininga 2023-05-09 16:49:31 -06:00
parent 2832df5102
commit c59e6a2750
2 changed files with 13 additions and 9 deletions

View File

@ -13,6 +13,8 @@ oracledb 1.4.0 (TBD)
Thin Mode Changes
+++++++++++++++++
#) Added support for the ``ORA_SDTZ`` environment variable used to set the
session time zone used by the database.
#) Added support for shrinking the pool back to the minimum number of
connections allowed in the pool when the pool is idle for
:data:`ConnectionPool.timeout` seconds.

View File

@ -1394,15 +1394,17 @@ cdef class AuthMessage(Message):
cdef:
int tz_hour, tz_minute, timezone
str sign, tz_repr
timezone = -time.altzone if time.daylight else -time.timezone
tz_hour = timezone // 3600
tz_minute = (timezone - (tz_hour * 3600)) // 60
if tz_hour < 0:
sign = "-"
tz_hour = -tz_hour
else:
sign = "+"
tz_repr = f"{sign}{tz_hour:02}:{tz_minute:02}"
tz_repr = os.environ.get("ORA_SDTZ")
if tz_repr is None:
timezone = -time.altzone if time.daylight else -time.timezone
tz_hour = timezone // 3600
tz_minute = (timezone - (tz_hour * 3600)) // 60
if tz_hour < 0:
sign = "-"
tz_hour = -tz_hour
else:
sign = "+"
tz_repr = f"{sign}{tz_hour:02}:{tz_minute:02}"
return f"ALTER SESSION SET TIME_ZONE='{tz_repr}'\x00"
cdef tuple _get_version_tuple(self, ReadBuffer buf):