diff --git a/doc/src/api_manual/deprecations.rst b/doc/src/api_manual/deprecations.rst index 188bb7d..982a71a 100644 --- a/doc/src/api_manual/deprecations.rst +++ b/doc/src/api_manual/deprecations.rst @@ -48,6 +48,8 @@ if applicable. The most recent deprecations are listed first. - Replace with parameter name `session_callback` * - `maxSessionsPerShard` parameter to :meth:`cx_Oracle.SessionPool()` - Replace with parameter name `max_sessions_per_shard` + * - `SessionPool.tnsentry` + - Replace with :data:`SessionPool.dsn` * - `payloadType` parameter to :meth:`Connection.queue()` - Replace with parameter name `payload_type` if using keyword parameters. * - `ipAddress` parameter to :meth:`Connection.subscribe()` @@ -72,6 +74,8 @@ if applicable. The most recent deprecations are listed first. - Replace with parameter name `encoding_errors` * - `Cursor.fetchraw()` - Replace with :meth:`Cursor.fetchmany()` + * - `newSize` parameter to :meth:`LOB.trim()` + - Replace with parameter name `new_size` * - `Queue.deqMany` - Replace with :meth:`Queue.deqmany()` * - `Queue.deqOne` @@ -86,6 +90,18 @@ if applicable. The most recent deprecations are listed first. - Replace with :meth:`Queue.enqoptions` * - `Queue.payloadType` - Replace with :meth:`Queue.payload_type` + * - `Subscription.ipAddress` + - Replace with :attr:`Subscription.ip_address` + * - `Message.consumerName` + - Replace with :attr:`Message.consumer_name` + * - `Message.queueName` + - Replace with :attr:`Message.queue_name` + * - `Variable.actualElements` + - Replace with :attr:`Variable.actual_elements` + * - `Variable.bufferSize` + - Replace with :attr:`Variable.buffer_size` + * - `Variable.numElements` + - Replace with :attr:`Variable.num_elements` .. list-table:: Deprecated in 8.0 diff --git a/doc/src/api_manual/lob.rst b/doc/src/api_manual/lob.rst index 061ac1a..6ae61f8 100644 --- a/doc/src/api_manual/lob.rst +++ b/doc/src/api_manual/lob.rst @@ -74,7 +74,7 @@ See :ref:`lobdata` for more information about using LOBs. for all but supplemental characters. -.. method:: LOB.trim([newSize=0]) +.. method:: LOB.trim(new_size=0) Trim the LOB to the new size. @@ -87,7 +87,7 @@ See :ref:`lobdata` for more information about using LOBs. .. versionadded:: 8.0 -.. method:: LOB.write(data, [offset=1]) +.. method:: LOB.write(data, offset=1) Write the data to the LOB object at the given offset. The offset is in bytes for BLOB type LOBs and in UCS-2 code points for CLOB and NCLOB type diff --git a/doc/src/api_manual/session_pool.rst b/doc/src/api_manual/session_pool.rst index ffd9fd5..756c5ae 100644 --- a/doc/src/api_manual/session_pool.rst +++ b/doc/src/api_manual/session_pool.rst @@ -185,6 +185,10 @@ SessionPool Object This read-only attribute returns the TNS entry of the database to which a connection has been established. + .. deprecated:: 8.2 + + Use the attribute :attr:`~SessionPool.dsn` instead. + .. attribute:: SessionPool.username diff --git a/doc/src/api_manual/subscription.rst b/doc/src/api_manual/subscription.rst index fd089fb..264d795 100644 --- a/doc/src/api_manual/subscription.rst +++ b/doc/src/api_manual/subscription.rst @@ -29,7 +29,7 @@ Subscription Object subscriptions, the value is 0. -.. attribute:: Subscription.ipAddress +.. attribute:: Subscription.ip_address This read-only attribute returns the IP address used for callback notifications from the database server. If not set during construction, @@ -37,6 +37,12 @@ Subscription Object .. versionadded:: 6.4 + .. versionchanged:: 8.2 + + For consistency and compliance with the PEP 8 naming style, the + attribute `ipAddress` was renamed to `ip_address`. The old name will + continue to work for a period of time. + .. attribute:: Subscription.name @@ -106,7 +112,7 @@ Message Objects to the callback procedure specified when a subscription is created. -.. attribute:: Message.consumerName +.. attribute:: Message.consumer_name This read-only attribute returns the name of the consumer which generated the notification. It will be populated if the subscription was created with @@ -115,6 +121,12 @@ Message Objects .. versionadded:: 6.4 + .. versionchanged:: 8.2 + + For consistency and compliance with the PEP 8 naming style, the + attribute `consumerName` was renamed to `consumer_name`. The old name + will continue to work for a period of time. + .. attribute:: Message.dbname @@ -130,7 +142,7 @@ Message Objects :data:`~cx_Oracle.SUBSCR_QOS_QUERY` when the subscription was created. -.. attribute:: Message.queueName +.. attribute:: Message.queue_name This read-only attribute returns the name of the queue which generated the notification. It will only be populated if the subscription was created @@ -138,6 +150,12 @@ Message Objects .. versionadded:: 6.4 + .. versionchanged:: 8.2 + + For consistency and compliance with the PEP 8 naming style, the + attribute `queueName` was renamed to `queue_name`. The old name will + continue to work for a period of time. + .. attribute:: Message.registered diff --git a/doc/src/api_manual/variable.rst b/doc/src/api_manual/variable.rst index 3161f90..4d7e599 100644 --- a/doc/src/api_manual/variable.rst +++ b/doc/src/api_manual/variable.rst @@ -9,7 +9,7 @@ Variable Objects The DB API definition does not define this object. -.. attribute:: Variable.actualElements +.. attribute:: Variable.actual_elements This read-only attribute returns the actual number of elements in the variable. This corresponds to the number of elements in a PL/SQL index-by @@ -17,11 +17,24 @@ Variable Objects :func:`Cursor.arrayvar()`. For all other variables this value will be identical to the attribute :attr:`~Variable.numElements`. -.. attribute:: Variable.bufferSize + .. versionchanged:: 8.2 + + For consistency and compliance with the PEP 8 naming style, the + attribute `actualElements` was renamed to `actual_elements`. The old + name will continue to work for a period of time. + + +.. attribute:: Variable.buffer_size This read-only attribute returns the size of the buffer allocated for each element in bytes. + .. versionchanged:: 8.2 + + For consistency and compliance with the PEP 8 naming style, the + attribute `bufferSize` was renamed to `buffer_size`. The old + name will continue to work for a period of time. + .. method:: Variable.getvalue([pos=0]) @@ -41,12 +54,18 @@ Variable Objects attribute is None, the value is bound directly without any conversion. -.. attribute:: Variable.numElements +.. attribute:: Variable.num_elements This read-only attribute returns the number of elements allocated in an array, or the number of scalar items that can be fetched into the variable or bound to the variable. + .. versionchanged:: 8.2 + + For consistency and compliance with the PEP 8 naming style, the + attribute `numElements` was renamed to `num_elements`. The old + name will continue to work for a period of time. + .. attribute:: Variable.outconverter diff --git a/src/cxoLob.c b/src/cxoLob.c index 885450f..c5eb937 100644 --- a/src/cxoLob.c +++ b/src/cxoLob.c @@ -236,14 +236,22 @@ static PyObject *cxoLob_write(cxoLob *lob, PyObject *args, static PyObject *cxoLob_trim(cxoLob *lob, PyObject *args, PyObject *keywordArgs) { - static char *keywordList[] = { "newSize", NULL }; - unsigned PY_LONG_LONG newSize; + static char *keywordList[] = { "new_size", "newSize", NULL }; + unsigned PY_LONG_LONG newSize, newSizeDeprecated; int status; - newSize = 0; - if (!PyArg_ParseTupleAndKeywords(args, keywordArgs, "|K", keywordList, - &newSize)) + newSize = newSizeDeprecated = 0; + if (!PyArg_ParseTupleAndKeywords(args, keywordArgs, "|KK", keywordList, + &newSize, &newSizeDeprecated)) return NULL; + if (newSizeDeprecated > 0) { + if (newSize > 0) { + cxoError_raiseFromString(cxoProgrammingErrorException, + "new_size and newSize cannot both be specified"); + return NULL; + } + newSize = newSizeDeprecated; + } Py_BEGIN_ALLOW_THREADS status = dpiLob_trim(lob->handle, (uint64_t) newSize); Py_END_ALLOW_THREADS diff --git a/src/cxoSubscr.c b/src/cxoSubscr.c index f022f9a..ed0b4a8 100644 --- a/src/cxoSubscr.c +++ b/src/cxoSubscr.c @@ -416,12 +416,14 @@ static PyMemberDef cxoSubscrTypeMembers[] = { { "namespace", T_UINT, offsetof(cxoSubscr, namespace), READONLY }, { "name", T_OBJECT, offsetof(cxoSubscr, name), READONLY }, { "protocol", T_UINT, offsetof(cxoSubscr, protocol), READONLY }, - { "ipAddress", T_OBJECT, offsetof(cxoSubscr, ipAddress), READONLY }, + { "ip_address", T_OBJECT, offsetof(cxoSubscr, ipAddress), READONLY }, { "port", T_UINT, offsetof(cxoSubscr, port), READONLY }, { "timeout", T_UINT, offsetof(cxoSubscr, timeout), READONLY }, { "operations", T_UINT, offsetof(cxoSubscr, operations), READONLY }, { "qos", T_UINT, offsetof(cxoSubscr, qos), READONLY }, { "id", T_ULONG, offsetof(cxoSubscr, id), READONLY }, + // deprecated + { "ipAddress", T_OBJECT, offsetof(cxoSubscr, ipAddress), READONLY }, { NULL } }; @@ -433,9 +435,13 @@ static PyMemberDef cxoMessageTypeMembers[] = { { "txid", T_OBJECT, offsetof(cxoMessage, txId), READONLY }, { "tables", T_OBJECT, offsetof(cxoMessage, tables), READONLY }, { "queries", T_OBJECT, offsetof(cxoMessage, queries), READONLY }, + { "queue_name", T_OBJECT, offsetof(cxoMessage, queueName), READONLY }, + { "consumer_name", T_OBJECT, offsetof(cxoMessage, consumerName), + READONLY }, + { "registered", T_BOOL, offsetof(cxoMessage, registered), READONLY }, + // deprecated { "queueName", T_OBJECT, offsetof(cxoMessage, queueName), READONLY }, { "consumerName", T_OBJECT, offsetof(cxoMessage, consumerName), READONLY }, - { "registered", T_BOOL, offsetof(cxoMessage, registered), READONLY }, { NULL } }; diff --git a/src/cxoVar.c b/src/cxoVar.c index 7190497..9e910e7 100644 --- a/src/cxoVar.c +++ b/src/cxoVar.c @@ -722,10 +722,11 @@ static PyObject *cxoVar_repr(cxoVar *var) // declaration of members //----------------------------------------------------------------------------- static PyMemberDef cxoMembers[] = { + { "buffer_size", T_INT, offsetof(cxoVar, bufferSize), READONLY }, { "bufferSize", T_INT, offsetof(cxoVar, bufferSize), READONLY }, { "inconverter", T_OBJECT, offsetof(cxoVar, inConverter), 0 }, - { "numElements", T_INT, offsetof(cxoVar, allocatedElements), - READONLY }, + { "numElements", T_INT, offsetof(cxoVar, allocatedElements), READONLY }, + { "num_elements", T_INT, offsetof(cxoVar, allocatedElements), READONLY }, { "outconverter", T_OBJECT, offsetof(cxoVar, outConverter), 0 }, { "size", T_INT, offsetof(cxoVar, size), READONLY }, { NULL } @@ -736,6 +737,7 @@ static PyMemberDef cxoMembers[] = { // declaration of calculated members //----------------------------------------------------------------------------- static PyGetSetDef cxoCalcMembers[] = { + { "actual_elements", (getter) cxoVar_externalGetActualElements, 0, 0, 0 }, { "actualElements", (getter) cxoVar_externalGetActualElements, 0, 0, 0 }, { "type", (getter) cxoVar_getType, 0, 0, 0 }, { "values", (getter) cxoVar_externalGetValues, 0, 0, 0 },