Correct calculation of MessageProperties.msgid.
This commit is contained in:
parent
1347b04976
commit
438c885c20
@ -321,8 +321,9 @@ Message Properties
|
|||||||
|
|
||||||
.. attribute:: MessageProperties.msgid
|
.. attribute:: MessageProperties.msgid
|
||||||
|
|
||||||
This attribute specifies the id of the message in the last queue that
|
This read-only attribute specifies the id of the message in the last queue
|
||||||
generated this message.
|
that enqueued or dequeued the message. If the message has never been
|
||||||
|
dequeued or enqueued, the value will be `None`.
|
||||||
|
|
||||||
|
|
||||||
.. attribute:: MessageProperties.payload
|
.. attribute:: MessageProperties.payload
|
||||||
|
|||||||
@ -13,6 +13,7 @@ Version 8.3 (TBD)
|
|||||||
#) Updated embedded ODPI-C to `version 4.3.0
|
#) Updated embedded ODPI-C to `version 4.3.0
|
||||||
<https://oracle.github.io/odpi/doc/releasenotes.html#
|
<https://oracle.github.io/odpi/doc/releasenotes.html#
|
||||||
version-4-3-tbd>`__.
|
version-4-3-tbd>`__.
|
||||||
|
#) Corrected calculation of attribute :data:`MessageProperties.msgid`.
|
||||||
#) Binary integer variables now explicitly convert values to integers (since
|
#) Binary integer variables now explicitly convert values to integers (since
|
||||||
implicit conversion to integer has become an error in Python 3.10) and
|
implicit conversion to integer has become an error in Python 3.10) and
|
||||||
values that are not `int`, `float` or `decimal.Decimal` are explicitly
|
values that are not `int`, `float` or `decimal.Decimal` are explicitly
|
||||||
|
|||||||
@ -182,15 +182,15 @@ static PyObject *cxoMsgProps_getExpiration(cxoMsgProps *props, void *unused)
|
|||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// cxoMsgProps_getOriginalMsgId()
|
// cxoMsgProps_getMsgId()
|
||||||
// Get the value of the expiration property.
|
// Get the value of the msgid property.
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
static PyObject *cxoMsgProps_getOriginalMsgId(cxoMsgProps *props, void *unused)
|
static PyObject *cxoMsgProps_getMsgId(cxoMsgProps *props, void *unused)
|
||||||
{
|
{
|
||||||
uint32_t valueLength;
|
uint32_t valueLength;
|
||||||
const char *value;
|
const char *value;
|
||||||
|
|
||||||
if (dpiMsgProps_getOriginalMsgId(props->handle, &value, &valueLength) < 0)
|
if (dpiMsgProps_getMsgId(props->handle, &value, &valueLength) < 0)
|
||||||
return cxoError_raiseAndReturnNull();
|
return cxoError_raiseAndReturnNull();
|
||||||
if (!value)
|
if (!value)
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
@ -285,25 +285,6 @@ static int cxoMsgProps_setExpiration(cxoMsgProps *props, PyObject *valueObj,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// cxoMsgProps_setOriginalMsgId()
|
|
||||||
// Set the value of the original message id property.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
static int cxoMsgProps_setOriginalMsgId(cxoMsgProps *props, PyObject *valueObj,
|
|
||||||
void *unused)
|
|
||||||
{
|
|
||||||
Py_ssize_t valueLength;
|
|
||||||
char *value;
|
|
||||||
|
|
||||||
if (PyBytes_AsStringAndSize(valueObj, &value, &valueLength) < 0)
|
|
||||||
return -1;
|
|
||||||
if (dpiMsgProps_setOriginalMsgId(props->handle, value,
|
|
||||||
(uint32_t) valueLength) < 0)
|
|
||||||
return cxoError_raiseAndReturnInt();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// cxoMsgProps_setPriority()
|
// cxoMsgProps_setPriority()
|
||||||
// Set the value of the expiration property.
|
// Set the value of the expiration property.
|
||||||
@ -339,8 +320,7 @@ static PyGetSetDef cxoCalcMembers[] = {
|
|||||||
(setter) cxoMsgProps_setExceptionQ, 0, 0 },
|
(setter) cxoMsgProps_setExceptionQ, 0, 0 },
|
||||||
{ "expiration", (getter) cxoMsgProps_getExpiration,
|
{ "expiration", (getter) cxoMsgProps_getExpiration,
|
||||||
(setter) cxoMsgProps_setExpiration, 0, 0 },
|
(setter) cxoMsgProps_setExpiration, 0, 0 },
|
||||||
{ "msgid", (getter) cxoMsgProps_getOriginalMsgId,
|
{ "msgid", (getter) cxoMsgProps_getMsgId, 0, 0, 0 },
|
||||||
(setter) cxoMsgProps_setOriginalMsgId, 0, 0 },
|
|
||||||
{ "priority", (getter) cxoMsgProps_getPriority,
|
{ "priority", (getter) cxoMsgProps_getPriority,
|
||||||
(setter) cxoMsgProps_setPriority, 0, 0 },
|
(setter) cxoMsgProps_setPriority, 0, 0 },
|
||||||
{ "state", (getter) cxoMsgProps_getState, 0, 0, 0 },
|
{ "state", (getter) cxoMsgProps_getState, 0, 0, 0 },
|
||||||
|
|||||||
@ -161,7 +161,6 @@ class TestCase(test_env.BaseTestCase):
|
|||||||
self.__verify_attr(props, "expiration", 30)
|
self.__verify_attr(props, "expiration", 30)
|
||||||
self.assertEqual(props.attempts, 0)
|
self.assertEqual(props.attempts, 0)
|
||||||
self.__verify_attr(props, "priority", 1)
|
self.__verify_attr(props, "priority", 1)
|
||||||
self.__verify_attr(props, "msgid", b'mID')
|
|
||||||
self.assertEqual(props.state, oracledb.MSG_READY)
|
self.assertEqual(props.state, oracledb.MSG_READY)
|
||||||
self.assertEqual(props.deliverymode, 0)
|
self.assertEqual(props.deliverymode, 0)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user