Added support for specifying the fetch array size when fetching documents from

a SODA collection -- available in Oracle Client 19.5 and higher.
This commit is contained in:
Anthony Tuininga 2020-02-14 10:33:07 -07:00
parent 9beb4aa907
commit 4ffbc9cac8
3 changed files with 32 additions and 0 deletions

View File

@ -414,6 +414,18 @@ SODA Operation Object
.. versionadded:: 7.0
.. method:: SodaOperation.fetchArraySize(value)
Specifies the numnber of documents that are fetched at a single time from
the SODA collection. A value of 0 will use the default value (100). This
method is only available in Oracle Client 19.5 and higher.
As a convenience, the SodaOperation object is returned so that further
criteria can be specified by chaining methods together.
.. versionadded:: 8.0
.. method:: SodaOperation.filter(value)
Sets a filter specification for complex document queries and ordering of

View File

@ -47,6 +47,8 @@ Version 8.0 (TBD)
#) Added functions :meth:`SodaCollection.save()`,
:meth:`SodaCollection.saveAndGet()` and :meth:`SodaCollection.truncate()`
available in Oracle Client 20 and higher.
#) Added function :meth:`SodaOperation.fetchArraySize()` available in Oracle
Client 19.5 and higher.
#) Added support for starting up a database using a parameter file (PFILE),
as requested
(`issue 295 <https://github.com/oracle/python-cx_Oracle/issues/295>`__).

View File

@ -29,6 +29,7 @@ static PyObject *cxoSodaOperation_remove(cxoSodaOperation*, PyObject*);
static PyObject *cxoSodaOperation_replaceOne(cxoSodaOperation*, PyObject*);
static PyObject *cxoSodaOperation_replaceOneAndGet(cxoSodaOperation*,
PyObject*);
static PyObject *cxoSodaOperation_fetchArraySize(cxoSodaOperation*, PyObject*);
//-----------------------------------------------------------------------------
@ -50,6 +51,8 @@ static PyMethodDef cxoMethods[] = {
{ "replaceOne", (PyCFunction) cxoSodaOperation_replaceOne, METH_O },
{ "replaceOneAndGet", (PyCFunction) cxoSodaOperation_replaceOneAndGet,
METH_O },
{ "fetchArraySize", (PyCFunction) cxoSodaOperation_fetchArraySize,
METH_O },
{ NULL }
};
@ -524,3 +527,18 @@ static PyObject *cxoSodaOperation_replaceOneAndGet(cxoSodaOperation *op,
return (PyObject*) cxoSodaDoc_new(op->coll->db, replacedHandle);
Py_RETURN_NONE;
}
//-----------------------------------------------------------------------------
// cxoSodaOperation_fetchArraySize()
// Set the fetch array size to be used for the operation.
//-----------------------------------------------------------------------------
static PyObject *cxoSodaOperation_fetchArraySize(cxoSodaOperation *op,
PyObject *fetchArraySizeObj)
{
op->options.fetchArraySize = PyLong_AsUnsignedLong(fetchArraySizeObj);
if (PyErr_Occurred())
return NULL;
Py_INCREF(op);
return (PyObject*) op;
}