Added support for specifying the IP address the subscription should u… · datamk/python-cx_Oracle@bab41ac · GitHub
Skip to content

Commit bab41ac

Browse files
Added support for specifying the IP address the subscription should use instead
of having the Oracle Client library determine the IP address on its own.
1 parent 23fac68 commit bab41ac

5 files changed

Lines changed: 40 additions & 12 deletions

File tree

doc/src/connection.rst

Lines changed: 5 additions & 1 deletion

doc/src/subscription.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@ Subscription Object
4343
subscription.
4444

4545

46+
.. attribute:: Subscription.ipAddress
47+
48+
This read-only attribute returns the IP address used for callback
49+
notifications from the database server. If not set during construction,
50+
this value is None.
51+
52+
4653
.. attribute:: Subscription.port
4754

4855
This read-only attribute returns the port used for callback notifications

src/cxoConnection.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1456,21 +1456,21 @@ static PyObject *cxoConnection_subscribe(cxoConnection *conn, PyObject* args,
14561456
PyObject* keywordArgs)
14571457
{
14581458
static char *keywordList[] = { "namespace", "protocol", "callback",
1459-
"timeout", "operations", "port", "qos", NULL };
1459+
"timeout", "operations", "port", "qos", "ipAddress", NULL };
14601460
uint32_t namespace, protocol, port, timeout, operations, qos;
1461-
PyObject *callback;
1461+
PyObject *callback, *ipAddress;
14621462

1463-
callback = NULL;
14641463
timeout = port = qos = 0;
1464+
callback = ipAddress = NULL;
14651465
namespace = DPI_SUBSCR_NAMESPACE_DBCHANGE;
14661466
protocol = DPI_SUBSCR_PROTO_CALLBACK;
14671467
operations = DPI_OPCODE_ALL_OPS;
1468-
if (!PyArg_ParseTupleAndKeywords(args, keywordArgs, "|iiOiiii",
1468+
if (!PyArg_ParseTupleAndKeywords(args, keywordArgs, "|iiOiiiiO",
14691469
keywordList, &namespace, &protocol, &callback, &timeout,
1470-
&operations, &port, &qos))
1470+
&operations, &port, &qos, &ipAddress))
14711471
return NULL;
1472-
return (PyObject*) cxoSubscr_new(conn, namespace, protocol, port, callback,
1473-
timeout, operations, qos);
1472+
return (PyObject*) cxoSubscr_new(conn, namespace, protocol, ipAddress,
1473+
port, callback, timeout, operations, qos);
14741474
}
14751475

14761476

src/cxoModule.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,7 @@ struct cxoSubscr {
359359
PyObject *callback;
360360
uint32_t namespace;
361361
uint32_t protocol;
362+
PyObject *ipAddress;
362363
uint32_t port;
363364
uint32_t timeout;
364365
uint32_t operations;
@@ -430,8 +431,9 @@ cxoObjectType *cxoObjectType_newByName(cxoConnection *connection,
430431
PyObject *name);
431432

432433
cxoSubscr *cxoSubscr_new(cxoConnection *connection, uint32_t namespace,
433-
uint32_t protocol, uint32_t port, PyObject *callback, uint32_t timeout,
434-
uint32_t operations, uint32_t qos);
434+
uint32_t protocol, PyObject *ipAddress, uint32_t port,
435+
PyObject *callback, uint32_t timeout, uint32_t operations,
436+
uint32_t qos);
435437

436438
PyObject *cxoTransform_dateFromTicks(PyObject *args);
437439
int cxoTransform_fromPython(cxoTransformNum transformNum, PyObject *pyValue,

src/cxoSubscr.c

Lines changed: 17 additions & 2 deletions

0 commit comments

Comments
 (0)