Added support for the ORA_SDTZ environment variable used to set the
session time zone used by the database.
This commit is contained in:
parent
2832df5102
commit
c59e6a2750
|
@ -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.
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue