@@ -1386,6 +1386,23 @@ cdef class AuthMessage(Message):
1386
1386
# use of AES encryption
1387
1387
self .encoded_jdwp_data = encrypted_jdwp_data.hex().upper() + " 01"
1388
1388
1389
+ cdef str _get_alter_timezone_statement(self ):
1390
+ """
1391
+ Returns the statement required to change the session time zone to match
1392
+ the time zone in use by the Python interpreter.
1393
+ """
1394
+ cdef:
1395
+ int tz_hour, tz_minute, timezone
1396
+ str sign, tz_repr
1397
+ timezone = - time.altzone if time.daylight else - time.timezone
1398
+ tz_hour = timezone // 3600
1399
+ tz_minute = (timezone - (tz_hour * 3600 )) // 60
1400
+ if tz_hour < 0 :
1401
+ sign = " -"
1402
+ tz_hour = - tz_hour
1403
+ tz_repr = f" {sign}{tz_hour:02}:{tz_minute:02}"
1404
+ return f" ALTER SESSION SET TIME_ZONE= ' {tz_repr}' \x00 "
1405
+
1389
1406
cdef tuple _get_version_tuple(self , ReadBuffer buf):
1390
1407
"""
1391
1408
Return the 5-tuple for the database version. Note that the format
@@ -1528,7 +1545,7 @@ cdef class AuthMessage(Message):
1528
1545
self ._encrypt_passwords()
1529
1546
num_pairs = 2
1530
1547
else :
1531
- num_pairs = 3
1548
+ num_pairs = 4
1532
1549
1533
1550
# token authentication
1534
1551
if self .token is not None :
@@ -1610,6 +1627,8 @@ cdef class AuthMessage(Message):
1610
1627
driver_name)
1611
1628
self ._write_key_value(buf, " SESSION_CLIENT_VERSION" ,
1612
1629
str (_connect_constants.full_version_num))
1630
+ self ._write_key_value(buf, " AUTH_ALTER_SESSION" ,
1631
+ self ._get_alter_timezone_statement(), 1 )
1613
1632
if self .conn_impl._cclass is not None :
1614
1633
self ._write_key_value(buf, " AUTH_KPPL_CONN_CLASS" ,
1615
1634
self .conn_impl._cclass)
0 commit comments