Added parameter stmtcachesize to cx_Oracle.connect() and
cx_Oracle.SessionPool() in order to facilitate specifying the initial size of the statement cache.
This commit is contained in:
parent
cb1061a553
commit
7ad13e73d3
@ -41,13 +41,13 @@ Module Interface
|
||||
events=False, cclass=None, purity=cx_Oracle.ATTR_PURITY_DEFAULT, \
|
||||
newpassword=None, encoding=None, nencoding=None, edition=None, \
|
||||
appcontext=[], tag=None, matchanytag=None, shardingkey=[], \
|
||||
supershardingkey=[])
|
||||
supershardingkey=[], stmtcachesize=20)
|
||||
Connection(user=None, password=None, dsn=None, \
|
||||
mode=cx_Oracle.DEFAULT_AUTH, handle=0, pool=None, threaded=False, \
|
||||
events=False, cclass=None, purity=cx_Oracle.ATTR_PURITY_DEFAULT, \
|
||||
newpassword=None, encoding=None, nencoding=None, edition=None, \
|
||||
appcontext=[], tag=None, matchanytag=False, shardingkey=[], \
|
||||
supershardingkey=[])
|
||||
supershardingkey=[], stmtcachesize=20)
|
||||
|
||||
Constructor for creating a connection to the database. Return a
|
||||
:ref:`connection object <connobj>`. All parameters are optional and can be
|
||||
@ -126,6 +126,12 @@ Module Interface
|
||||
to be a sequence of values which will be used to identify the database
|
||||
shard to connect to. The key values can be strings, numbers, bytes or dates.
|
||||
|
||||
The stmtcachesize parameter, if specified, is expected to be an integer
|
||||
which specifies the initial value of :data:`~Connection.stmtcachesize`.
|
||||
|
||||
.. versionchanged:: 8.2
|
||||
|
||||
The parameter `stmtcachesize` was added.
|
||||
|
||||
.. function:: Cursor(connection)
|
||||
|
||||
@ -320,19 +326,22 @@ Module Interface
|
||||
used for any given shard in a sharded database. This value is ignored if
|
||||
the Oracle client library version is less than 18.3.
|
||||
|
||||
The stmtcachesize parameter, if specified, is expected to be an integer
|
||||
which specifies the initial value of :data:`~SessionPool.stmtcachesize`.
|
||||
|
||||
.. note::
|
||||
|
||||
This method is an extension to the DB API definition.
|
||||
|
||||
.. versionchanged:: 8.2
|
||||
|
||||
For consistency and compliance with the PEP 8 naming style, the
|
||||
parameter `waitTimeout` was renamed to `wait_timeout`, the parameter
|
||||
`maxLifetimeSession` was renamed to `max_lifetime_session`, the
|
||||
parameter `sessionCallback` was renamed to `session_callback` and the
|
||||
parameter `maxSessionsPerShard` was renamed to
|
||||
`max_sessions_per_shard`. The old names will continue to work as
|
||||
keyword parameters for a period of time.
|
||||
The parameter `stmtcachesize` was added. For consistency and
|
||||
compliance with the PEP 8 naming style, the parameter `waitTimeout` was
|
||||
renamed to `wait_timeout`, the parameter `maxLifetimeSession` was
|
||||
renamed to `max_lifetime_session`, the parameter `sessionCallback` was
|
||||
renamed to `session_callback` and the parameter `maxSessionsPerShard`
|
||||
was renamed to `max_sessions_per_shard`. The old names will continue to
|
||||
work as keyword parameters for a period of time.
|
||||
|
||||
|
||||
.. function:: Time(hour, minute, second)
|
||||
|
||||
@ -17,6 +17,10 @@ Version 8.2 (TBD)
|
||||
:meth:`SodaCollection.insertManyAndGet()` and
|
||||
:meth:`SodaCollection.saveAndGet()`. All of these require Oracle Client
|
||||
21.3 or higher (or Oracle Client 19 from 19.11).
|
||||
#) Added parameter `stmtcachesize` to :meth:`cx_Oracle.connect()` and
|
||||
:meth:`cx_Oracle.SessionPool()` in order to permit specifying the size of
|
||||
the statement cache during the creation of pools and standalone
|
||||
connections.
|
||||
#) Eliminated memory leak when calling :meth:`SodaOperation.filter()` with a
|
||||
dictionary.
|
||||
#) The distributed transaction handle assosciated with the connection is now
|
||||
|
||||
@ -475,6 +475,7 @@ static int cxoConnection_init(cxoConnection *conn, PyObject *args,
|
||||
dpiCommonCreateParams dpiCommonParams;
|
||||
dpiConnCreateParams dpiCreateParams;
|
||||
unsigned long long externalHandle;
|
||||
unsigned int stmtCacheSize;
|
||||
cxoConnectionParams params;
|
||||
PyObject *newPasswordObj;
|
||||
cxoSessionPool *pool;
|
||||
@ -483,7 +484,8 @@ static int cxoConnection_init(cxoConnection *conn, PyObject *args,
|
||||
static char *keywordList[] = { "user", "password", "dsn", "mode",
|
||||
"handle", "pool", "threaded", "events", "cclass", "purity",
|
||||
"newpassword", "encoding", "nencoding", "edition", "appcontext",
|
||||
"tag", "matchanytag", "shardingkey", "supershardingkey", NULL };
|
||||
"tag", "matchanytag", "shardingkey", "supershardingkey",
|
||||
"stmtcachesize", NULL };
|
||||
|
||||
// parse arguments
|
||||
pool = NULL;
|
||||
@ -492,6 +494,7 @@ static int cxoConnection_init(cxoConnection *conn, PyObject *args,
|
||||
passwordObj = dsnObj = cclassObj = editionObj = NULL;
|
||||
threadedObj = eventsObj = newPasswordObj = usernameObj = NULL;
|
||||
matchAnyTagObj = contextObj = shardingKeyObj = superShardingKeyObj = NULL;
|
||||
stmtCacheSize = DPI_DEFAULT_STMT_CACHE_SIZE;
|
||||
if (cxoUtils_initializeDPI(NULL) < 0)
|
||||
return -1;
|
||||
if (dpiContext_initCommonCreateParams(cxoDpiContext, &dpiCommonParams) < 0)
|
||||
@ -499,13 +502,13 @@ static int cxoConnection_init(cxoConnection *conn, PyObject *args,
|
||||
if (dpiContext_initConnCreateParams(cxoDpiContext, &dpiCreateParams) < 0)
|
||||
return cxoError_raiseAndReturnInt();
|
||||
if (!PyArg_ParseTupleAndKeywords(args, keywordArgs,
|
||||
"|OOOiKO!OOOiOssOOOOOO", keywordList, &usernameObj, &passwordObj,
|
||||
"|OOOiKO!OOOiOssOOOOOOI", keywordList, &usernameObj, &passwordObj,
|
||||
&dsnObj, &dpiCreateParams.authMode, &externalHandle,
|
||||
&cxoPyTypeSessionPool, &pool, &threadedObj, &eventsObj, &cclassObj,
|
||||
&dpiCreateParams.purity, &newPasswordObj,
|
||||
&dpiCommonParams.encoding, &dpiCommonParams.nencoding, &editionObj,
|
||||
&contextObj, &tagObj, &matchAnyTagObj, &shardingKeyObj,
|
||||
&superShardingKeyObj))
|
||||
&superShardingKeyObj, &stmtCacheSize))
|
||||
return -1;
|
||||
dpiCreateParams.externalHandle = (void*) externalHandle;
|
||||
if (cxoUtils_getBooleanValue(threadedObj, 0, &temp) < 0)
|
||||
@ -593,6 +596,7 @@ static int cxoConnection_init(cxoConnection *conn, PyObject *args,
|
||||
dpiCreateParams.newPasswordLength = params.newPasswordBuffer.size;
|
||||
dpiCommonParams.edition = params.editionBuffer.ptr;
|
||||
dpiCommonParams.editionLength = params.editionBuffer.size;
|
||||
dpiCommonParams.stmtCacheSize = stmtCacheSize;
|
||||
dpiCreateParams.tag = params.tagBuffer.ptr;
|
||||
dpiCreateParams.tagLength = params.tagBuffer.size;
|
||||
dpiCreateParams.appContext = params.appContext;
|
||||
|
||||
@ -43,6 +43,7 @@ static int cxoSessionPool_init(cxoSessionPool *pool, PyObject *args,
|
||||
dpiPoolCreateParams dpiCreateParams;
|
||||
cxoBuffer sessionCallbackBuffer;
|
||||
PyTypeObject *connectionType;
|
||||
unsigned int stmtCacheSize;
|
||||
const char *encoding;
|
||||
int status, temp;
|
||||
|
||||
@ -51,9 +52,9 @@ static int cxoSessionPool_init(cxoSessionPool *pool, PyObject *args,
|
||||
"increment", "connectiontype", "threaded", "getmode", "events",
|
||||
"homogeneous", "externalauth", "encoding", "nencoding", "edition",
|
||||
"timeout", "wait_timeout", "max_lifetime_session",
|
||||
"session_callback", "max_sessions_per_shard", "waitTimeout",
|
||||
"maxLifetimeSession", "sessionCallback", "maxSessionsPerShard",
|
||||
NULL };
|
||||
"session_callback", "max_sessions_per_shard", "stmtcachesize",
|
||||
"waitTimeout", "maxLifetimeSession", "sessionCallback",
|
||||
"maxSessionsPerShard", NULL };
|
||||
|
||||
// parse arguments and keywords
|
||||
usernameObj = passwordObj = dsnObj = editionObj = Py_None;
|
||||
@ -66,6 +67,7 @@ static int cxoSessionPool_init(cxoSessionPool *pool, PyObject *args,
|
||||
maxSessionsPerShard = maxSessionsPerShardDeprecated = 0;
|
||||
waitTimeoutDeprecated = maxLifetimeSessionDeprecated = 0;
|
||||
maxSessionsPerShardDeprecated = 0;
|
||||
stmtCacheSize = DPI_DEFAULT_STMT_CACHE_SIZE;
|
||||
if (cxoUtils_initializeDPI(NULL) < 0)
|
||||
return -1;
|
||||
if (dpiContext_initCommonCreateParams(cxoDpiContext, &dpiCommonParams) < 0)
|
||||
@ -73,16 +75,16 @@ static int cxoSessionPool_init(cxoSessionPool *pool, PyObject *args,
|
||||
if (dpiContext_initPoolCreateParams(cxoDpiContext, &dpiCreateParams) < 0)
|
||||
return cxoError_raiseAndReturnInt();
|
||||
if (!PyArg_ParseTupleAndKeywords(args, keywordArgs,
|
||||
"|OOOiiiOObOOOssOiiiOiiiOi", keywordList, &usernameObj,
|
||||
"|OOOiiiOObOOOssOiiiOiIiiOi", keywordList, &usernameObj,
|
||||
&passwordObj, &dsnObj, &minSessions, &maxSessions,
|
||||
&sessionIncrement, &connectionType, &threadedObj,
|
||||
&dpiCreateParams.getMode, &eventsObj, &homogeneousObj,
|
||||
&externalAuthObj, &dpiCommonParams.encoding,
|
||||
&dpiCommonParams.nencoding, &editionObj, &dpiCreateParams.timeout,
|
||||
&dpiCreateParams.waitTimeout, &dpiCreateParams.maxLifetimeSession,
|
||||
&sessionCallbackObj, &maxSessionsPerShard, &waitTimeoutDeprecated,
|
||||
&maxLifetimeSessionDeprecated, &sessionCallbackObjDeprecated,
|
||||
&maxSessionsPerShardDeprecated))
|
||||
&sessionCallbackObj, &maxSessionsPerShard, &stmtCacheSize,
|
||||
&waitTimeoutDeprecated, &maxLifetimeSessionDeprecated,
|
||||
&sessionCallbackObjDeprecated, &maxSessionsPerShardDeprecated))
|
||||
return -1;
|
||||
if (!PyType_Check(connectionType)) {
|
||||
cxoError_raiseFromString(cxoProgrammingErrorException,
|
||||
@ -190,6 +192,7 @@ static int cxoSessionPool_init(cxoSessionPool *pool, PyObject *args,
|
||||
dpiCreateParams.maxSessionsPerShard = maxSessionsPerShard;
|
||||
dpiCommonParams.edition = editionBuffer.ptr;
|
||||
dpiCommonParams.editionLength = editionBuffer.size;
|
||||
dpiCommonParams.stmtCacheSize = stmtCacheSize;
|
||||
|
||||
// create pool
|
||||
Py_BEGIN_ALLOW_THREADS
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user