From 5f8d24dd2480da0e4f4bb8e7b89b46feea76c721 Mon Sep 17 00:00:00 2001 From: Anthony Tuininga Date: Wed, 19 Jun 2019 16:01:57 -0600 Subject: [PATCH] Eliminated deprecation of attribute "id" on subscriptions. It is now populated with the value of REGID found in the database view USER_CHANGE_NOTIFICATION_REGS or the value of REG_ID found in the database view USER_SUBSCR_REGISTRATIONS. For AQ subscriptions, the value is 0. --- doc/src/subscription.rst | 9 ++++----- samples/DatabaseChangeNotification.py | 1 + src/cxoConnection.c | 1 + 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/doc/src/subscription.rst b/doc/src/subscription.rst index c434474..6b75c4c 100644 --- a/doc/src/subscription.rst +++ b/doc/src/subscription.rst @@ -23,11 +23,10 @@ Subscription Object .. attribute:: Subscription.id - This read-only attribute returns the value 0. - - .. deprecated:: 6.0 - This attribute was never intended to be exposed and will be removed - in cx_Oracle 7. + This read-only attribute returns the value of ``REGID`` found in the + database view ``USER_CHANGE_NOTIFICATION_REGS`` or the value of ``REG_ID`` + found in the database view ``USER_SUBSCR_REGISTRATIONS``. For AQ + subscriptions, the value is 0. .. attribute:: Subscription.ipAddress diff --git a/samples/DatabaseChangeNotification.py b/samples/DatabaseChangeNotification.py index 9b9ef37..f8e8aed 100644 --- a/samples/DatabaseChangeNotification.py +++ b/samples/DatabaseChangeNotification.py @@ -52,6 +52,7 @@ sub = connection.subscribe(callback = callback, timeout = 1800, qos = cx_Oracle.SUBSCR_QOS_ROWIDS) print("Subscription:", sub) print("--> Connection:", sub.connection) +print("--> ID:", sub.id) print("--> Callback:", sub.callback) print("--> Namespace:", sub.namespace) print("--> Protocol:", sub.protocol) diff --git a/src/cxoConnection.c b/src/cxoConnection.c index 0b9c5fd..9f2e24b 100644 --- a/src/cxoConnection.c +++ b/src/cxoConnection.c @@ -1786,6 +1786,7 @@ static PyObject *cxoConnection_subscribe(cxoConnection *conn, PyObject* args, Py_DECREF(subscr); return NULL; } + subscr->id = params.outRegId; cxoBuffer_clear(&ipAddressBuffer); cxoBuffer_clear(&nameBuffer);