Skip to content

Commit c1417d1

Browse files
The exception "DPY-3022: named time zones are not supported in thin
mode" is now raised when attempting to fetch data of type TIMESTAMP WITH TIME ZONE when the time zone associated with the data is a named time zone. Previously invalid data was returned (#131).
1 parent 39cddf0 commit c1417d1

File tree

4 files changed

+11
-0
lines changed

4 files changed

+11
-0
lines changed

doc/src/release_notes.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ Thin Mode Changes
4949
#) Fixed bug determining RETURNING binds in a SQL statement when RETURNING and
5050
INTO keywords are not separated by whitespace, but are separated by
5151
parentheses.
52+
#) The exception ``DPY-3022: named time zones are not supported in thin mode``
53+
is now raised when attempting to fetch data of type TIMESTAMP WITH TIME
54+
ZONE when the time zone associated with the data is a named time zone.
55+
Previously invalid data was returned
56+
(`disc 131 <https://github.com/oracle/python-oracledb/discussions/131>`__).
5257
#) Internal implementation changes:
5358

5459
- Added internal support for prefetching the LOB size and chunk size,

src/oracledb/errors.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ def _raise_from_string(exc_type: Exception, message: str) -> None:
202202
ERR_OSON_NODE_TYPE_NOT_SUPPORTED = 3019
203203
ERR_OSON_FIELD_NAME_LIMITATION = 3020
204204
ERR_OSON_VERSION_NOT_SUPPORTED = 3021
205+
ERR_NAMED_TIMEZONE_NOT_SUPPORTED = 3022
205206

206207
# error numbers that result in DatabaseError
207208
ERR_TNS_ENTRY_NOT_FOUND = 4000
@@ -421,6 +422,8 @@ def _raise_from_string(exc_type: Exception, message: str) -> None:
421422
'element {element} is not the same data type as previous elements',
422423
ERR_MIXED_POSITIONAL_AND_NAMED_BINDS:
423424
'positional and named binds cannot be intermixed',
425+
ERR_NAMED_TIMEZONE_NOT_SUPPORTED:
426+
'named time zones are not supported in thin mode',
424427
ERR_NCHAR_CS_NOT_SUPPORTED:
425428
'national character set id {charset_id} is not supported by '
426429
'python-oracledb in thin mode',

src/oracledb/impl/thin/buffer.pyx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,8 @@ cdef class Buffer:
359359
value = cydatetime.datetime_new(year, ptr[2], ptr[3], ptr[4] - 1,
360360
ptr[5] - 1, ptr[6] - 1, fsecond, None)
361361
if num_bytes > 11 and ptr[11] != 0 and ptr[12] != 0:
362+
if ptr[11] & TNS_HAS_REGION_ID:
363+
errors._raise_err(errors.ERR_NAMED_TIMEZONE_NOT_SUPPORTED)
362364
tz_hour = ptr[11] - TZ_HOUR_OFFSET
363365
tz_minute = ptr[12] - TZ_MINUTE_OFFSET
364366
if tz_hour != 0 or tz_minute != 0:

src/oracledb/impl/thin/constants.pxi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -727,6 +727,7 @@ DEF TNS_TXN_IN_PROGRESS = 0x00000002
727727
DEF TNS_MAX_CONNECT_DATA = 230
728728
DEF TNS_CHUNK_SIZE = 32767
729729
DEF TNS_MAX_UROWID_LENGTH = 5267
730+
DEF TNS_HAS_REGION_ID = 0x80
730731

731732
# base 64 encoding alphabet
732733
DEF TNS_BASE64_ALPHABET = \

0 commit comments

Comments
 (0)