Skip to content

Commit ab4f6e9

Browse files
Fixed a bug resulting in a ValueError exception when getting
attribute "MessageProperties.enqtime" if the value is not available or None.
1 parent 91ea42b commit ab4f6e9

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

doc/src/release_notes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ Thick Mode Changes
4343
:attr:`DeqOptions.msgid`, :attr:`DeqOptions.transformation`,
4444
:attr:`EnqOptions.transformation`, :attr:`MessageProperties.correlation`,
4545
or :attr:`MessageProperties.exceptionq` are set to ``None``.
46+
#) Fixed a bug resulting in a ``ValueError`` exception when getting attribute
47+
:attr:`MessageProperties.enqtime` if the value is not available or None.
4648

4749
Common Changes
4850
++++++++++++++

src/oracledb/impl/thick/queue.pyx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,7 @@ cdef class ThickMsgPropsImpl(BaseMsgPropsImpl):
400400
cdef:
401401
dpiMsgProps* _handle
402402
ThickConnImpl _conn_impl
403+
bint _has_been_dequeued
403404

404405
def __dealloc__(self):
405406
if self._handle != NULL:
@@ -414,6 +415,7 @@ cdef class ThickMsgPropsImpl(BaseMsgPropsImpl):
414415
dpiJsonNode *node
415416
dpiJson *json
416417

418+
self._has_been_dequeued = True
417419
self._conn_impl = queue_impl._conn_impl
418420
if queue_impl.is_json:
419421
if dpiMsgProps_getPayloadJson(self._handle, &json) < 0:
@@ -480,12 +482,13 @@ cdef class ThickMsgPropsImpl(BaseMsgPropsImpl):
480482
Internal method for getting the enqueue time.
481483
"""
482484
cdef dpiTimestamp timestamp
483-
if dpiMsgProps_getEnqTime(self._handle, &timestamp) < 0:
484-
_raise_from_odpi()
485-
return cydatetime.datetime_new(timestamp.year, timestamp.month,
486-
timestamp.day, timestamp.hour,
487-
timestamp.minute, timestamp.second,
488-
timestamp.fsecond // 1000, None)
485+
if self._has_been_dequeued:
486+
if dpiMsgProps_getEnqTime(self._handle, &timestamp) < 0:
487+
_raise_from_odpi()
488+
return cydatetime.datetime_new(timestamp.year, timestamp.month,
489+
timestamp.day, timestamp.hour,
490+
timestamp.minute, timestamp.second,
491+
timestamp.fsecond // 1000, None)
489492

490493
def get_exception_queue(self):
491494
"""

tests/test_7800_aq_raw.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ def test_7806(self):
140140
self.__verify_attr(props, "priority", 1)
141141
self.assertEqual(props.state, oracledb.MSG_READY)
142142
self.assertEqual(props.deliverymode, 0)
143+
self.assertIsNone(props.enqtime)
143144

144145
def test_7807(self):
145146
"7807 - test enqueue visibility option - ENQ_ON_COMMIT"

0 commit comments

Comments
 (0)