Move declaration of Python types, methods and members to the end of the file in
order to avoid unnecessary forward declarations.
This commit is contained in:
parent
dd492591a3
commit
96f15f48da
@ -10,36 +10,6 @@
|
||||
|
||||
#include "cxoModule.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of functions
|
||||
//-----------------------------------------------------------------------------
|
||||
static void cxoApiType_free(cxoApiType*);
|
||||
static PyObject *cxoApiType_repr(cxoApiType*);
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of members
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyMemberDef cxoMembers[] = {
|
||||
{ "name", T_STRING, offsetof(cxoApiType, name), READONLY },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Python type declaration
|
||||
//-----------------------------------------------------------------------------
|
||||
PyTypeObject cxoPyTypeApiType = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
.tp_name = "cx_Oracle.ApiType",
|
||||
.tp_basicsize = sizeof(cxoApiType),
|
||||
.tp_dealloc = (destructor) cxoApiType_free,
|
||||
.tp_repr = (reprfunc) cxoApiType_repr,
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT,
|
||||
.tp_members = cxoMembers
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// cxoApiType_free()
|
||||
// Free the API type object.
|
||||
@ -74,3 +44,26 @@ static PyObject *cxoApiType_repr(cxoApiType *apiType)
|
||||
Py_DECREF(apiTypeName);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of members
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyMemberDef cxoMembers[] = {
|
||||
{ "name", T_STRING, offsetof(cxoApiType, name), READONLY },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Python type declaration
|
||||
//-----------------------------------------------------------------------------
|
||||
PyTypeObject cxoPyTypeApiType = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
.tp_name = "cx_Oracle.ApiType",
|
||||
.tp_basicsize = sizeof(cxoApiType),
|
||||
.tp_dealloc = (destructor) cxoApiType_free,
|
||||
.tp_repr = (reprfunc) cxoApiType_repr,
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT,
|
||||
.tp_members = cxoMembers
|
||||
};
|
||||
|
||||
@ -14,198 +14,6 @@
|
||||
|
||||
#include "cxoModule.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// functions for the Python type "Connection"
|
||||
//-----------------------------------------------------------------------------
|
||||
static void cxoConnection_free(cxoConnection*);
|
||||
static PyObject *cxoConnection_new(PyTypeObject*, PyObject*, PyObject*);
|
||||
static int cxoConnection_init(cxoConnection*, PyObject*, PyObject*);
|
||||
static PyObject *cxoConnection_repr(cxoConnection*);
|
||||
static PyObject *cxoConnection_close(cxoConnection*, PyObject*);
|
||||
static PyObject *cxoConnection_commit(cxoConnection*, PyObject*);
|
||||
static PyObject *cxoConnection_begin(cxoConnection*, PyObject*);
|
||||
static PyObject *cxoConnection_prepare(cxoConnection*, PyObject*);
|
||||
static PyObject *cxoConnection_rollback(cxoConnection*, PyObject*);
|
||||
static PyObject *cxoConnection_newCursor(cxoConnection*, PyObject*, PyObject*);
|
||||
static PyObject *cxoConnection_cancel(cxoConnection*, PyObject*);
|
||||
static PyObject *cxoConnection_getCallTimeout(cxoConnection*, void*);
|
||||
static PyObject *cxoConnection_getVersion(cxoConnection*, void*);
|
||||
static PyObject *cxoConnection_getEncoding(cxoConnection*, void*);
|
||||
static PyObject *cxoConnection_getNationalEncoding(cxoConnection*, void*);
|
||||
static PyObject *cxoConnection_getMaxBytesPerCharacter(cxoConnection*, void*);
|
||||
static PyObject *cxoConnection_contextManagerEnter(cxoConnection*, PyObject*);
|
||||
static PyObject *cxoConnection_contextManagerExit(cxoConnection*, PyObject*);
|
||||
static PyObject *cxoConnection_changePassword(cxoConnection*, PyObject*);
|
||||
static PyObject *cxoConnection_getType(cxoConnection*, PyObject*);
|
||||
static PyObject *cxoConnection_createLob(cxoConnection*, PyObject*);
|
||||
static PyObject *cxoConnection_getStmtCacheSize(cxoConnection*, void*);
|
||||
static PyObject *cxoConnection_newEnqueueOptions(cxoConnection*, PyObject*);
|
||||
static PyObject *cxoConnection_newDequeueOptions(cxoConnection*, PyObject*);
|
||||
static PyObject *cxoConnection_newMessageProperties(cxoConnection*, PyObject*,
|
||||
PyObject*);
|
||||
static PyObject *cxoConnection_dequeue(cxoConnection*, PyObject*, PyObject*);
|
||||
static PyObject *cxoConnection_enqueue(cxoConnection*, PyObject*, PyObject*);
|
||||
static PyObject *cxoConnection_ping(cxoConnection*, PyObject*);
|
||||
static PyObject *cxoConnection_queue(cxoConnection*, PyObject*, PyObject*);
|
||||
static PyObject *cxoConnection_shutdown(cxoConnection*, PyObject*, PyObject*);
|
||||
static PyObject *cxoConnection_startup(cxoConnection*, PyObject*, PyObject*);
|
||||
static PyObject *cxoConnection_subscribe(cxoConnection*, PyObject*, PyObject*);
|
||||
static PyObject *cxoConnection_unsubscribe(cxoConnection*, PyObject*,
|
||||
PyObject*);
|
||||
static PyObject *cxoConnection_getSodaDatabase(cxoConnection*, PyObject*);
|
||||
static PyObject *cxoConnection_getLTXID(cxoConnection*, void*);
|
||||
static PyObject *cxoConnection_getHandle(cxoConnection*, void*);
|
||||
static PyObject *cxoConnection_getCurrentSchema(cxoConnection*, void*);
|
||||
static PyObject *cxoConnection_getEdition(cxoConnection*, void*);
|
||||
static PyObject *cxoConnection_getExternalName(cxoConnection*, void*);
|
||||
static PyObject *cxoConnection_getInternalName(cxoConnection*, void*);
|
||||
static PyObject *cxoConnection_getException(cxoConnection*, void*);
|
||||
static int cxoConnection_setCallTimeout(cxoConnection*, PyObject*, void*);
|
||||
static int cxoConnection_setStmtCacheSize(cxoConnection*, PyObject*, void*);
|
||||
static int cxoConnection_setAction(cxoConnection*, PyObject*, void*);
|
||||
static int cxoConnection_setClientIdentifier(cxoConnection*, PyObject*, void*);
|
||||
static int cxoConnection_setClientInfo(cxoConnection*, PyObject*, void*);
|
||||
static int cxoConnection_setCurrentSchema(cxoConnection*, PyObject*, void*);
|
||||
static int cxoConnection_setDbOp(cxoConnection*, PyObject*, void*);
|
||||
static int cxoConnection_setExternalName(cxoConnection*, PyObject*, void*);
|
||||
static int cxoConnection_setInternalName(cxoConnection*, PyObject*, void*);
|
||||
static int cxoConnection_setModule(cxoConnection*, PyObject*, void*);
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of methods for Python type "Connection"
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyMethodDef cxoConnectionMethods[] = {
|
||||
{ "cursor", (PyCFunction) cxoConnection_newCursor,
|
||||
METH_VARARGS | METH_KEYWORDS },
|
||||
{ "commit", (PyCFunction) cxoConnection_commit, METH_NOARGS },
|
||||
{ "rollback", (PyCFunction) cxoConnection_rollback, METH_NOARGS },
|
||||
{ "begin", (PyCFunction) cxoConnection_begin, METH_VARARGS },
|
||||
{ "prepare", (PyCFunction) cxoConnection_prepare, METH_NOARGS },
|
||||
{ "close", (PyCFunction) cxoConnection_close, METH_NOARGS },
|
||||
{ "cancel", (PyCFunction) cxoConnection_cancel, METH_NOARGS },
|
||||
{ "__enter__", (PyCFunction) cxoConnection_contextManagerEnter,
|
||||
METH_NOARGS },
|
||||
{ "__exit__", (PyCFunction) cxoConnection_contextManagerExit,
|
||||
METH_VARARGS },
|
||||
{ "ping", (PyCFunction) cxoConnection_ping, METH_NOARGS },
|
||||
{ "shutdown", (PyCFunction) cxoConnection_shutdown,
|
||||
METH_VARARGS | METH_KEYWORDS},
|
||||
{ "startup", (PyCFunction) cxoConnection_startup,
|
||||
METH_VARARGS | METH_KEYWORDS},
|
||||
{ "subscribe", (PyCFunction) cxoConnection_subscribe,
|
||||
METH_VARARGS | METH_KEYWORDS},
|
||||
{ "unsubscribe", (PyCFunction) cxoConnection_unsubscribe,
|
||||
METH_VARARGS | METH_KEYWORDS},
|
||||
{ "changepassword", (PyCFunction) cxoConnection_changePassword,
|
||||
METH_VARARGS },
|
||||
{ "gettype", (PyCFunction) cxoConnection_getType, METH_O },
|
||||
{ "deqoptions", (PyCFunction) cxoConnection_newDequeueOptions,
|
||||
METH_NOARGS },
|
||||
{ "enqoptions", (PyCFunction) cxoConnection_newEnqueueOptions,
|
||||
METH_NOARGS },
|
||||
{ "msgproperties", (PyCFunction) cxoConnection_newMessageProperties,
|
||||
METH_VARARGS | METH_KEYWORDS },
|
||||
{ "deq", (PyCFunction) cxoConnection_dequeue,
|
||||
METH_VARARGS | METH_KEYWORDS },
|
||||
{ "enq", (PyCFunction) cxoConnection_enqueue,
|
||||
METH_VARARGS | METH_KEYWORDS },
|
||||
{ "queue", (PyCFunction) cxoConnection_queue,
|
||||
METH_VARARGS | METH_KEYWORDS },
|
||||
{ "createlob", (PyCFunction) cxoConnection_createLob, METH_O },
|
||||
{ "getSodaDatabase", (PyCFunction) cxoConnection_getSodaDatabase,
|
||||
METH_NOARGS },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of members for Python type "Connection"
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyMemberDef cxoConnectionMembers[] = {
|
||||
{ "username", T_OBJECT, offsetof(cxoConnection, username), READONLY },
|
||||
{ "dsn", T_OBJECT, offsetof(cxoConnection, dsn), READONLY },
|
||||
{ "tnsentry", T_OBJECT, offsetof(cxoConnection, dsn), READONLY },
|
||||
{ "tag", T_OBJECT, offsetof(cxoConnection, tag), 0 },
|
||||
{ "autocommit", T_INT, offsetof(cxoConnection, autocommit), 0 },
|
||||
{ "inputtypehandler", T_OBJECT,
|
||||
offsetof(cxoConnection, inputTypeHandler), 0 },
|
||||
{ "outputtypehandler", T_OBJECT,
|
||||
offsetof(cxoConnection, outputTypeHandler), 0 },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of calculated members for Python type "Connection"
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyGetSetDef cxoConnectionCalcMembers[] = {
|
||||
{ "version", (getter) cxoConnection_getVersion, 0, 0, 0 },
|
||||
{ "encoding", (getter) cxoConnection_getEncoding, 0, 0, 0 },
|
||||
{ "nencoding", (getter) cxoConnection_getNationalEncoding, 0, 0, 0 },
|
||||
{ "callTimeout", (getter) cxoConnection_getCallTimeout,
|
||||
(setter) cxoConnection_setCallTimeout, 0, 0 },
|
||||
{ "maxBytesPerCharacter", (getter) cxoConnection_getMaxBytesPerCharacter,
|
||||
0, 0, 0 },
|
||||
{ "stmtcachesize", (getter) cxoConnection_getStmtCacheSize,
|
||||
(setter) cxoConnection_setStmtCacheSize, 0, 0 },
|
||||
{ "module", 0, (setter) cxoConnection_setModule, 0, 0 },
|
||||
{ "action", 0, (setter) cxoConnection_setAction, 0, 0 },
|
||||
{ "clientinfo", 0, (setter) cxoConnection_setClientInfo, 0, 0 },
|
||||
{ "client_identifier", 0, (setter) cxoConnection_setClientIdentifier, 0,
|
||||
0 },
|
||||
{ "current_schema", (getter) cxoConnection_getCurrentSchema,
|
||||
(setter) cxoConnection_setCurrentSchema, 0, 0 },
|
||||
{ "external_name", (getter) cxoConnection_getExternalName,
|
||||
(setter) cxoConnection_setExternalName, 0, 0 },
|
||||
{ "internal_name", (getter) cxoConnection_getInternalName,
|
||||
(setter) cxoConnection_setInternalName, 0, 0 },
|
||||
{ "dbop", 0, (setter) cxoConnection_setDbOp, 0, 0 },
|
||||
{ "edition", (getter) cxoConnection_getEdition, 0, 0, 0 },
|
||||
{ "ltxid", (getter) cxoConnection_getLTXID, 0, 0, 0 },
|
||||
{ "handle", (getter) cxoConnection_getHandle, 0, 0, 0 },
|
||||
{ "Error", (getter) cxoConnection_getException, NULL, NULL,
|
||||
&cxoErrorException },
|
||||
{ "Warning", (getter) cxoConnection_getException, NULL, NULL,
|
||||
&cxoWarningException },
|
||||
{ "InterfaceError", (getter) cxoConnection_getException, NULL, NULL,
|
||||
&cxoInterfaceErrorException },
|
||||
{ "DatabaseError", (getter) cxoConnection_getException, NULL, NULL,
|
||||
&cxoDatabaseErrorException },
|
||||
{ "InternalError", (getter) cxoConnection_getException, NULL, NULL,
|
||||
&cxoInternalErrorException },
|
||||
{ "OperationalError", (getter) cxoConnection_getException, NULL, NULL,
|
||||
&cxoOperationalErrorException },
|
||||
{ "ProgrammingError", (getter) cxoConnection_getException, NULL, NULL,
|
||||
&cxoProgrammingErrorException },
|
||||
{ "IntegrityError", (getter) cxoConnection_getException, NULL, NULL,
|
||||
&cxoIntegrityErrorException },
|
||||
{ "DataError", (getter) cxoConnection_getException, NULL, NULL,
|
||||
&cxoDataErrorException },
|
||||
{ "NotSupportedError", (getter) cxoConnection_getException, NULL, NULL,
|
||||
&cxoNotSupportedErrorException },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of Python type
|
||||
//-----------------------------------------------------------------------------
|
||||
PyTypeObject cxoPyTypeConnection = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
.tp_name = "cx_Oracle.Connection",
|
||||
.tp_basicsize = sizeof(cxoConnection),
|
||||
.tp_dealloc = (destructor) cxoConnection_free,
|
||||
.tp_repr = (reprfunc) cxoConnection_repr,
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
|
||||
.tp_methods = cxoConnectionMethods,
|
||||
.tp_members = cxoConnectionMembers,
|
||||
.tp_getset = cxoConnectionCalcMembers,
|
||||
.tp_init = (initproc) cxoConnection_init,
|
||||
.tp_new = (newfunc) cxoConnection_new
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// structure used to help in establishing a connection
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -2007,3 +1815,137 @@ static int cxoConnection_setModule(cxoConnection* conn, PyObject *value,
|
||||
{
|
||||
return cxoConnection_setAttrText(conn, value, dpiConn_setModule);
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of methods for the Python type
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyMethodDef cxoMethods[] = {
|
||||
{ "cursor", (PyCFunction) cxoConnection_newCursor,
|
||||
METH_VARARGS | METH_KEYWORDS },
|
||||
{ "commit", (PyCFunction) cxoConnection_commit, METH_NOARGS },
|
||||
{ "rollback", (PyCFunction) cxoConnection_rollback, METH_NOARGS },
|
||||
{ "begin", (PyCFunction) cxoConnection_begin, METH_VARARGS },
|
||||
{ "prepare", (PyCFunction) cxoConnection_prepare, METH_NOARGS },
|
||||
{ "close", (PyCFunction) cxoConnection_close, METH_NOARGS },
|
||||
{ "cancel", (PyCFunction) cxoConnection_cancel, METH_NOARGS },
|
||||
{ "__enter__", (PyCFunction) cxoConnection_contextManagerEnter,
|
||||
METH_NOARGS },
|
||||
{ "__exit__", (PyCFunction) cxoConnection_contextManagerExit,
|
||||
METH_VARARGS },
|
||||
{ "ping", (PyCFunction) cxoConnection_ping, METH_NOARGS },
|
||||
{ "shutdown", (PyCFunction) cxoConnection_shutdown,
|
||||
METH_VARARGS | METH_KEYWORDS},
|
||||
{ "startup", (PyCFunction) cxoConnection_startup,
|
||||
METH_VARARGS | METH_KEYWORDS},
|
||||
{ "subscribe", (PyCFunction) cxoConnection_subscribe,
|
||||
METH_VARARGS | METH_KEYWORDS},
|
||||
{ "unsubscribe", (PyCFunction) cxoConnection_unsubscribe,
|
||||
METH_VARARGS | METH_KEYWORDS},
|
||||
{ "changepassword", (PyCFunction) cxoConnection_changePassword,
|
||||
METH_VARARGS },
|
||||
{ "gettype", (PyCFunction) cxoConnection_getType, METH_O },
|
||||
{ "deqoptions", (PyCFunction) cxoConnection_newDequeueOptions,
|
||||
METH_NOARGS },
|
||||
{ "enqoptions", (PyCFunction) cxoConnection_newEnqueueOptions,
|
||||
METH_NOARGS },
|
||||
{ "msgproperties", (PyCFunction) cxoConnection_newMessageProperties,
|
||||
METH_VARARGS | METH_KEYWORDS },
|
||||
{ "deq", (PyCFunction) cxoConnection_dequeue,
|
||||
METH_VARARGS | METH_KEYWORDS },
|
||||
{ "enq", (PyCFunction) cxoConnection_enqueue,
|
||||
METH_VARARGS | METH_KEYWORDS },
|
||||
{ "queue", (PyCFunction) cxoConnection_queue,
|
||||
METH_VARARGS | METH_KEYWORDS },
|
||||
{ "createlob", (PyCFunction) cxoConnection_createLob, METH_O },
|
||||
{ "getSodaDatabase", (PyCFunction) cxoConnection_getSodaDatabase,
|
||||
METH_NOARGS },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of members for the Python type
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyMemberDef cxoMembers[] = {
|
||||
{ "username", T_OBJECT, offsetof(cxoConnection, username), READONLY },
|
||||
{ "dsn", T_OBJECT, offsetof(cxoConnection, dsn), READONLY },
|
||||
{ "tnsentry", T_OBJECT, offsetof(cxoConnection, dsn), READONLY },
|
||||
{ "tag", T_OBJECT, offsetof(cxoConnection, tag), 0 },
|
||||
{ "autocommit", T_INT, offsetof(cxoConnection, autocommit), 0 },
|
||||
{ "inputtypehandler", T_OBJECT,
|
||||
offsetof(cxoConnection, inputTypeHandler), 0 },
|
||||
{ "outputtypehandler", T_OBJECT,
|
||||
offsetof(cxoConnection, outputTypeHandler), 0 },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of calculated members for the Python type
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyGetSetDef cxoCalcMembers[] = {
|
||||
{ "version", (getter) cxoConnection_getVersion, 0, 0, 0 },
|
||||
{ "encoding", (getter) cxoConnection_getEncoding, 0, 0, 0 },
|
||||
{ "nencoding", (getter) cxoConnection_getNationalEncoding, 0, 0, 0 },
|
||||
{ "callTimeout", (getter) cxoConnection_getCallTimeout,
|
||||
(setter) cxoConnection_setCallTimeout, 0, 0 },
|
||||
{ "maxBytesPerCharacter", (getter) cxoConnection_getMaxBytesPerCharacter,
|
||||
0, 0, 0 },
|
||||
{ "stmtcachesize", (getter) cxoConnection_getStmtCacheSize,
|
||||
(setter) cxoConnection_setStmtCacheSize, 0, 0 },
|
||||
{ "module", 0, (setter) cxoConnection_setModule, 0, 0 },
|
||||
{ "action", 0, (setter) cxoConnection_setAction, 0, 0 },
|
||||
{ "clientinfo", 0, (setter) cxoConnection_setClientInfo, 0, 0 },
|
||||
{ "client_identifier", 0, (setter) cxoConnection_setClientIdentifier, 0,
|
||||
0 },
|
||||
{ "current_schema", (getter) cxoConnection_getCurrentSchema,
|
||||
(setter) cxoConnection_setCurrentSchema, 0, 0 },
|
||||
{ "external_name", (getter) cxoConnection_getExternalName,
|
||||
(setter) cxoConnection_setExternalName, 0, 0 },
|
||||
{ "internal_name", (getter) cxoConnection_getInternalName,
|
||||
(setter) cxoConnection_setInternalName, 0, 0 },
|
||||
{ "dbop", 0, (setter) cxoConnection_setDbOp, 0, 0 },
|
||||
{ "edition", (getter) cxoConnection_getEdition, 0, 0, 0 },
|
||||
{ "ltxid", (getter) cxoConnection_getLTXID, 0, 0, 0 },
|
||||
{ "handle", (getter) cxoConnection_getHandle, 0, 0, 0 },
|
||||
{ "Error", (getter) cxoConnection_getException, NULL, NULL,
|
||||
&cxoErrorException },
|
||||
{ "Warning", (getter) cxoConnection_getException, NULL, NULL,
|
||||
&cxoWarningException },
|
||||
{ "InterfaceError", (getter) cxoConnection_getException, NULL, NULL,
|
||||
&cxoInterfaceErrorException },
|
||||
{ "DatabaseError", (getter) cxoConnection_getException, NULL, NULL,
|
||||
&cxoDatabaseErrorException },
|
||||
{ "InternalError", (getter) cxoConnection_getException, NULL, NULL,
|
||||
&cxoInternalErrorException },
|
||||
{ "OperationalError", (getter) cxoConnection_getException, NULL, NULL,
|
||||
&cxoOperationalErrorException },
|
||||
{ "ProgrammingError", (getter) cxoConnection_getException, NULL, NULL,
|
||||
&cxoProgrammingErrorException },
|
||||
{ "IntegrityError", (getter) cxoConnection_getException, NULL, NULL,
|
||||
&cxoIntegrityErrorException },
|
||||
{ "DataError", (getter) cxoConnection_getException, NULL, NULL,
|
||||
&cxoDataErrorException },
|
||||
{ "NotSupportedError", (getter) cxoConnection_getException, NULL, NULL,
|
||||
&cxoNotSupportedErrorException },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of the Python type
|
||||
//-----------------------------------------------------------------------------
|
||||
PyTypeObject cxoPyTypeConnection = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
.tp_name = "cx_Oracle.Connection",
|
||||
.tp_basicsize = sizeof(cxoConnection),
|
||||
.tp_dealloc = (destructor) cxoConnection_free,
|
||||
.tp_repr = (reprfunc) cxoConnection_repr,
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
|
||||
.tp_methods = cxoMethods,
|
||||
.tp_members = cxoMembers,
|
||||
.tp_getset = cxoCalcMembers,
|
||||
.tp_init = (initproc) cxoConnection_init,
|
||||
.tp_new = (newfunc) cxoConnection_new
|
||||
};
|
||||
|
||||
297
src/cxoCursor.c
297
src/cxoCursor.c
@ -14,139 +14,6 @@
|
||||
|
||||
#include "cxoModule.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// functions for the Python type "Cursor"
|
||||
//-----------------------------------------------------------------------------
|
||||
static void cxoCursor_free(cxoCursor*);
|
||||
static PyObject *cxoCursor_getIter(cxoCursor*);
|
||||
static PyObject *cxoCursor_getNext(cxoCursor*);
|
||||
static PyObject *cxoCursor_close(cxoCursor*, PyObject*);
|
||||
static PyObject *cxoCursor_callFunc(cxoCursor*, PyObject*, PyObject*);
|
||||
static PyObject *cxoCursor_callProc(cxoCursor*, PyObject*, PyObject*);
|
||||
static PyObject *cxoCursor_execute(cxoCursor*, PyObject*, PyObject*);
|
||||
static PyObject *cxoCursor_executeMany(cxoCursor*, PyObject*, PyObject*);
|
||||
static PyObject *cxoCursor_executeManyPrepared(cxoCursor*, PyObject*);
|
||||
static PyObject *cxoCursor_fetchOne(cxoCursor*, PyObject*);
|
||||
static PyObject *cxoCursor_fetchMany(cxoCursor*, PyObject*, PyObject*);
|
||||
static PyObject *cxoCursor_fetchAll(cxoCursor*, PyObject*);
|
||||
static PyObject *cxoCursor_fetchRaw(cxoCursor*, PyObject*, PyObject*);
|
||||
static PyObject *cxoCursor_parse(cxoCursor*, PyObject*);
|
||||
static PyObject *cxoCursor_prepare(cxoCursor*, PyObject*);
|
||||
static PyObject *cxoCursor_scroll(cxoCursor*, PyObject*, PyObject*);
|
||||
static PyObject *cxoCursor_setInputSizes(cxoCursor*, PyObject*, PyObject*);
|
||||
static PyObject *cxoCursor_setOutputSize(cxoCursor*, PyObject*);
|
||||
static PyObject *cxoCursor_var(cxoCursor*, PyObject*, PyObject*);
|
||||
static PyObject *cxoCursor_arrayVar(cxoCursor*, PyObject*);
|
||||
static PyObject *cxoCursor_bindNames(cxoCursor*, PyObject*);
|
||||
static PyObject *cxoCursor_getDescription(cxoCursor*, void*);
|
||||
static PyObject *cxoCursor_getLastRowid(cxoCursor*, void*);
|
||||
static PyObject *cxoCursor_getPrefetchRows(cxoCursor*, void*);
|
||||
static PyObject *cxoCursor_new(PyTypeObject*, PyObject*, PyObject*);
|
||||
static int cxoCursor_init(cxoCursor*, PyObject*, PyObject*);
|
||||
static PyObject *cxoCursor_repr(cxoCursor*);
|
||||
static PyObject* cxoCursor_getBatchErrors(cxoCursor*);
|
||||
static PyObject *cxoCursor_getArrayDMLRowCounts(cxoCursor*);
|
||||
static PyObject *cxoCursor_getImplicitResults(cxoCursor*);
|
||||
static PyObject *cxoCursor_contextManagerEnter(cxoCursor*, PyObject*);
|
||||
static PyObject *cxoCursor_contextManagerExit(cxoCursor*, PyObject*);
|
||||
static int cxoCursor_performDefine(cxoCursor*, uint32_t);
|
||||
static int cxoCursor_setPrefetchRows(cxoCursor*, PyObject*, void*);
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of methods for Python type
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyMethodDef cxoCursorMethods[] = {
|
||||
{ "execute", (PyCFunction) cxoCursor_execute,
|
||||
METH_VARARGS | METH_KEYWORDS },
|
||||
{ "fetchall", (PyCFunction) cxoCursor_fetchAll, METH_NOARGS },
|
||||
{ "fetchone", (PyCFunction) cxoCursor_fetchOne, METH_NOARGS },
|
||||
{ "fetchmany", (PyCFunction) cxoCursor_fetchMany,
|
||||
METH_VARARGS | METH_KEYWORDS },
|
||||
{ "fetchraw", (PyCFunction) cxoCursor_fetchRaw,
|
||||
METH_VARARGS | METH_KEYWORDS },
|
||||
{ "prepare", (PyCFunction) cxoCursor_prepare, METH_VARARGS },
|
||||
{ "parse", (PyCFunction) cxoCursor_parse, METH_O },
|
||||
{ "setinputsizes", (PyCFunction) cxoCursor_setInputSizes,
|
||||
METH_VARARGS | METH_KEYWORDS },
|
||||
{ "executemany", (PyCFunction) cxoCursor_executeMany,
|
||||
METH_VARARGS | METH_KEYWORDS },
|
||||
{ "callproc", (PyCFunction) cxoCursor_callProc,
|
||||
METH_VARARGS | METH_KEYWORDS },
|
||||
{ "callfunc", (PyCFunction) cxoCursor_callFunc,
|
||||
METH_VARARGS | METH_KEYWORDS },
|
||||
{ "executemanyprepared", (PyCFunction) cxoCursor_executeManyPrepared,
|
||||
METH_VARARGS },
|
||||
{ "setoutputsize", (PyCFunction) cxoCursor_setOutputSize, METH_VARARGS },
|
||||
{ "scroll", (PyCFunction) cxoCursor_scroll, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "var", (PyCFunction) cxoCursor_var, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "arrayvar", (PyCFunction) cxoCursor_arrayVar, METH_VARARGS },
|
||||
{ "bindnames", (PyCFunction) cxoCursor_bindNames, METH_NOARGS },
|
||||
{ "close", (PyCFunction) cxoCursor_close, METH_NOARGS },
|
||||
{ "getbatcherrors", (PyCFunction) cxoCursor_getBatchErrors, METH_NOARGS },
|
||||
{ "getarraydmlrowcounts", (PyCFunction) cxoCursor_getArrayDMLRowCounts,
|
||||
METH_NOARGS },
|
||||
{ "getimplicitresults", (PyCFunction) cxoCursor_getImplicitResults,
|
||||
METH_NOARGS },
|
||||
{ "__enter__", (PyCFunction) cxoCursor_contextManagerEnter, METH_NOARGS },
|
||||
{ "__exit__", (PyCFunction) cxoCursor_contextManagerExit, METH_VARARGS },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of members for Python type
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyMemberDef cxoCursorMembers[] = {
|
||||
{ "arraysize", T_UINT, offsetof(cxoCursor, arraySize), 0 },
|
||||
{ "bindarraysize", T_UINT, offsetof(cxoCursor, bindArraySize), 0 },
|
||||
{ "rowcount", T_ULONGLONG, offsetof(cxoCursor, rowCount), READONLY },
|
||||
{ "statement", T_OBJECT, offsetof(cxoCursor, statement), READONLY },
|
||||
{ "connection", T_OBJECT_EX, offsetof(cxoCursor, connection), READONLY },
|
||||
{ "rowfactory", T_OBJECT, offsetof(cxoCursor, rowFactory), 0 },
|
||||
{ "bindvars", T_OBJECT, offsetof(cxoCursor, bindVariables), READONLY },
|
||||
{ "fetchvars", T_OBJECT, offsetof(cxoCursor, fetchVariables), READONLY },
|
||||
{ "inputtypehandler", T_OBJECT, offsetof(cxoCursor, inputTypeHandler),
|
||||
0 },
|
||||
{ "outputtypehandler", T_OBJECT, offsetof(cxoCursor, outputTypeHandler),
|
||||
0 },
|
||||
{ "scrollable", T_BOOL, offsetof(cxoCursor, isScrollable), 0 },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of calculated members for Python type
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyGetSetDef cxoCursorCalcMembers[] = {
|
||||
{ "description", (getter) cxoCursor_getDescription, 0, 0, 0 },
|
||||
{ "lastrowid", (getter) cxoCursor_getLastRowid, 0, 0, 0 },
|
||||
{ "prefetchrows", (getter) cxoCursor_getPrefetchRows,
|
||||
(setter) cxoCursor_setPrefetchRows, 0, 0 },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of Python type "Cursor"
|
||||
//-----------------------------------------------------------------------------
|
||||
PyTypeObject cxoPyTypeCursor = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
.tp_name = "cx_Oracle.Cursor",
|
||||
.tp_basicsize = sizeof(cxoCursor),
|
||||
.tp_dealloc = (destructor) cxoCursor_free,
|
||||
.tp_repr = (reprfunc) cxoCursor_repr,
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
|
||||
.tp_iter = (getiterfunc) cxoCursor_getIter,
|
||||
.tp_iternext = (iternextfunc) cxoCursor_getNext,
|
||||
.tp_methods = cxoCursorMethods,
|
||||
.tp_members = cxoCursorMembers,
|
||||
.tp_getset = cxoCursorCalcMembers,
|
||||
.tp_init = (initproc) cxoCursor_init,
|
||||
.tp_new = cxoCursor_new
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// cxoCursor_new()
|
||||
// Create a new cursor object.
|
||||
@ -254,41 +121,6 @@ static int cxoCursor_isOpen(cxoCursor *cursor)
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// cxoCursor_verifyFetch()
|
||||
// Verify that fetching may happen from this cursor.
|
||||
//-----------------------------------------------------------------------------
|
||||
static int cxoCursor_verifyFetch(cxoCursor *cursor)
|
||||
{
|
||||
uint32_t numQueryColumns;
|
||||
|
||||
// make sure the cursor is open
|
||||
if (cxoCursor_isOpen(cursor) < 0)
|
||||
return -1;
|
||||
|
||||
// fixup REF cursor, if applicable
|
||||
if (cursor->fixupRefCursor) {
|
||||
cursor->fetchArraySize = cursor->arraySize;
|
||||
if (dpiStmt_setFetchArraySize(cursor->handle,
|
||||
cursor->fetchArraySize) < 0)
|
||||
return cxoError_raiseAndReturnInt();
|
||||
if (dpiStmt_getNumQueryColumns(cursor->handle, &numQueryColumns) < 0)
|
||||
return cxoError_raiseAndReturnInt();
|
||||
if (cxoCursor_performDefine(cursor, numQueryColumns) < 0)
|
||||
return cxoError_raiseAndReturnInt();
|
||||
cursor->fixupRefCursor = 0;
|
||||
}
|
||||
|
||||
// make sure the cursor is for a query
|
||||
if (!cursor->fetchVariables) {
|
||||
cxoError_raiseFromString(cxoInterfaceErrorException, "not a query");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// cxoCursor_fetchRow()
|
||||
// Fetch a single row from the cursor. Internally the number of rows left in
|
||||
@ -453,6 +285,41 @@ static int cxoCursor_performDefine(cxoCursor *cursor, uint32_t numQueryColumns)
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// cxoCursor_verifyFetch()
|
||||
// Verify that fetching may happen from this cursor.
|
||||
//-----------------------------------------------------------------------------
|
||||
static int cxoCursor_verifyFetch(cxoCursor *cursor)
|
||||
{
|
||||
uint32_t numQueryColumns;
|
||||
|
||||
// make sure the cursor is open
|
||||
if (cxoCursor_isOpen(cursor) < 0)
|
||||
return -1;
|
||||
|
||||
// fixup REF cursor, if applicable
|
||||
if (cursor->fixupRefCursor) {
|
||||
cursor->fetchArraySize = cursor->arraySize;
|
||||
if (dpiStmt_setFetchArraySize(cursor->handle,
|
||||
cursor->fetchArraySize) < 0)
|
||||
return cxoError_raiseAndReturnInt();
|
||||
if (dpiStmt_getNumQueryColumns(cursor->handle, &numQueryColumns) < 0)
|
||||
return cxoError_raiseAndReturnInt();
|
||||
if (cxoCursor_performDefine(cursor, numQueryColumns) < 0)
|
||||
return cxoError_raiseAndReturnInt();
|
||||
cursor->fixupRefCursor = 0;
|
||||
}
|
||||
|
||||
// make sure the cursor is for a query
|
||||
if (!cursor->fetchVariables) {
|
||||
cxoError_raiseFromString(cxoInterfaceErrorException, "not a query");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// cxoCursor_itemDescription()
|
||||
// Return a tuple describing the item at the given position.
|
||||
@ -2239,3 +2106,97 @@ static int cxoCursor_setPrefetchRows(cxoCursor* cursor, PyObject *value,
|
||||
return cxoError_raiseAndReturnInt();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of methods for Python type
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyMethodDef cxoMethods[] = {
|
||||
{ "execute", (PyCFunction) cxoCursor_execute,
|
||||
METH_VARARGS | METH_KEYWORDS },
|
||||
{ "fetchall", (PyCFunction) cxoCursor_fetchAll, METH_NOARGS },
|
||||
{ "fetchone", (PyCFunction) cxoCursor_fetchOne, METH_NOARGS },
|
||||
{ "fetchmany", (PyCFunction) cxoCursor_fetchMany,
|
||||
METH_VARARGS | METH_KEYWORDS },
|
||||
{ "fetchraw", (PyCFunction) cxoCursor_fetchRaw,
|
||||
METH_VARARGS | METH_KEYWORDS },
|
||||
{ "prepare", (PyCFunction) cxoCursor_prepare, METH_VARARGS },
|
||||
{ "parse", (PyCFunction) cxoCursor_parse, METH_O },
|
||||
{ "setinputsizes", (PyCFunction) cxoCursor_setInputSizes,
|
||||
METH_VARARGS | METH_KEYWORDS },
|
||||
{ "executemany", (PyCFunction) cxoCursor_executeMany,
|
||||
METH_VARARGS | METH_KEYWORDS },
|
||||
{ "callproc", (PyCFunction) cxoCursor_callProc,
|
||||
METH_VARARGS | METH_KEYWORDS },
|
||||
{ "callfunc", (PyCFunction) cxoCursor_callFunc,
|
||||
METH_VARARGS | METH_KEYWORDS },
|
||||
{ "executemanyprepared", (PyCFunction) cxoCursor_executeManyPrepared,
|
||||
METH_VARARGS },
|
||||
{ "setoutputsize", (PyCFunction) cxoCursor_setOutputSize, METH_VARARGS },
|
||||
{ "scroll", (PyCFunction) cxoCursor_scroll, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "var", (PyCFunction) cxoCursor_var, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "arrayvar", (PyCFunction) cxoCursor_arrayVar, METH_VARARGS },
|
||||
{ "bindnames", (PyCFunction) cxoCursor_bindNames, METH_NOARGS },
|
||||
{ "close", (PyCFunction) cxoCursor_close, METH_NOARGS },
|
||||
{ "getbatcherrors", (PyCFunction) cxoCursor_getBatchErrors, METH_NOARGS },
|
||||
{ "getarraydmlrowcounts", (PyCFunction) cxoCursor_getArrayDMLRowCounts,
|
||||
METH_NOARGS },
|
||||
{ "getimplicitresults", (PyCFunction) cxoCursor_getImplicitResults,
|
||||
METH_NOARGS },
|
||||
{ "__enter__", (PyCFunction) cxoCursor_contextManagerEnter, METH_NOARGS },
|
||||
{ "__exit__", (PyCFunction) cxoCursor_contextManagerExit, METH_VARARGS },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of members for Python type
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyMemberDef cxoMembers[] = {
|
||||
{ "arraysize", T_UINT, offsetof(cxoCursor, arraySize), 0 },
|
||||
{ "bindarraysize", T_UINT, offsetof(cxoCursor, bindArraySize), 0 },
|
||||
{ "rowcount", T_ULONGLONG, offsetof(cxoCursor, rowCount), READONLY },
|
||||
{ "statement", T_OBJECT, offsetof(cxoCursor, statement), READONLY },
|
||||
{ "connection", T_OBJECT_EX, offsetof(cxoCursor, connection), READONLY },
|
||||
{ "rowfactory", T_OBJECT, offsetof(cxoCursor, rowFactory), 0 },
|
||||
{ "bindvars", T_OBJECT, offsetof(cxoCursor, bindVariables), READONLY },
|
||||
{ "fetchvars", T_OBJECT, offsetof(cxoCursor, fetchVariables), READONLY },
|
||||
{ "inputtypehandler", T_OBJECT, offsetof(cxoCursor, inputTypeHandler),
|
||||
0 },
|
||||
{ "outputtypehandler", T_OBJECT, offsetof(cxoCursor, outputTypeHandler),
|
||||
0 },
|
||||
{ "scrollable", T_BOOL, offsetof(cxoCursor, isScrollable), 0 },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of calculated members for Python type
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyGetSetDef cxoCalcMembers[] = {
|
||||
{ "description", (getter) cxoCursor_getDescription, 0, 0, 0 },
|
||||
{ "lastrowid", (getter) cxoCursor_getLastRowid, 0, 0, 0 },
|
||||
{ "prefetchrows", (getter) cxoCursor_getPrefetchRows,
|
||||
(setter) cxoCursor_setPrefetchRows, 0, 0 },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of Python type
|
||||
//-----------------------------------------------------------------------------
|
||||
PyTypeObject cxoPyTypeCursor = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
.tp_name = "cx_Oracle.Cursor",
|
||||
.tp_basicsize = sizeof(cxoCursor),
|
||||
.tp_dealloc = (destructor) cxoCursor_free,
|
||||
.tp_repr = (reprfunc) cxoCursor_repr,
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
|
||||
.tp_iter = (getiterfunc) cxoCursor_getIter,
|
||||
.tp_iternext = (iternextfunc) cxoCursor_getNext,
|
||||
.tp_methods = cxoMethods,
|
||||
.tp_members = cxoMembers,
|
||||
.tp_getset = cxoCalcMembers,
|
||||
.tp_init = (initproc) cxoCursor_init,
|
||||
.tp_new = cxoCursor_new
|
||||
};
|
||||
|
||||
@ -9,40 +9,6 @@
|
||||
|
||||
#include "cxoModule.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of functions
|
||||
//-----------------------------------------------------------------------------
|
||||
static void cxoDbType_free(cxoDbType*);
|
||||
static PyObject *cxoDbType_repr(cxoDbType*);
|
||||
static PyObject *cxoDbType_richCompare(cxoDbType*, PyObject*, int);
|
||||
static Py_hash_t cxoDbType_hash(cxoDbType*);
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of members
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyMemberDef cxoMembers[] = {
|
||||
{ "name", T_STRING, offsetof(cxoDbType, name), READONLY },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Python type declaration
|
||||
//-----------------------------------------------------------------------------
|
||||
PyTypeObject cxoPyTypeDbType = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
.tp_name = "cx_Oracle.DbType",
|
||||
.tp_basicsize = sizeof(cxoDbType),
|
||||
.tp_dealloc = (destructor) cxoDbType_free,
|
||||
.tp_repr = (reprfunc) cxoDbType_repr,
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT,
|
||||
.tp_members = cxoMembers,
|
||||
.tp_richcompare = (richcmpfunc) cxoDbType_richCompare,
|
||||
.tp_hash = (hashfunc) cxoDbType_hash
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// cxoDbType_free()
|
||||
// Free the database type object.
|
||||
@ -273,3 +239,28 @@ cxoDbType *cxoDbType_fromTransformNum(cxoTransformNum transformNum)
|
||||
cxoError_raiseFromString(cxoNotSupportedErrorException, message);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of members
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyMemberDef cxoMembers[] = {
|
||||
{ "name", T_STRING, offsetof(cxoDbType, name), READONLY },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Python type declaration
|
||||
//-----------------------------------------------------------------------------
|
||||
PyTypeObject cxoPyTypeDbType = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
.tp_name = "cx_Oracle.DbType",
|
||||
.tp_basicsize = sizeof(cxoDbType),
|
||||
.tp_dealloc = (destructor) cxoDbType_free,
|
||||
.tp_repr = (reprfunc) cxoDbType_repr,
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT,
|
||||
.tp_members = cxoMembers,
|
||||
.tp_richcompare = (richcmpfunc) cxoDbType_richCompare,
|
||||
.tp_hash = (hashfunc) cxoDbType_hash
|
||||
};
|
||||
|
||||
@ -14,71 +14,6 @@
|
||||
|
||||
#include "cxoModule.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Declaration of methods used for dequeue options
|
||||
//-----------------------------------------------------------------------------
|
||||
static void cxoDeqOptions_free(cxoDeqOptions*);
|
||||
static PyObject *cxoDeqOptions_getCondition(cxoDeqOptions*, void*);
|
||||
static PyObject *cxoDeqOptions_getConsumerName(cxoDeqOptions*, void*);
|
||||
static PyObject *cxoDeqOptions_getCorrelation(cxoDeqOptions*, void*);
|
||||
static PyObject *cxoDeqOptions_getMode(cxoDeqOptions*, void*);
|
||||
static PyObject *cxoDeqOptions_getMsgId(cxoDeqOptions*, void*);
|
||||
static PyObject *cxoDeqOptions_getNavigation(cxoDeqOptions*, void*);
|
||||
static PyObject *cxoDeqOptions_getTransformation(cxoDeqOptions*, void*);
|
||||
static PyObject *cxoDeqOptions_getVisibility(cxoDeqOptions*, void*);
|
||||
static PyObject *cxoDeqOptions_getWait(cxoDeqOptions*, void*);
|
||||
static int cxoDeqOptions_setCondition(cxoDeqOptions*, PyObject*, void*);
|
||||
static int cxoDeqOptions_setConsumerName(cxoDeqOptions*, PyObject*, void*);
|
||||
static int cxoDeqOptions_setCorrelation(cxoDeqOptions*, PyObject*, void*);
|
||||
static int cxoDeqOptions_setDeliveryMode(cxoDeqOptions*, PyObject*, void*);
|
||||
static int cxoDeqOptions_setMode(cxoDeqOptions*, PyObject*, void*);
|
||||
static int cxoDeqOptions_setMsgId(cxoDeqOptions*, PyObject*, void*);
|
||||
static int cxoDeqOptions_setNavigation(cxoDeqOptions*, PyObject*, void*);
|
||||
static int cxoDeqOptions_setTransformation(cxoDeqOptions*, PyObject*, void*);
|
||||
static int cxoDeqOptions_setVisibility(cxoDeqOptions*, PyObject*, void*);
|
||||
static int cxoDeqOptions_setWait(cxoDeqOptions*, PyObject*, void*);
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of calculated members for Python type "DeqOptions"
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyGetSetDef cxoDeqOptionsCalcMembers[] = {
|
||||
{ "condition", (getter) cxoDeqOptions_getCondition,
|
||||
(setter) cxoDeqOptions_setCondition, 0, 0 },
|
||||
{ "consumername", (getter) cxoDeqOptions_getConsumerName,
|
||||
(setter) cxoDeqOptions_setConsumerName, 0, 0 },
|
||||
{ "correlation", (getter) cxoDeqOptions_getCorrelation,
|
||||
(setter) cxoDeqOptions_setCorrelation, 0, 0 },
|
||||
{ "deliverymode", 0, (setter) cxoDeqOptions_setDeliveryMode, 0, 0 },
|
||||
{ "mode", (getter) cxoDeqOptions_getMode, (setter) cxoDeqOptions_setMode,
|
||||
0, 0 },
|
||||
{ "msgid", (getter) cxoDeqOptions_getMsgId,
|
||||
(setter) cxoDeqOptions_setMsgId, 0, 0 },
|
||||
{ "navigation", (getter) cxoDeqOptions_getNavigation,
|
||||
(setter) cxoDeqOptions_setNavigation, 0, 0 },
|
||||
{ "transformation", (getter) cxoDeqOptions_getTransformation,
|
||||
(setter) cxoDeqOptions_setTransformation, 0, 0 },
|
||||
{ "visibility", (getter) cxoDeqOptions_getVisibility,
|
||||
(setter) cxoDeqOptions_setVisibility, 0, 0 },
|
||||
{ "wait", (getter) cxoDeqOptions_getWait, (setter) cxoDeqOptions_setWait,
|
||||
0, 0 },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Python type declarations
|
||||
//-----------------------------------------------------------------------------
|
||||
PyTypeObject cxoPyTypeDeqOptions = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
.tp_name = "cx_Oracle.DeqOptions",
|
||||
.tp_basicsize = sizeof(cxoDeqOptions),
|
||||
.tp_dealloc = (destructor) cxoDeqOptions_free,
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT,
|
||||
.tp_getset = cxoDeqOptionsCalcMembers
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// cxoDeqOptions_new()
|
||||
// Create a new dequeue options object.
|
||||
@ -436,3 +371,43 @@ static int cxoDeqOptions_setWait(cxoDeqOptions *options, PyObject *valueObj,
|
||||
return cxoError_raiseAndReturnInt();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of calculated members for Python type
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyGetSetDef cxoDeqOptionsCalcMembers[] = {
|
||||
{ "condition", (getter) cxoDeqOptions_getCondition,
|
||||
(setter) cxoDeqOptions_setCondition, 0, 0 },
|
||||
{ "consumername", (getter) cxoDeqOptions_getConsumerName,
|
||||
(setter) cxoDeqOptions_setConsumerName, 0, 0 },
|
||||
{ "correlation", (getter) cxoDeqOptions_getCorrelation,
|
||||
(setter) cxoDeqOptions_setCorrelation, 0, 0 },
|
||||
{ "deliverymode", 0, (setter) cxoDeqOptions_setDeliveryMode, 0, 0 },
|
||||
{ "mode", (getter) cxoDeqOptions_getMode, (setter) cxoDeqOptions_setMode,
|
||||
0, 0 },
|
||||
{ "msgid", (getter) cxoDeqOptions_getMsgId,
|
||||
(setter) cxoDeqOptions_setMsgId, 0, 0 },
|
||||
{ "navigation", (getter) cxoDeqOptions_getNavigation,
|
||||
(setter) cxoDeqOptions_setNavigation, 0, 0 },
|
||||
{ "transformation", (getter) cxoDeqOptions_getTransformation,
|
||||
(setter) cxoDeqOptions_setTransformation, 0, 0 },
|
||||
{ "visibility", (getter) cxoDeqOptions_getVisibility,
|
||||
(setter) cxoDeqOptions_setVisibility, 0, 0 },
|
||||
{ "wait", (getter) cxoDeqOptions_getWait, (setter) cxoDeqOptions_setWait,
|
||||
0, 0 },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of Python type
|
||||
//-----------------------------------------------------------------------------
|
||||
PyTypeObject cxoPyTypeDeqOptions = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
.tp_name = "cx_Oracle.DeqOptions",
|
||||
.tp_basicsize = sizeof(cxoDeqOptions),
|
||||
.tp_dealloc = (destructor) cxoDeqOptions_free,
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT,
|
||||
.tp_getset = cxoDeqOptionsCalcMembers
|
||||
};
|
||||
|
||||
@ -14,43 +14,6 @@
|
||||
|
||||
#include "cxoModule.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Declaration of methods used for enqueue options
|
||||
//-----------------------------------------------------------------------------
|
||||
static void cxoEnqOptions_free(cxoEnqOptions*);
|
||||
static PyObject *cxoEnqOptions_getTransformation(cxoEnqOptions*, void*);
|
||||
static PyObject *cxoEnqOptions_getVisibility(cxoEnqOptions*, void*);
|
||||
static int cxoEnqOptions_setDeliveryMode(cxoEnqOptions*, PyObject*, void*);
|
||||
static int cxoEnqOptions_setTransformation(cxoEnqOptions*, PyObject*, void*);
|
||||
static int cxoEnqOptions_setVisibility(cxoEnqOptions*, PyObject*, void*);
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of calculated members for Python type "EnqOptions"
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyGetSetDef cxoEnqOptionsCalcMembers[] = {
|
||||
{ "deliverymode", 0, (setter) cxoEnqOptions_setDeliveryMode, 0, 0 },
|
||||
{ "transformation", (getter) cxoEnqOptions_getTransformation,
|
||||
(setter) cxoEnqOptions_setTransformation, 0, 0 },
|
||||
{ "visibility", (getter) cxoEnqOptions_getVisibility,
|
||||
(setter) cxoEnqOptions_setVisibility, 0, 0 },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Python type declarations
|
||||
//-----------------------------------------------------------------------------
|
||||
PyTypeObject cxoPyTypeEnqOptions = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
.tp_name = "cx_Oracle.EnqOptions",
|
||||
.tp_basicsize = sizeof(cxoEnqOptions),
|
||||
.tp_dealloc = (destructor) cxoEnqOptions_free,
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT,
|
||||
.tp_getset = cxoEnqOptionsCalcMembers
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// cxoEnqOptions_new()
|
||||
// Create a new enqueue options object.
|
||||
@ -184,3 +147,29 @@ static int cxoEnqOptions_setVisibility(cxoEnqOptions *self,
|
||||
return cxoError_raiseAndReturnInt();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of calculated members for Python type
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyGetSetDef cxoEnqOptionsCalcMembers[] = {
|
||||
{ "deliverymode", 0, (setter) cxoEnqOptions_setDeliveryMode, 0, 0 },
|
||||
{ "transformation", (getter) cxoEnqOptions_getTransformation,
|
||||
(setter) cxoEnqOptions_setTransformation, 0, 0 },
|
||||
{ "visibility", (getter) cxoEnqOptions_getVisibility,
|
||||
(setter) cxoEnqOptions_setVisibility, 0, 0 },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of Python type
|
||||
//-----------------------------------------------------------------------------
|
||||
PyTypeObject cxoPyTypeEnqOptions = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
.tp_name = "cx_Oracle.EnqOptions",
|
||||
.tp_basicsize = sizeof(cxoEnqOptions),
|
||||
.tp_dealloc = (destructor) cxoEnqOptions_free,
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT,
|
||||
.tp_getset = cxoEnqOptionsCalcMembers
|
||||
};
|
||||
|
||||
@ -14,54 +14,6 @@
|
||||
|
||||
#include "cxoModule.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// forward declarations
|
||||
//-----------------------------------------------------------------------------
|
||||
static void cxoError_free(cxoError *error);
|
||||
static PyObject *cxoError_str(cxoError *error);
|
||||
static PyObject *cxoError_new(PyTypeObject *type, PyObject *args,
|
||||
PyObject *keywordArgs);
|
||||
static PyObject *cxoError_reduce(cxoError*);
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of methods
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyMethodDef cxoErrorMethods[] = {
|
||||
{ "__reduce__", (PyCFunction) cxoError_reduce, METH_NOARGS },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of members
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyMemberDef cxoErrorMembers[] = {
|
||||
{ "code", T_LONG, offsetof(cxoError, code), READONLY },
|
||||
{ "offset", T_UINT, offsetof(cxoError, offset), READONLY },
|
||||
{ "message", T_OBJECT, offsetof(cxoError, message), READONLY },
|
||||
{ "context", T_OBJECT, offsetof(cxoError, context), READONLY },
|
||||
{ "isrecoverable", T_BOOL, offsetof(cxoError, isRecoverable), READONLY },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of Python type
|
||||
//-----------------------------------------------------------------------------
|
||||
PyTypeObject cxoPyTypeError = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
.tp_name = "cx_Oracle._Error",
|
||||
.tp_basicsize = sizeof(cxoError),
|
||||
.tp_dealloc = (destructor) cxoError_free,
|
||||
.tp_str = (reprfunc) cxoError_str,
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT,
|
||||
.tp_methods = cxoErrorMethods,
|
||||
.tp_members = cxoErrorMembers,
|
||||
.tp_new = cxoError_new
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// cxoError_free()
|
||||
// Deallocate the error.
|
||||
@ -293,3 +245,41 @@ static PyObject *cxoError_str(cxoError *error)
|
||||
Py_INCREF(error->message);
|
||||
return error->message;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of methods
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyMethodDef cxoErrorMethods[] = {
|
||||
{ "__reduce__", (PyCFunction) cxoError_reduce, METH_NOARGS },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of members
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyMemberDef cxoErrorMembers[] = {
|
||||
{ "code", T_LONG, offsetof(cxoError, code), READONLY },
|
||||
{ "offset", T_UINT, offsetof(cxoError, offset), READONLY },
|
||||
{ "message", T_OBJECT, offsetof(cxoError, message), READONLY },
|
||||
{ "context", T_OBJECT, offsetof(cxoError, context), READONLY },
|
||||
{ "isrecoverable", T_BOOL, offsetof(cxoError, isRecoverable), READONLY },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of Python type
|
||||
//-----------------------------------------------------------------------------
|
||||
PyTypeObject cxoPyTypeError = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
.tp_name = "cx_Oracle._Error",
|
||||
.tp_basicsize = sizeof(cxoError),
|
||||
.tp_dealloc = (destructor) cxoError_free,
|
||||
.tp_str = (reprfunc) cxoError_str,
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT,
|
||||
.tp_methods = cxoErrorMethods,
|
||||
.tp_members = cxoErrorMembers,
|
||||
.tp_new = cxoError_new
|
||||
};
|
||||
|
||||
@ -10,28 +10,6 @@
|
||||
|
||||
#include "cxoModule.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// functions for the Python type "Object"
|
||||
//-----------------------------------------------------------------------------
|
||||
static void cxoFuture_free(cxoFuture*);
|
||||
static PyObject *cxoFuture_getAttr(cxoFuture*, PyObject*);
|
||||
static int cxoFuture_setAttr(cxoFuture*, PyObject*, PyObject*);
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Python type declaration
|
||||
//-----------------------------------------------------------------------------
|
||||
PyTypeObject cxoPyTypeFuture = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
.tp_name = "cx_Oracle.__future__",
|
||||
.tp_basicsize = sizeof(cxoFuture),
|
||||
.tp_dealloc = (destructor) cxoFuture_free,
|
||||
.tp_getattro = (getattrofunc) cxoFuture_getAttr,
|
||||
.tp_setattro = (setattrofunc) cxoFuture_setAttr,
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// cxoFuture_free()
|
||||
// Free the future object and reset global.
|
||||
@ -62,3 +40,17 @@ static int cxoFuture_setAttr(cxoFuture *obj, PyObject *nameObject,
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Python type declaration
|
||||
//-----------------------------------------------------------------------------
|
||||
PyTypeObject cxoPyTypeFuture = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
.tp_name = "cx_Oracle.__future__",
|
||||
.tp_basicsize = sizeof(cxoFuture),
|
||||
.tp_dealloc = (destructor) cxoFuture_free,
|
||||
.tp_getattro = (getattrofunc) cxoFuture_getAttr,
|
||||
.tp_setattro = (setattrofunc) cxoFuture_setAttr,
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT
|
||||
};
|
||||
|
||||
107
src/cxoLob.c
107
src/cxoLob.c
@ -14,69 +14,6 @@
|
||||
|
||||
#include "cxoModule.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Declaration of external LOB functions.
|
||||
//-----------------------------------------------------------------------------
|
||||
static void cxoLob_free(cxoLob*);
|
||||
static PyObject *cxoLob_str(cxoLob*);
|
||||
static PyObject *cxoLob_size(cxoLob*, PyObject*);
|
||||
static PyObject *cxoLob_open(cxoLob*, PyObject*);
|
||||
static PyObject *cxoLob_close(cxoLob*, PyObject*);
|
||||
static PyObject *cxoLob_read(cxoLob*, PyObject*, PyObject*);
|
||||
static PyObject *cxoLob_write(cxoLob*, PyObject*, PyObject*);
|
||||
static PyObject *cxoLob_trim(cxoLob*, PyObject*, PyObject*);
|
||||
static PyObject *cxoLob_getChunkSize(cxoLob*, PyObject*);
|
||||
static PyObject *cxoLob_isOpen(cxoLob*, PyObject*);
|
||||
static PyObject *cxoLob_getFileName(cxoLob*, PyObject*);
|
||||
static PyObject *cxoLob_setFileName(cxoLob*, PyObject*);
|
||||
static PyObject *cxoLob_fileExists(cxoLob*, PyObject*);
|
||||
static PyObject *cxoLob_reduce(cxoLob*);
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of methods
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyMethodDef cxoLobMethods[] = {
|
||||
{ "size", (PyCFunction) cxoLob_size, METH_NOARGS },
|
||||
{ "open", (PyCFunction) cxoLob_open, METH_NOARGS },
|
||||
{ "close", (PyCFunction) cxoLob_close, METH_NOARGS },
|
||||
{ "read", (PyCFunction) cxoLob_read, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "write", (PyCFunction) cxoLob_write, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "trim", (PyCFunction) cxoLob_trim, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "getchunksize", (PyCFunction) cxoLob_getChunkSize, METH_NOARGS },
|
||||
{ "isopen", (PyCFunction) cxoLob_isOpen, METH_NOARGS },
|
||||
{ "getfilename", (PyCFunction) cxoLob_getFileName, METH_NOARGS },
|
||||
{ "setfilename", (PyCFunction) cxoLob_setFileName, METH_VARARGS },
|
||||
{ "fileexists", (PyCFunction) cxoLob_fileExists, METH_NOARGS },
|
||||
{ "__reduce__", (PyCFunction) cxoLob_reduce, METH_NOARGS },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of members
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyMemberDef cxoMembers[] = {
|
||||
{ "type", T_OBJECT, offsetof(cxoLob, dbType), READONLY },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Python type declaration
|
||||
//-----------------------------------------------------------------------------
|
||||
PyTypeObject cxoPyTypeLob = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
.tp_name = "cx_Oracle.LOB",
|
||||
.tp_basicsize = sizeof(cxoLob),
|
||||
.tp_dealloc = (destructor) cxoLob_free,
|
||||
.tp_str = (reprfunc) cxoLob_str,
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT,
|
||||
.tp_methods = cxoLobMethods,
|
||||
.tp_members = cxoMembers
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// cxoLob_new()
|
||||
// Create a new LOB.
|
||||
@ -461,3 +398,47 @@ static PyObject *cxoLob_fileExists(cxoLob *lob, PyObject *args)
|
||||
Py_RETURN_TRUE;
|
||||
Py_RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of methods
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyMethodDef cxoLobMethods[] = {
|
||||
{ "size", (PyCFunction) cxoLob_size, METH_NOARGS },
|
||||
{ "open", (PyCFunction) cxoLob_open, METH_NOARGS },
|
||||
{ "close", (PyCFunction) cxoLob_close, METH_NOARGS },
|
||||
{ "read", (PyCFunction) cxoLob_read, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "write", (PyCFunction) cxoLob_write, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "trim", (PyCFunction) cxoLob_trim, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "getchunksize", (PyCFunction) cxoLob_getChunkSize, METH_NOARGS },
|
||||
{ "isopen", (PyCFunction) cxoLob_isOpen, METH_NOARGS },
|
||||
{ "getfilename", (PyCFunction) cxoLob_getFileName, METH_NOARGS },
|
||||
{ "setfilename", (PyCFunction) cxoLob_setFileName, METH_VARARGS },
|
||||
{ "fileexists", (PyCFunction) cxoLob_fileExists, METH_NOARGS },
|
||||
{ "__reduce__", (PyCFunction) cxoLob_reduce, METH_NOARGS },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of members
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyMemberDef cxoMembers[] = {
|
||||
{ "type", T_OBJECT, offsetof(cxoLob, dbType), READONLY },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Python type declaration
|
||||
//-----------------------------------------------------------------------------
|
||||
PyTypeObject cxoPyTypeLob = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
.tp_name = "cx_Oracle.LOB",
|
||||
.tp_basicsize = sizeof(cxoLob),
|
||||
.tp_dealloc = (destructor) cxoLob_free,
|
||||
.tp_str = (reprfunc) cxoLob_str,
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT,
|
||||
.tp_methods = cxoLobMethods,
|
||||
.tp_members = cxoMembers
|
||||
};
|
||||
|
||||
@ -14,75 +14,6 @@
|
||||
|
||||
#include "cxoModule.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// forward declarations
|
||||
//-----------------------------------------------------------------------------
|
||||
static void cxoMsgProps_free(cxoMsgProps*);
|
||||
static PyObject *cxoMsgProps_getNumAttempts(cxoMsgProps*, void*);
|
||||
static PyObject *cxoMsgProps_getCorrelation(cxoMsgProps*, void*);
|
||||
static PyObject *cxoMsgProps_getDelay(cxoMsgProps*, void*);
|
||||
static PyObject *cxoMsgProps_getDeliveryMode(cxoMsgProps*, void*);
|
||||
static PyObject *cxoMsgProps_getEnqTime(cxoMsgProps*, void*);
|
||||
static PyObject *cxoMsgProps_getExceptionQ(cxoMsgProps*, void*);
|
||||
static PyObject *cxoMsgProps_getExpiration(cxoMsgProps*, void*);
|
||||
static PyObject *cxoMsgProps_getOriginalMsgId(cxoMsgProps*, void*);
|
||||
static PyObject *cxoMsgProps_getPriority(cxoMsgProps*, void*);
|
||||
static PyObject *cxoMsgProps_getState(cxoMsgProps*, void*);
|
||||
static int cxoMsgProps_setCorrelation(cxoMsgProps*, PyObject*, void*);
|
||||
static int cxoMsgProps_setDelay(cxoMsgProps*, PyObject*, void*);
|
||||
static int cxoMsgProps_setExceptionQ(cxoMsgProps*, PyObject*, void*);
|
||||
static int cxoMsgProps_setExpiration(cxoMsgProps*, PyObject*, void*);
|
||||
static int cxoMsgProps_setOriginalMsgId(cxoMsgProps*, PyObject*, void*);
|
||||
static int cxoMsgProps_setPriority(cxoMsgProps*, PyObject*, void*);
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of members
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyMemberDef cxoMembers[] = {
|
||||
{ "payload", T_OBJECT, offsetof(cxoMsgProps, payload), 0 },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of calculated members
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyGetSetDef cxoCalcMembers[] = {
|
||||
{ "attempts", (getter) cxoMsgProps_getNumAttempts, 0, 0, 0 },
|
||||
{ "correlation", (getter) cxoMsgProps_getCorrelation,
|
||||
(setter) cxoMsgProps_setCorrelation, 0, 0 },
|
||||
{ "delay", (getter) cxoMsgProps_getDelay, (setter) cxoMsgProps_setDelay, 0,
|
||||
0 },
|
||||
{ "deliverymode", (getter) cxoMsgProps_getDeliveryMode, 0, 0, 0 },
|
||||
{ "enqtime", (getter) cxoMsgProps_getEnqTime, 0, 0, 0 },
|
||||
{ "exceptionq", (getter) cxoMsgProps_getExceptionQ,
|
||||
(setter) cxoMsgProps_setExceptionQ, 0, 0 },
|
||||
{ "expiration", (getter) cxoMsgProps_getExpiration,
|
||||
(setter) cxoMsgProps_setExpiration, 0, 0 },
|
||||
{ "msgid", (getter) cxoMsgProps_getOriginalMsgId,
|
||||
(setter) cxoMsgProps_setOriginalMsgId, 0, 0 },
|
||||
{ "priority", (getter) cxoMsgProps_getPriority,
|
||||
(setter) cxoMsgProps_setPriority, 0, 0 },
|
||||
{ "state", (getter) cxoMsgProps_getState, 0, 0, 0 },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Python type declarations
|
||||
//-----------------------------------------------------------------------------
|
||||
PyTypeObject cxoPyTypeMsgProps = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
.tp_name = "cx_Oracle.MessageProperties",
|
||||
.tp_basicsize = sizeof(cxoMsgProps),
|
||||
.tp_dealloc = (destructor) cxoMsgProps_free,
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT,
|
||||
.tp_members = cxoMembers,
|
||||
.tp_getset = cxoCalcMembers
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// cxoMsgProps_new()
|
||||
// Create a new message properties object.
|
||||
@ -382,3 +313,50 @@ static int cxoMsgProps_setPriority(cxoMsgProps *props, PyObject *valueObj,
|
||||
{
|
||||
return cxoMsgProps_setAttrInt32(props, valueObj, dpiMsgProps_setPriority);
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of members
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyMemberDef cxoMembers[] = {
|
||||
{ "payload", T_OBJECT, offsetof(cxoMsgProps, payload), 0 },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of calculated members
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyGetSetDef cxoCalcMembers[] = {
|
||||
{ "attempts", (getter) cxoMsgProps_getNumAttempts, 0, 0, 0 },
|
||||
{ "correlation", (getter) cxoMsgProps_getCorrelation,
|
||||
(setter) cxoMsgProps_setCorrelation, 0, 0 },
|
||||
{ "delay", (getter) cxoMsgProps_getDelay, (setter) cxoMsgProps_setDelay, 0,
|
||||
0 },
|
||||
{ "deliverymode", (getter) cxoMsgProps_getDeliveryMode, 0, 0, 0 },
|
||||
{ "enqtime", (getter) cxoMsgProps_getEnqTime, 0, 0, 0 },
|
||||
{ "exceptionq", (getter) cxoMsgProps_getExceptionQ,
|
||||
(setter) cxoMsgProps_setExceptionQ, 0, 0 },
|
||||
{ "expiration", (getter) cxoMsgProps_getExpiration,
|
||||
(setter) cxoMsgProps_setExpiration, 0, 0 },
|
||||
{ "msgid", (getter) cxoMsgProps_getOriginalMsgId,
|
||||
(setter) cxoMsgProps_setOriginalMsgId, 0, 0 },
|
||||
{ "priority", (getter) cxoMsgProps_getPriority,
|
||||
(setter) cxoMsgProps_setPriority, 0, 0 },
|
||||
{ "state", (getter) cxoMsgProps_getState, 0, 0, 0 },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Python type declarations
|
||||
//-----------------------------------------------------------------------------
|
||||
PyTypeObject cxoPyTypeMsgProps = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
.tp_name = "cx_Oracle.MessageProperties",
|
||||
.tp_basicsize = sizeof(cxoMsgProps),
|
||||
.tp_dealloc = (destructor) cxoMsgProps_free,
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT,
|
||||
.tp_members = cxoMembers,
|
||||
.tp_getset = cxoCalcMembers
|
||||
};
|
||||
|
||||
122
src/cxoObject.c
122
src/cxoObject.c
@ -14,79 +14,6 @@
|
||||
|
||||
#include "cxoModule.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// functions for the Python type "Object"
|
||||
//-----------------------------------------------------------------------------
|
||||
static void cxoObject_free(cxoObject*);
|
||||
static PyObject *cxoObject_getAttr(cxoObject*, PyObject*);
|
||||
static PyObject *cxoObject_repr(cxoObject*);
|
||||
static int cxoObject_setAttr(cxoObject*, PyObject*, PyObject*);
|
||||
static PyObject *cxoObject_append(cxoObject*, PyObject*);
|
||||
static PyObject *cxoObject_asDict(cxoObject*, PyObject*);
|
||||
static PyObject *cxoObject_asList(cxoObject*, PyObject*);
|
||||
static PyObject *cxoObject_copy(cxoObject*, PyObject*);
|
||||
static PyObject *cxoObject_delete(cxoObject*, PyObject*);
|
||||
static PyObject *cxoObject_exists(cxoObject*, PyObject*);
|
||||
static PyObject *cxoObject_extend(cxoObject*, PyObject*);
|
||||
static PyObject *cxoObject_getElement(cxoObject*, PyObject*);
|
||||
static PyObject *cxoObject_getFirstIndex(cxoObject*, PyObject*);
|
||||
static PyObject *cxoObject_getLastIndex(cxoObject*, PyObject*);
|
||||
static PyObject *cxoObject_getNextIndex(cxoObject*, PyObject*);
|
||||
static PyObject *cxoObject_getPrevIndex(cxoObject*, PyObject*);
|
||||
static PyObject *cxoObject_getSize(cxoObject*, PyObject*);
|
||||
static PyObject *cxoObject_setElement(cxoObject*, PyObject*);
|
||||
static PyObject *cxoObject_trim(cxoObject*, PyObject*);
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of methods for Python type "Object"
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyMethodDef cxoObjectMethods[] = {
|
||||
{ "append", (PyCFunction) cxoObject_append, METH_O },
|
||||
{ "asdict", (PyCFunction) cxoObject_asDict, METH_NOARGS },
|
||||
{ "aslist", (PyCFunction) cxoObject_asList, METH_NOARGS },
|
||||
{ "copy", (PyCFunction) cxoObject_copy, METH_NOARGS },
|
||||
{ "delete", (PyCFunction) cxoObject_delete, METH_VARARGS },
|
||||
{ "exists", (PyCFunction) cxoObject_exists, METH_VARARGS },
|
||||
{ "extend", (PyCFunction) cxoObject_extend, METH_O },
|
||||
{ "first", (PyCFunction) cxoObject_getFirstIndex, METH_NOARGS },
|
||||
{ "getelement", (PyCFunction) cxoObject_getElement, METH_VARARGS },
|
||||
{ "last", (PyCFunction) cxoObject_getLastIndex, METH_NOARGS },
|
||||
{ "next", (PyCFunction) cxoObject_getNextIndex, METH_VARARGS },
|
||||
{ "prev", (PyCFunction) cxoObject_getPrevIndex, METH_VARARGS },
|
||||
{ "setelement", (PyCFunction) cxoObject_setElement, METH_VARARGS },
|
||||
{ "size", (PyCFunction) cxoObject_getSize, METH_NOARGS },
|
||||
{ "trim", (PyCFunction) cxoObject_trim, METH_VARARGS },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Declaration of members for Python type "Object".
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyMemberDef cxoObjectMembers[] = {
|
||||
{ "type", T_OBJECT, offsetof(cxoObject, objectType), READONLY },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Python type declaration
|
||||
//-----------------------------------------------------------------------------
|
||||
PyTypeObject cxoPyTypeObject = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
.tp_name = "cx_Oracle.Object",
|
||||
.tp_basicsize = sizeof(cxoObject),
|
||||
.tp_dealloc = (destructor) cxoObject_free,
|
||||
.tp_repr = (reprfunc) cxoObject_repr,
|
||||
.tp_getattro = (getattrofunc) cxoObject_getAttr,
|
||||
.tp_setattro = (setattrofunc) cxoObject_setAttr,
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT,
|
||||
.tp_methods = cxoObjectMethods,
|
||||
.tp_members = cxoObjectMembers
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// cxoObject_new()
|
||||
// Create a new object.
|
||||
@ -683,3 +610,52 @@ static PyObject *cxoObject_trim(cxoObject *obj, PyObject *args)
|
||||
return cxoError_raiseAndReturnNull();
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of methods for Python type
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyMethodDef cxoObjectMethods[] = {
|
||||
{ "append", (PyCFunction) cxoObject_append, METH_O },
|
||||
{ "asdict", (PyCFunction) cxoObject_asDict, METH_NOARGS },
|
||||
{ "aslist", (PyCFunction) cxoObject_asList, METH_NOARGS },
|
||||
{ "copy", (PyCFunction) cxoObject_copy, METH_NOARGS },
|
||||
{ "delete", (PyCFunction) cxoObject_delete, METH_VARARGS },
|
||||
{ "exists", (PyCFunction) cxoObject_exists, METH_VARARGS },
|
||||
{ "extend", (PyCFunction) cxoObject_extend, METH_O },
|
||||
{ "first", (PyCFunction) cxoObject_getFirstIndex, METH_NOARGS },
|
||||
{ "getelement", (PyCFunction) cxoObject_getElement, METH_VARARGS },
|
||||
{ "last", (PyCFunction) cxoObject_getLastIndex, METH_NOARGS },
|
||||
{ "next", (PyCFunction) cxoObject_getNextIndex, METH_VARARGS },
|
||||
{ "prev", (PyCFunction) cxoObject_getPrevIndex, METH_VARARGS },
|
||||
{ "setelement", (PyCFunction) cxoObject_setElement, METH_VARARGS },
|
||||
{ "size", (PyCFunction) cxoObject_getSize, METH_NOARGS },
|
||||
{ "trim", (PyCFunction) cxoObject_trim, METH_VARARGS },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Declaration of members for Python type
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyMemberDef cxoObjectMembers[] = {
|
||||
{ "type", T_OBJECT, offsetof(cxoObject, objectType), READONLY },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Python type declaration
|
||||
//-----------------------------------------------------------------------------
|
||||
PyTypeObject cxoPyTypeObject = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
.tp_name = "cx_Oracle.Object",
|
||||
.tp_basicsize = sizeof(cxoObject),
|
||||
.tp_dealloc = (destructor) cxoObject_free,
|
||||
.tp_repr = (reprfunc) cxoObject_repr,
|
||||
.tp_getattro = (getattrofunc) cxoObject_getAttr,
|
||||
.tp_setattro = (setattrofunc) cxoObject_setAttr,
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT,
|
||||
.tp_methods = cxoObjectMethods,
|
||||
.tp_members = cxoObjectMembers
|
||||
};
|
||||
|
||||
@ -9,47 +9,6 @@
|
||||
|
||||
#include "cxoModule.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Declaration of functions
|
||||
//-----------------------------------------------------------------------------
|
||||
static void cxoObjectAttr_free(cxoObjectAttr*);
|
||||
static PyObject *cxoObjectAttr_repr(cxoObjectAttr*);
|
||||
static PyObject *cxoObjectAttr_getType(cxoObjectAttr*, void*);
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of members
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyMemberDef cxoMembers[] = {
|
||||
{ "name", T_OBJECT, offsetof(cxoObjectAttr, name), READONLY },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of calculated members
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyGetSetDef cxoCalcMembers[] = {
|
||||
{ "type", (getter) cxoObjectAttr_getType, 0, 0, 0 },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Python type declaration
|
||||
//-----------------------------------------------------------------------------
|
||||
PyTypeObject cxoPyTypeObjectAttr = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
.tp_name = "cx_Oracle.ObjectAttribute",
|
||||
.tp_basicsize = sizeof(cxoObjectAttr),
|
||||
.tp_dealloc = (destructor) cxoObjectAttr_free,
|
||||
.tp_repr = (reprfunc) cxoObjectAttr_repr,
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT,
|
||||
.tp_members = cxoMembers,
|
||||
.tp_getset = cxoCalcMembers
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// cxoObjectAttr_initialize()
|
||||
// Initialize the new object attribute.
|
||||
@ -157,3 +116,36 @@ static PyObject *cxoObjectAttr_repr(cxoObjectAttr *attr)
|
||||
Py_DECREF(name);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of members
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyMemberDef cxoMembers[] = {
|
||||
{ "name", T_OBJECT, offsetof(cxoObjectAttr, name), READONLY },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of calculated members
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyGetSetDef cxoCalcMembers[] = {
|
||||
{ "type", (getter) cxoObjectAttr_getType, 0, 0, 0 },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Python type declaration
|
||||
//-----------------------------------------------------------------------------
|
||||
PyTypeObject cxoPyTypeObjectAttr = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
.tp_name = "cx_Oracle.ObjectAttribute",
|
||||
.tp_basicsize = sizeof(cxoObjectAttr),
|
||||
.tp_dealloc = (destructor) cxoObjectAttr_free,
|
||||
.tp_repr = (reprfunc) cxoObjectAttr_repr,
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT,
|
||||
.tp_members = cxoMembers,
|
||||
.tp_getset = cxoCalcMembers
|
||||
};
|
||||
|
||||
@ -14,66 +14,6 @@
|
||||
|
||||
#include "cxoModule.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Declaration of functions
|
||||
//-----------------------------------------------------------------------------
|
||||
static void cxoObjectType_free(cxoObjectType*);
|
||||
static PyObject *cxoObjectType_repr(cxoObjectType*);
|
||||
static PyObject *cxoObjectType_newObject(cxoObjectType*, PyObject*, PyObject*);
|
||||
static PyObject *cxoObjectType_richCompare(cxoObjectType*, PyObject*, int);
|
||||
static PyObject *cxoObjectType_getElementType(cxoObjectType*, void*);
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of methods
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyMethodDef cxoMethods[] = {
|
||||
{ "newobject", (PyCFunction) cxoObjectType_newObject,
|
||||
METH_VARARGS | METH_KEYWORDS },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of members
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyMemberDef cxoMembers[] = {
|
||||
{ "schema", T_OBJECT, offsetof(cxoObjectType, schema), READONLY },
|
||||
{ "name", T_OBJECT, offsetof(cxoObjectType, name), READONLY },
|
||||
{ "attributes", T_OBJECT, offsetof(cxoObjectType, attributes), READONLY },
|
||||
{ "iscollection", T_BOOL, offsetof(cxoObjectType, isCollection),
|
||||
READONLY },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of calculated members
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyGetSetDef cxoCalcMembers[] = {
|
||||
{ "element_type", (getter) cxoObjectType_getElementType, 0, 0, 0 },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Python type declarations
|
||||
//-----------------------------------------------------------------------------
|
||||
PyTypeObject cxoPyTypeObjectType = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
.tp_name = "cx_Oracle.ObjectType",
|
||||
.tp_basicsize = sizeof(cxoObjectType),
|
||||
.tp_dealloc = (destructor) cxoObjectType_free,
|
||||
.tp_repr = (reprfunc) cxoObjectType_repr,
|
||||
.tp_call = (ternaryfunc) cxoObjectType_newObject,
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT,
|
||||
.tp_methods = cxoMethods,
|
||||
.tp_members = cxoMembers,
|
||||
.tp_getset = cxoCalcMembers,
|
||||
.tp_richcompare = (richcmpfunc) cxoObjectType_richCompare
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// cxoObjectType_initialize()
|
||||
// Initialize the object type with the information that is required.
|
||||
@ -358,3 +298,53 @@ static PyObject *cxoObjectType_newObject(cxoObjectType *objType,
|
||||
|
||||
return (PyObject*) obj;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of methods
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyMethodDef cxoMethods[] = {
|
||||
{ "newobject", (PyCFunction) cxoObjectType_newObject,
|
||||
METH_VARARGS | METH_KEYWORDS },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of members
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyMemberDef cxoMembers[] = {
|
||||
{ "schema", T_OBJECT, offsetof(cxoObjectType, schema), READONLY },
|
||||
{ "name", T_OBJECT, offsetof(cxoObjectType, name), READONLY },
|
||||
{ "attributes", T_OBJECT, offsetof(cxoObjectType, attributes), READONLY },
|
||||
{ "iscollection", T_BOOL, offsetof(cxoObjectType, isCollection),
|
||||
READONLY },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of calculated members
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyGetSetDef cxoCalcMembers[] = {
|
||||
{ "element_type", (getter) cxoObjectType_getElementType, 0, 0, 0 },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Python type declarations
|
||||
//-----------------------------------------------------------------------------
|
||||
PyTypeObject cxoPyTypeObjectType = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
.tp_name = "cx_Oracle.ObjectType",
|
||||
.tp_basicsize = sizeof(cxoObjectType),
|
||||
.tp_dealloc = (destructor) cxoObjectType_free,
|
||||
.tp_repr = (reprfunc) cxoObjectType_repr,
|
||||
.tp_call = (ternaryfunc) cxoObjectType_newObject,
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT,
|
||||
.tp_methods = cxoMethods,
|
||||
.tp_members = cxoMembers,
|
||||
.tp_getset = cxoCalcMembers,
|
||||
.tp_richcompare = (richcmpfunc) cxoObjectType_richCompare
|
||||
};
|
||||
|
||||
@ -10,57 +10,6 @@
|
||||
|
||||
#include "cxoModule.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Declaration of functions
|
||||
//-----------------------------------------------------------------------------
|
||||
static void cxoQueue_free(cxoQueue*);
|
||||
static PyObject *cxoQueue_repr(cxoQueue*);
|
||||
static PyObject *cxoQueue_deqMany(cxoQueue*, PyObject*);
|
||||
static PyObject *cxoQueue_deqOne(cxoQueue*, PyObject*);
|
||||
static PyObject *cxoQueue_enqMany(cxoQueue*, PyObject*);
|
||||
static PyObject *cxoQueue_enqOne(cxoQueue*, PyObject*);
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of methods
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyMethodDef cxoMethods[] = {
|
||||
{ "deqMany", (PyCFunction) cxoQueue_deqMany, METH_VARARGS },
|
||||
{ "deqOne", (PyCFunction) cxoQueue_deqOne, METH_NOARGS },
|
||||
{ "enqMany", (PyCFunction) cxoQueue_enqMany, METH_VARARGS },
|
||||
{ "enqOne", (PyCFunction) cxoQueue_enqOne, METH_VARARGS },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of members
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyMemberDef cxoMembers[] = {
|
||||
{ "connection", T_OBJECT, offsetof(cxoQueue, conn), READONLY },
|
||||
{ "deqOptions", T_OBJECT, offsetof(cxoQueue, deqOptions), READONLY },
|
||||
{ "enqOptions", T_OBJECT, offsetof(cxoQueue, enqOptions), READONLY },
|
||||
{ "name", T_OBJECT, offsetof(cxoQueue, name), READONLY },
|
||||
{ "payloadType", T_OBJECT, offsetof(cxoQueue, payloadType), READONLY },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Python type declarations
|
||||
//-----------------------------------------------------------------------------
|
||||
PyTypeObject cxoPyTypeQueue = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
.tp_name = "cx_Oracle.Queue",
|
||||
.tp_basicsize = sizeof(cxoQueue),
|
||||
.tp_dealloc = (destructor) cxoQueue_free,
|
||||
.tp_repr = (reprfunc) cxoQueue_repr,
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT,
|
||||
.tp_methods = cxoMethods,
|
||||
.tp_members = cxoMembers
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// cxoQueue_new()
|
||||
// Create a new queue (advanced queuing).
|
||||
@ -400,3 +349,43 @@ static PyObject *cxoQueue_enqOne(cxoQueue *queue, PyObject *args)
|
||||
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of methods
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyMethodDef cxoMethods[] = {
|
||||
{ "deqMany", (PyCFunction) cxoQueue_deqMany, METH_VARARGS },
|
||||
{ "deqOne", (PyCFunction) cxoQueue_deqOne, METH_NOARGS },
|
||||
{ "enqMany", (PyCFunction) cxoQueue_enqMany, METH_VARARGS },
|
||||
{ "enqOne", (PyCFunction) cxoQueue_enqOne, METH_VARARGS },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of members
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyMemberDef cxoMembers[] = {
|
||||
{ "connection", T_OBJECT, offsetof(cxoQueue, conn), READONLY },
|
||||
{ "deqOptions", T_OBJECT, offsetof(cxoQueue, deqOptions), READONLY },
|
||||
{ "enqOptions", T_OBJECT, offsetof(cxoQueue, enqOptions), READONLY },
|
||||
{ "name", T_OBJECT, offsetof(cxoQueue, name), READONLY },
|
||||
{ "payloadType", T_OBJECT, offsetof(cxoQueue, payloadType), READONLY },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Python type declarations
|
||||
//-----------------------------------------------------------------------------
|
||||
PyTypeObject cxoPyTypeQueue = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
.tp_name = "cx_Oracle.Queue",
|
||||
.tp_basicsize = sizeof(cxoQueue),
|
||||
.tp_dealloc = (destructor) cxoQueue_free,
|
||||
.tp_repr = (reprfunc) cxoQueue_repr,
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT,
|
||||
.tp_methods = cxoMethods,
|
||||
.tp_members = cxoMembers
|
||||
};
|
||||
|
||||
@ -14,100 +14,6 @@
|
||||
|
||||
#include "cxoModule.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// functions for the Python type "SessionPool"
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyObject *cxoSessionPool_new(PyTypeObject*, PyObject*, PyObject*);
|
||||
static int cxoSessionPool_init(cxoSessionPool*, PyObject*, PyObject*);
|
||||
static void cxoSessionPool_free(cxoSessionPool*);
|
||||
static PyObject *cxoSessionPool_acquire(cxoSessionPool*, PyObject*, PyObject*);
|
||||
static PyObject *cxoSessionPool_close(cxoSessionPool*, PyObject*, PyObject*);
|
||||
static PyObject *cxoSessionPool_drop(cxoSessionPool*, PyObject*);
|
||||
static PyObject *cxoSessionPool_release(cxoSessionPool*, PyObject*, PyObject*);
|
||||
static PyObject *cxoSessionPool_getBusyCount(cxoSessionPool*, void*);
|
||||
static PyObject *cxoSessionPool_getGetMode(cxoSessionPool*, void*);
|
||||
static PyObject *cxoSessionPool_getMaxLifetimeSession(cxoSessionPool*, void*);
|
||||
static PyObject *cxoSessionPool_getOpenCount(cxoSessionPool*, void*);
|
||||
static PyObject *cxoSessionPool_getStmtCacheSize(cxoSessionPool*, void*);
|
||||
static PyObject *cxoSessionPool_getTimeout(cxoSessionPool*, void*);
|
||||
static PyObject *cxoSessionPool_getWaitTimeout(cxoSessionPool*, void*);
|
||||
static int cxoSessionPool_setGetMode(cxoSessionPool*, PyObject*, void*);
|
||||
static int cxoSessionPool_setMaxLifetimeSession(cxoSessionPool*, PyObject*,
|
||||
void*);
|
||||
static int cxoSessionPool_setStmtCacheSize(cxoSessionPool*, PyObject*, void*);
|
||||
static int cxoSessionPool_setTimeout(cxoSessionPool*, PyObject*, void*);
|
||||
static int cxoSessionPool_setWaitTimeout(cxoSessionPool*, PyObject*, void*);
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of methods for Python type "SessionPool"
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyMethodDef cxoSessionPoolMethods[] = {
|
||||
{ "acquire", (PyCFunction) cxoSessionPool_acquire,
|
||||
METH_VARARGS | METH_KEYWORDS },
|
||||
{ "close", (PyCFunction) cxoSessionPool_close,
|
||||
METH_VARARGS | METH_KEYWORDS },
|
||||
{ "drop", (PyCFunction) cxoSessionPool_drop, METH_VARARGS },
|
||||
{ "release", (PyCFunction) cxoSessionPool_release,
|
||||
METH_VARARGS | METH_KEYWORDS },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of members for Python type "SessionPool"
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyMemberDef cxoSessionPoolMembers[] = {
|
||||
{ "username", T_OBJECT, offsetof(cxoSessionPool, username), READONLY },
|
||||
{ "dsn", T_OBJECT, offsetof(cxoSessionPool, dsn), READONLY },
|
||||
{ "tnsentry", T_OBJECT, offsetof(cxoSessionPool, dsn), READONLY },
|
||||
{ "name", T_OBJECT, offsetof(cxoSessionPool, name), READONLY },
|
||||
{ "max", T_INT, offsetof(cxoSessionPool, maxSessions), READONLY },
|
||||
{ "min", T_INT, offsetof(cxoSessionPool, minSessions), READONLY },
|
||||
{ "increment", T_INT, offsetof(cxoSessionPool, sessionIncrement),
|
||||
READONLY },
|
||||
{ "homogeneous", T_INT, offsetof(cxoSessionPool, homogeneous), READONLY },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of calculated members for Python type "SessionPool"
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyGetSetDef cxoSessionPoolCalcMembers[] = {
|
||||
{ "opened", (getter) cxoSessionPool_getOpenCount, 0, 0, 0 },
|
||||
{ "busy", (getter) cxoSessionPool_getBusyCount, 0, 0, 0 },
|
||||
{ "timeout", (getter) cxoSessionPool_getTimeout,
|
||||
(setter) cxoSessionPool_setTimeout, 0, 0 },
|
||||
{ "getmode", (getter) cxoSessionPool_getGetMode,
|
||||
(setter) cxoSessionPool_setGetMode, 0, 0 },
|
||||
{ "max_lifetime_session", (getter) cxoSessionPool_getMaxLifetimeSession,
|
||||
(setter) cxoSessionPool_setMaxLifetimeSession, 0, 0 },
|
||||
{ "stmtcachesize", (getter) cxoSessionPool_getStmtCacheSize,
|
||||
(setter) cxoSessionPool_setStmtCacheSize, 0, 0 },
|
||||
{ "wait_timeout", (getter) cxoSessionPool_getWaitTimeout,
|
||||
(setter) cxoSessionPool_setWaitTimeout, 0, 0 },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of Python type "SessionPool"
|
||||
//-----------------------------------------------------------------------------
|
||||
PyTypeObject cxoPyTypeSessionPool = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
.tp_name = "cx_Oracle.SessionPool",
|
||||
.tp_basicsize = sizeof(cxoSessionPool),
|
||||
.tp_dealloc = (destructor) cxoSessionPool_free,
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
|
||||
.tp_methods = cxoSessionPoolMethods,
|
||||
.tp_members = cxoSessionPoolMembers,
|
||||
.tp_getset = cxoSessionPoolCalcMembers,
|
||||
.tp_init = (initproc) cxoSessionPool_init,
|
||||
.tp_new = (newfunc) cxoSessionPool_new
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// cxoSessionPool_new()
|
||||
// Create a new session pool object.
|
||||
@ -618,3 +524,72 @@ static int cxoSessionPool_setWaitTimeout(cxoSessionPool *pool, PyObject *value,
|
||||
{
|
||||
return cxoSessionPool_setAttribute(pool, value, dpiPool_setWaitTimeout);
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of methods for Python type
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyMethodDef cxoMethods[] = {
|
||||
{ "acquire", (PyCFunction) cxoSessionPool_acquire,
|
||||
METH_VARARGS | METH_KEYWORDS },
|
||||
{ "close", (PyCFunction) cxoSessionPool_close,
|
||||
METH_VARARGS | METH_KEYWORDS },
|
||||
{ "drop", (PyCFunction) cxoSessionPool_drop, METH_VARARGS },
|
||||
{ "release", (PyCFunction) cxoSessionPool_release,
|
||||
METH_VARARGS | METH_KEYWORDS },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of members for Python type
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyMemberDef cxoMembers[] = {
|
||||
{ "username", T_OBJECT, offsetof(cxoSessionPool, username), READONLY },
|
||||
{ "dsn", T_OBJECT, offsetof(cxoSessionPool, dsn), READONLY },
|
||||
{ "tnsentry", T_OBJECT, offsetof(cxoSessionPool, dsn), READONLY },
|
||||
{ "name", T_OBJECT, offsetof(cxoSessionPool, name), READONLY },
|
||||
{ "max", T_INT, offsetof(cxoSessionPool, maxSessions), READONLY },
|
||||
{ "min", T_INT, offsetof(cxoSessionPool, minSessions), READONLY },
|
||||
{ "increment", T_INT, offsetof(cxoSessionPool, sessionIncrement),
|
||||
READONLY },
|
||||
{ "homogeneous", T_INT, offsetof(cxoSessionPool, homogeneous), READONLY },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of calculated members for Python type
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyGetSetDef cxoCalcMembers[] = {
|
||||
{ "opened", (getter) cxoSessionPool_getOpenCount, 0, 0, 0 },
|
||||
{ "busy", (getter) cxoSessionPool_getBusyCount, 0, 0, 0 },
|
||||
{ "timeout", (getter) cxoSessionPool_getTimeout,
|
||||
(setter) cxoSessionPool_setTimeout, 0, 0 },
|
||||
{ "getmode", (getter) cxoSessionPool_getGetMode,
|
||||
(setter) cxoSessionPool_setGetMode, 0, 0 },
|
||||
{ "max_lifetime_session", (getter) cxoSessionPool_getMaxLifetimeSession,
|
||||
(setter) cxoSessionPool_setMaxLifetimeSession, 0, 0 },
|
||||
{ "stmtcachesize", (getter) cxoSessionPool_getStmtCacheSize,
|
||||
(setter) cxoSessionPool_setStmtCacheSize, 0, 0 },
|
||||
{ "wait_timeout", (getter) cxoSessionPool_getWaitTimeout,
|
||||
(setter) cxoSessionPool_setWaitTimeout, 0, 0 },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of Python type
|
||||
//-----------------------------------------------------------------------------
|
||||
PyTypeObject cxoPyTypeSessionPool = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
.tp_name = "cx_Oracle.SessionPool",
|
||||
.tp_basicsize = sizeof(cxoSessionPool),
|
||||
.tp_dealloc = (destructor) cxoSessionPool_free,
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
|
||||
.tp_methods = cxoMethods,
|
||||
.tp_members = cxoMembers,
|
||||
.tp_getset = cxoCalcMembers,
|
||||
.tp_init = (initproc) cxoSessionPool_init,
|
||||
.tp_new = (newfunc) cxoSessionPool_new
|
||||
};
|
||||
|
||||
@ -9,89 +9,6 @@
|
||||
|
||||
#include "cxoModule.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of functions
|
||||
//-----------------------------------------------------------------------------
|
||||
static void cxoSodaCollection_free(cxoSodaCollection*);
|
||||
static PyObject *cxoSodaCollection_repr(cxoSodaCollection*);
|
||||
static PyObject *cxoSodaCollection_createIndex(cxoSodaCollection*, PyObject*);
|
||||
static PyObject *cxoSodaCollection_drop(cxoSodaCollection*, PyObject*);
|
||||
static PyObject *cxoSodaCollection_dropIndex(cxoSodaCollection*, PyObject*,
|
||||
PyObject*);
|
||||
static PyObject *cxoSodaCollection_find(cxoSodaCollection*, PyObject*);
|
||||
static PyObject *cxoSodaCollection_getDataGuide(cxoSodaCollection*, PyObject*);
|
||||
static PyObject *cxoSodaCollection_insertMany(cxoSodaCollection*, PyObject*);
|
||||
static PyObject *cxoSodaCollection_insertManyAndGet(cxoSodaCollection*,
|
||||
PyObject*);
|
||||
static PyObject *cxoSodaCollection_insertManyHelper(cxoSodaCollection *coll,
|
||||
PyObject *docs, Py_ssize_t numDocs, dpiSodaDoc **handles,
|
||||
dpiSodaDoc **returnHandles);
|
||||
static PyObject *cxoSodaCollection_insertOne(cxoSodaCollection*, PyObject*);
|
||||
static PyObject *cxoSodaCollection_insertOneAndGet(cxoSodaCollection*,
|
||||
PyObject*);
|
||||
static PyObject *cxoSodaCollection_getMetadata(cxoSodaCollection*, PyObject*);
|
||||
static PyObject *cxoSodaCollection_save(cxoSodaCollection*, PyObject*);
|
||||
static PyObject *cxoSodaCollection_saveAndGet(cxoSodaCollection*, PyObject*);
|
||||
static PyObject *cxoSodaCollection_truncate(cxoSodaCollection*, PyObject*);
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of methods
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyMethodDef cxoMethods[] = {
|
||||
{ "createIndex", (PyCFunction) cxoSodaCollection_createIndex, METH_O },
|
||||
{ "drop", (PyCFunction) cxoSodaCollection_drop, METH_NOARGS },
|
||||
{ "dropIndex", (PyCFunction) cxoSodaCollection_dropIndex,
|
||||
METH_VARARGS | METH_KEYWORDS },
|
||||
{ "find", (PyCFunction) cxoSodaCollection_find, METH_NOARGS },
|
||||
{ "getDataGuide", (PyCFunction) cxoSodaCollection_getDataGuide,
|
||||
METH_NOARGS },
|
||||
{ "insertOne", (PyCFunction) cxoSodaCollection_insertOne, METH_O },
|
||||
{ "insertOneAndGet", (PyCFunction) cxoSodaCollection_insertOneAndGet,
|
||||
METH_O },
|
||||
{ "insertMany", (PyCFunction) cxoSodaCollection_insertMany, METH_O },
|
||||
{ "insertManyAndGet", (PyCFunction) cxoSodaCollection_insertManyAndGet,
|
||||
METH_O },
|
||||
{ "save", (PyCFunction) cxoSodaCollection_save, METH_O },
|
||||
{ "saveAndGet", (PyCFunction) cxoSodaCollection_saveAndGet, METH_O },
|
||||
{ "truncate", (PyCFunction) cxoSodaCollection_truncate, METH_NOARGS },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of members
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyMemberDef cxoMembers[] = {
|
||||
{ "name", T_OBJECT, offsetof(cxoSodaCollection, name), READONLY },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of calculated members
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyGetSetDef cxoCalcMembers[] = {
|
||||
{ "metadata", (getter) cxoSodaCollection_getMetadata, 0, 0, 0 },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Python type declarations
|
||||
//-----------------------------------------------------------------------------
|
||||
PyTypeObject cxoPyTypeSodaCollection = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
.tp_name = "cx_Oracle.SodaCollection",
|
||||
.tp_basicsize = sizeof(cxoSodaCollection),
|
||||
.tp_dealloc = (destructor) cxoSodaCollection_free,
|
||||
.tp_repr = (reprfunc) cxoSodaCollection_repr,
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT,
|
||||
.tp_methods = cxoMethods,
|
||||
.tp_members = cxoMembers,
|
||||
.tp_getset = cxoCalcMembers
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// cxoSodaCollection_initialize()
|
||||
// Initialize a new collection with its attributes.
|
||||
@ -305,70 +222,6 @@ static PyObject *cxoSodaCollection_getDataGuide(cxoSodaCollection *coll,
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// cxoSodaCollection_insertMany()
|
||||
// Inserts multilple document into the collection at one time.
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyObject *cxoSodaCollection_insertMany(cxoSodaCollection *coll,
|
||||
PyObject *arg)
|
||||
{
|
||||
dpiSodaDoc **handles;
|
||||
Py_ssize_t numDocs;
|
||||
PyObject *result;
|
||||
|
||||
if (!PyList_Check(arg)) {
|
||||
PyErr_SetString(PyExc_TypeError, "expecting list");
|
||||
return NULL;
|
||||
}
|
||||
numDocs = PyList_GET_SIZE(arg);
|
||||
handles = PyMem_Malloc(numDocs * sizeof(dpiSodaDoc*));
|
||||
if (!handles) {
|
||||
PyErr_NoMemory();
|
||||
return NULL;
|
||||
}
|
||||
result = cxoSodaCollection_insertManyHelper(coll, arg, numDocs, handles,
|
||||
NULL);
|
||||
PyMem_Free(handles);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// cxoSodaCollection_insertManyAndGet()
|
||||
// Inserts multiple documents into the collection at one time and return a
|
||||
// list of documents containing all but the content itself.
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyObject *cxoSodaCollection_insertManyAndGet(cxoSodaCollection *coll,
|
||||
PyObject *arg)
|
||||
{
|
||||
dpiSodaDoc **handles, **returnHandles;
|
||||
Py_ssize_t numDocs;
|
||||
PyObject *result;
|
||||
|
||||
if (!PyList_Check(arg)) {
|
||||
PyErr_SetString(PyExc_TypeError, "expecting list");
|
||||
return NULL;
|
||||
}
|
||||
numDocs = PyList_GET_SIZE(arg);
|
||||
handles = PyMem_Malloc(numDocs * sizeof(dpiSodaDoc*));
|
||||
if (!handles) {
|
||||
PyErr_NoMemory();
|
||||
return NULL;
|
||||
}
|
||||
returnHandles = PyMem_Malloc(numDocs * sizeof(dpiSodaDoc*));
|
||||
if (!returnHandles) {
|
||||
PyErr_NoMemory();
|
||||
PyMem_Free(handles);
|
||||
return NULL;
|
||||
}
|
||||
result = cxoSodaCollection_insertManyHelper(coll, arg, numDocs, handles,
|
||||
returnHandles);
|
||||
PyMem_Free(handles);
|
||||
PyMem_Free(returnHandles);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// cxoSodaCollection_insertManyHelper()
|
||||
// Helper method to perform bulk insert of SODA documents into a collection.
|
||||
@ -434,6 +287,70 @@ static PyObject *cxoSodaCollection_insertManyHelper(cxoSodaCollection *coll,
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// cxoSodaCollection_insertMany()
|
||||
// Inserts multilple document into the collection at one time.
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyObject *cxoSodaCollection_insertMany(cxoSodaCollection *coll,
|
||||
PyObject *arg)
|
||||
{
|
||||
dpiSodaDoc **handles;
|
||||
Py_ssize_t numDocs;
|
||||
PyObject *result;
|
||||
|
||||
if (!PyList_Check(arg)) {
|
||||
PyErr_SetString(PyExc_TypeError, "expecting list");
|
||||
return NULL;
|
||||
}
|
||||
numDocs = PyList_GET_SIZE(arg);
|
||||
handles = PyMem_Malloc(numDocs * sizeof(dpiSodaDoc*));
|
||||
if (!handles) {
|
||||
PyErr_NoMemory();
|
||||
return NULL;
|
||||
}
|
||||
result = cxoSodaCollection_insertManyHelper(coll, arg, numDocs, handles,
|
||||
NULL);
|
||||
PyMem_Free(handles);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// cxoSodaCollection_insertManyAndGet()
|
||||
// Inserts multiple documents into the collection at one time and return a
|
||||
// list of documents containing all but the content itself.
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyObject *cxoSodaCollection_insertManyAndGet(cxoSodaCollection *coll,
|
||||
PyObject *arg)
|
||||
{
|
||||
dpiSodaDoc **handles, **returnHandles;
|
||||
Py_ssize_t numDocs;
|
||||
PyObject *result;
|
||||
|
||||
if (!PyList_Check(arg)) {
|
||||
PyErr_SetString(PyExc_TypeError, "expecting list");
|
||||
return NULL;
|
||||
}
|
||||
numDocs = PyList_GET_SIZE(arg);
|
||||
handles = PyMem_Malloc(numDocs * sizeof(dpiSodaDoc*));
|
||||
if (!handles) {
|
||||
PyErr_NoMemory();
|
||||
return NULL;
|
||||
}
|
||||
returnHandles = PyMem_Malloc(numDocs * sizeof(dpiSodaDoc*));
|
||||
if (!returnHandles) {
|
||||
PyErr_NoMemory();
|
||||
PyMem_Free(handles);
|
||||
return NULL;
|
||||
}
|
||||
result = cxoSodaCollection_insertManyHelper(coll, arg, numDocs, handles,
|
||||
returnHandles);
|
||||
PyMem_Free(handles);
|
||||
PyMem_Free(returnHandles);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// cxoSodaCollection_insertOne()
|
||||
// Insert a single document into the collection.
|
||||
@ -584,3 +501,61 @@ static PyObject *cxoSodaCollection_truncate(cxoSodaCollection *coll,
|
||||
return cxoError_raiseAndReturnNull();
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of methods
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyMethodDef cxoMethods[] = {
|
||||
{ "createIndex", (PyCFunction) cxoSodaCollection_createIndex, METH_O },
|
||||
{ "drop", (PyCFunction) cxoSodaCollection_drop, METH_NOARGS },
|
||||
{ "dropIndex", (PyCFunction) cxoSodaCollection_dropIndex,
|
||||
METH_VARARGS | METH_KEYWORDS },
|
||||
{ "find", (PyCFunction) cxoSodaCollection_find, METH_NOARGS },
|
||||
{ "getDataGuide", (PyCFunction) cxoSodaCollection_getDataGuide,
|
||||
METH_NOARGS },
|
||||
{ "insertOne", (PyCFunction) cxoSodaCollection_insertOne, METH_O },
|
||||
{ "insertOneAndGet", (PyCFunction) cxoSodaCollection_insertOneAndGet,
|
||||
METH_O },
|
||||
{ "insertMany", (PyCFunction) cxoSodaCollection_insertMany, METH_O },
|
||||
{ "insertManyAndGet", (PyCFunction) cxoSodaCollection_insertManyAndGet,
|
||||
METH_O },
|
||||
{ "save", (PyCFunction) cxoSodaCollection_save, METH_O },
|
||||
{ "saveAndGet", (PyCFunction) cxoSodaCollection_saveAndGet, METH_O },
|
||||
{ "truncate", (PyCFunction) cxoSodaCollection_truncate, METH_NOARGS },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of members
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyMemberDef cxoMembers[] = {
|
||||
{ "name", T_OBJECT, offsetof(cxoSodaCollection, name), READONLY },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of calculated members
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyGetSetDef cxoCalcMembers[] = {
|
||||
{ "metadata", (getter) cxoSodaCollection_getMetadata, 0, 0, 0 },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Python type declarations
|
||||
//-----------------------------------------------------------------------------
|
||||
PyTypeObject cxoPyTypeSodaCollection = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
.tp_name = "cx_Oracle.SodaCollection",
|
||||
.tp_basicsize = sizeof(cxoSodaCollection),
|
||||
.tp_dealloc = (destructor) cxoSodaCollection_free,
|
||||
.tp_repr = (reprfunc) cxoSodaCollection_repr,
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT,
|
||||
.tp_methods = cxoMethods,
|
||||
.tp_members = cxoMembers,
|
||||
.tp_getset = cxoCalcMembers
|
||||
};
|
||||
|
||||
@ -9,49 +9,6 @@
|
||||
|
||||
#include "cxoModule.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Declaration of functions
|
||||
//-----------------------------------------------------------------------------
|
||||
static void cxoSodaDatabase_free(cxoSodaDatabase*);
|
||||
static PyObject *cxoSodaDatabase_repr(cxoSodaDatabase*);
|
||||
static PyObject *cxoSodaDatabase_createCollection(cxoSodaDatabase*,
|
||||
PyObject*, PyObject*);
|
||||
static PyObject *cxoSodaDatabase_createDocument(cxoSodaDatabase*,
|
||||
PyObject*, PyObject*);
|
||||
static PyObject *cxoSodaDatabase_getCollectionNames(cxoSodaDatabase*,
|
||||
PyObject*, PyObject*);
|
||||
static PyObject *cxoSodaDatabase_openCollection(cxoSodaDatabase*, PyObject*);
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of methods for Python type "SodaDatabase"
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyMethodDef cxoMethods[] = {
|
||||
{ "createCollection", (PyCFunction) cxoSodaDatabase_createCollection,
|
||||
METH_VARARGS | METH_KEYWORDS },
|
||||
{ "createDocument", (PyCFunction) cxoSodaDatabase_createDocument,
|
||||
METH_VARARGS | METH_KEYWORDS },
|
||||
{ "getCollectionNames", (PyCFunction) cxoSodaDatabase_getCollectionNames,
|
||||
METH_VARARGS | METH_KEYWORDS },
|
||||
{ "openCollection", (PyCFunction) cxoSodaDatabase_openCollection, METH_O },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Python type declarations
|
||||
//-----------------------------------------------------------------------------
|
||||
PyTypeObject cxoPyTypeSodaDatabase = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
.tp_name = "cx_Oracle.SodaDatabase",
|
||||
.tp_basicsize = sizeof(cxoSodaDatabase),
|
||||
.tp_dealloc = (destructor) cxoSodaDatabase_free,
|
||||
.tp_repr = (reprfunc) cxoSodaDatabase_repr,
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT,
|
||||
.tp_methods = cxoMethods
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// cxoSodaDatabase_new()
|
||||
// Create a new SODA database object.
|
||||
@ -344,3 +301,32 @@ static PyObject *cxoSodaDatabase_openCollection(cxoSodaDatabase *db,
|
||||
|
||||
return (PyObject*) coll;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of methods for Python type
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyMethodDef cxoMethods[] = {
|
||||
{ "createCollection", (PyCFunction) cxoSodaDatabase_createCollection,
|
||||
METH_VARARGS | METH_KEYWORDS },
|
||||
{ "createDocument", (PyCFunction) cxoSodaDatabase_createDocument,
|
||||
METH_VARARGS | METH_KEYWORDS },
|
||||
{ "getCollectionNames", (PyCFunction) cxoSodaDatabase_getCollectionNames,
|
||||
METH_VARARGS | METH_KEYWORDS },
|
||||
{ "openCollection", (PyCFunction) cxoSodaDatabase_openCollection, METH_O },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of Python type
|
||||
//-----------------------------------------------------------------------------
|
||||
PyTypeObject cxoPyTypeSodaDatabase = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
.tp_name = "cx_Oracle.SodaDatabase",
|
||||
.tp_basicsize = sizeof(cxoSodaDatabase),
|
||||
.tp_dealloc = (destructor) cxoSodaDatabase_free,
|
||||
.tp_repr = (reprfunc) cxoSodaDatabase_repr,
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT,
|
||||
.tp_methods = cxoMethods
|
||||
};
|
||||
|
||||
@ -9,60 +9,9 @@
|
||||
|
||||
#include "cxoModule.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Declaration of functions
|
||||
//-----------------------------------------------------------------------------
|
||||
static void cxoSodaDoc_free(cxoSodaDoc*);
|
||||
static PyObject *cxoSodaDoc_repr(cxoSodaDoc*);
|
||||
static PyObject *cxoSodaDoc_getCreatedOn(cxoSodaDoc*, void*);
|
||||
static PyObject *cxoSodaDoc_getKey(cxoSodaDoc*, void*);
|
||||
static PyObject *cxoSodaDoc_getLastModified(cxoSodaDoc*, void*);
|
||||
static PyObject *cxoSodaDoc_getMediaType(cxoSodaDoc*, void*);
|
||||
static PyObject *cxoSodaDoc_getVersion(cxoSodaDoc*, void*);
|
||||
static PyObject *cxoSodaDoc_getContent(cxoSodaDoc*, PyObject*);
|
||||
static PyObject *cxoSodaDoc_getContentAsBytes(cxoSodaDoc*, PyObject*);
|
||||
static PyObject *cxoSodaDoc_getContentAsString(cxoSodaDoc*, PyObject*);
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of methods
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyMethodDef cxoMethods[] = {
|
||||
{ "getContent", (PyCFunction) cxoSodaDoc_getContent, METH_NOARGS },
|
||||
{ "getContentAsBytes", (PyCFunction) cxoSodaDoc_getContentAsBytes,
|
||||
METH_NOARGS },
|
||||
{ "getContentAsString", (PyCFunction) cxoSodaDoc_getContentAsString,
|
||||
METH_NOARGS },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of calculated members
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyGetSetDef cxoCalcMembers[] = {
|
||||
{ "createdOn", (getter) cxoSodaDoc_getCreatedOn, 0, 0, 0 },
|
||||
{ "key", (getter) cxoSodaDoc_getKey, 0, 0, 0 },
|
||||
{ "lastModified", (getter) cxoSodaDoc_getLastModified, 0, 0, 0 },
|
||||
{ "mediaType", (getter) cxoSodaDoc_getMediaType, 0, 0, 0 },
|
||||
{ "version", (getter) cxoSodaDoc_getVersion, 0, 0, 0 },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Python type declarations
|
||||
//-----------------------------------------------------------------------------
|
||||
PyTypeObject cxoPyTypeSodaDoc = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
.tp_name = "cx_Oracle.SodaDoc",
|
||||
.tp_basicsize = sizeof(cxoSodaDoc),
|
||||
.tp_dealloc = (destructor) cxoSodaDoc_free,
|
||||
.tp_repr = (reprfunc) cxoSodaDoc_repr,
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT,
|
||||
.tp_methods = cxoMethods,
|
||||
.tp_getset = cxoCalcMembers
|
||||
};
|
||||
// forward declarations
|
||||
static PyObject *cxoSodaDoc_getContentAsString(cxoSodaDoc *doc,
|
||||
PyObject *args);
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -273,3 +222,44 @@ static PyObject *cxoSodaDoc_getContentAsString(cxoSodaDoc *doc, PyObject *args)
|
||||
return PyUnicode_Decode(content, contentLength, encoding, NULL);
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of methods
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyMethodDef cxoMethods[] = {
|
||||
{ "getContent", (PyCFunction) cxoSodaDoc_getContent, METH_NOARGS },
|
||||
{ "getContentAsBytes", (PyCFunction) cxoSodaDoc_getContentAsBytes,
|
||||
METH_NOARGS },
|
||||
{ "getContentAsString", (PyCFunction) cxoSodaDoc_getContentAsString,
|
||||
METH_NOARGS },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of calculated members
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyGetSetDef cxoCalcMembers[] = {
|
||||
{ "createdOn", (getter) cxoSodaDoc_getCreatedOn, 0, 0, 0 },
|
||||
{ "key", (getter) cxoSodaDoc_getKey, 0, 0, 0 },
|
||||
{ "lastModified", (getter) cxoSodaDoc_getLastModified, 0, 0, 0 },
|
||||
{ "mediaType", (getter) cxoSodaDoc_getMediaType, 0, 0, 0 },
|
||||
{ "version", (getter) cxoSodaDoc_getVersion, 0, 0, 0 },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of Python type
|
||||
//-----------------------------------------------------------------------------
|
||||
PyTypeObject cxoPyTypeSodaDoc = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
.tp_name = "cx_Oracle.SodaDoc",
|
||||
.tp_basicsize = sizeof(cxoSodaDoc),
|
||||
.tp_dealloc = (destructor) cxoSodaDoc_free,
|
||||
.tp_repr = (reprfunc) cxoSodaDoc_repr,
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT,
|
||||
.tp_methods = cxoMethods,
|
||||
.tp_getset = cxoCalcMembers
|
||||
};
|
||||
|
||||
@ -11,41 +11,6 @@
|
||||
|
||||
#include "cxoModule.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Declaration of functions
|
||||
//-----------------------------------------------------------------------------
|
||||
static void cxoSodaDocCursor_free(cxoSodaDocCursor*);
|
||||
static PyObject *cxoSodaDocCursor_repr(cxoSodaDocCursor*);
|
||||
static PyObject *cxoSodaDocCursor_getIter(cxoSodaDocCursor*);
|
||||
static PyObject *cxoSodaDocCursor_getNext(cxoSodaDocCursor*);
|
||||
static PyObject *cxoSodaDocCursor_close(cxoSodaDocCursor*, PyObject*);
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of methods
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyMethodDef cxoMethods[] = {
|
||||
{ "close", (PyCFunction) cxoSodaDocCursor_close, METH_NOARGS },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Python type declarations
|
||||
//-----------------------------------------------------------------------------
|
||||
PyTypeObject cxoPyTypeSodaDocCursor = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
.tp_name = "cx_Oracle.SodaDocCursor",
|
||||
.tp_basicsize = sizeof(cxoSodaDocCursor),
|
||||
.tp_dealloc = (destructor) cxoSodaDocCursor_free,
|
||||
.tp_repr = (reprfunc) cxoSodaDocCursor_repr,
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT,
|
||||
.tp_iter = (getiterfunc) cxoSodaDocCursor_getIter,
|
||||
.tp_iternext = (iternextfunc) cxoSodaDocCursor_getNext,
|
||||
.tp_methods = cxoMethods
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// cxoSodaDocCursor_new()
|
||||
// Create a new SODA document cursor.
|
||||
@ -149,3 +114,28 @@ static PyObject *cxoSodaDocCursor_getNext(cxoSodaDocCursor *cursor)
|
||||
return NULL;
|
||||
return (PyObject*) doc;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of methods
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyMethodDef cxoMethods[] = {
|
||||
{ "close", (PyCFunction) cxoSodaDocCursor_close, METH_NOARGS },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Python type declarations
|
||||
//-----------------------------------------------------------------------------
|
||||
PyTypeObject cxoPyTypeSodaDocCursor = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
.tp_name = "cx_Oracle.SodaDocCursor",
|
||||
.tp_basicsize = sizeof(cxoSodaDocCursor),
|
||||
.tp_dealloc = (destructor) cxoSodaDocCursor_free,
|
||||
.tp_repr = (reprfunc) cxoSodaDocCursor_repr,
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT,
|
||||
.tp_iter = (getiterfunc) cxoSodaDocCursor_getIter,
|
||||
.tp_iternext = (iternextfunc) cxoSodaDocCursor_getNext,
|
||||
.tp_methods = cxoMethods
|
||||
};
|
||||
|
||||
@ -10,67 +10,6 @@
|
||||
|
||||
#include "cxoModule.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Declaration of functions
|
||||
//-----------------------------------------------------------------------------
|
||||
static void cxoSodaOperation_free(cxoSodaOperation*);
|
||||
static PyObject *cxoSodaOperation_repr(cxoSodaOperation*);
|
||||
static PyObject *cxoSodaOperation_filter(cxoSodaOperation*, PyObject*);
|
||||
static PyObject *cxoSodaOperation_key(cxoSodaOperation*, PyObject*);
|
||||
static PyObject *cxoSodaOperation_keys(cxoSodaOperation*, PyObject*);
|
||||
static PyObject *cxoSodaOperation_limit(cxoSodaOperation*, PyObject*);
|
||||
static PyObject *cxoSodaOperation_skip(cxoSodaOperation*, PyObject*);
|
||||
static PyObject *cxoSodaOperation_version(cxoSodaOperation*, PyObject*);
|
||||
static PyObject *cxoSodaOperation_count(cxoSodaOperation*, PyObject*);
|
||||
static PyObject *cxoSodaOperation_getCursor(cxoSodaOperation*, PyObject*);
|
||||
static PyObject *cxoSodaOperation_getDocuments(cxoSodaOperation*, PyObject*);
|
||||
static PyObject *cxoSodaOperation_getOne(cxoSodaOperation*, PyObject*);
|
||||
static PyObject *cxoSodaOperation_remove(cxoSodaOperation*, PyObject*);
|
||||
static PyObject *cxoSodaOperation_replaceOne(cxoSodaOperation*, PyObject*);
|
||||
static PyObject *cxoSodaOperation_replaceOneAndGet(cxoSodaOperation*,
|
||||
PyObject*);
|
||||
static PyObject *cxoSodaOperation_fetchArraySize(cxoSodaOperation*, PyObject*);
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of methods for Python type "SodaOperation"
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyMethodDef cxoMethods[] = {
|
||||
{ "filter", (PyCFunction) cxoSodaOperation_filter, METH_O },
|
||||
{ "key", (PyCFunction) cxoSodaOperation_key, METH_O },
|
||||
{ "keys", (PyCFunction) cxoSodaOperation_keys, METH_O },
|
||||
{ "limit", (PyCFunction) cxoSodaOperation_limit, METH_O },
|
||||
{ "skip", (PyCFunction) cxoSodaOperation_skip, METH_O },
|
||||
{ "version", (PyCFunction) cxoSodaOperation_version, METH_O },
|
||||
{ "count", (PyCFunction) cxoSodaOperation_count, METH_NOARGS },
|
||||
{ "getCursor", (PyCFunction) cxoSodaOperation_getCursor, METH_NOARGS },
|
||||
{ "getDocuments", (PyCFunction) cxoSodaOperation_getDocuments,
|
||||
METH_NOARGS },
|
||||
{ "getOne", (PyCFunction) cxoSodaOperation_getOne, METH_NOARGS },
|
||||
{ "remove", (PyCFunction) cxoSodaOperation_remove, METH_NOARGS },
|
||||
{ "replaceOne", (PyCFunction) cxoSodaOperation_replaceOne, METH_O },
|
||||
{ "replaceOneAndGet", (PyCFunction) cxoSodaOperation_replaceOneAndGet,
|
||||
METH_O },
|
||||
{ "fetchArraySize", (PyCFunction) cxoSodaOperation_fetchArraySize,
|
||||
METH_O },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Python type declarations
|
||||
//-----------------------------------------------------------------------------
|
||||
PyTypeObject cxoPyTypeSodaOperation = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
.tp_name = "cx_Oracle.SodaOperation",
|
||||
.tp_basicsize = sizeof(cxoSodaOperation),
|
||||
.tp_dealloc = (destructor) cxoSodaOperation_free,
|
||||
.tp_repr = (reprfunc) cxoSodaOperation_repr,
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT,
|
||||
.tp_methods = cxoMethods
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// cxoSodaOperation_clearKeys()
|
||||
// Clear the keys set on the operation object, if applicable.
|
||||
@ -542,3 +481,42 @@ static PyObject *cxoSodaOperation_fetchArraySize(cxoSodaOperation *op,
|
||||
Py_INCREF(op);
|
||||
return (PyObject*) op;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of methods for Python type
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyMethodDef cxoMethods[] = {
|
||||
{ "filter", (PyCFunction) cxoSodaOperation_filter, METH_O },
|
||||
{ "key", (PyCFunction) cxoSodaOperation_key, METH_O },
|
||||
{ "keys", (PyCFunction) cxoSodaOperation_keys, METH_O },
|
||||
{ "limit", (PyCFunction) cxoSodaOperation_limit, METH_O },
|
||||
{ "skip", (PyCFunction) cxoSodaOperation_skip, METH_O },
|
||||
{ "version", (PyCFunction) cxoSodaOperation_version, METH_O },
|
||||
{ "count", (PyCFunction) cxoSodaOperation_count, METH_NOARGS },
|
||||
{ "getCursor", (PyCFunction) cxoSodaOperation_getCursor, METH_NOARGS },
|
||||
{ "getDocuments", (PyCFunction) cxoSodaOperation_getDocuments,
|
||||
METH_NOARGS },
|
||||
{ "getOne", (PyCFunction) cxoSodaOperation_getOne, METH_NOARGS },
|
||||
{ "remove", (PyCFunction) cxoSodaOperation_remove, METH_NOARGS },
|
||||
{ "replaceOne", (PyCFunction) cxoSodaOperation_replaceOne, METH_O },
|
||||
{ "replaceOneAndGet", (PyCFunction) cxoSodaOperation_replaceOneAndGet,
|
||||
METH_O },
|
||||
{ "fetchArraySize", (PyCFunction) cxoSodaOperation_fetchArraySize,
|
||||
METH_O },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of Python type
|
||||
//-----------------------------------------------------------------------------
|
||||
PyTypeObject cxoPyTypeSodaOperation = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
.tp_name = "cx_Oracle.SodaOperation",
|
||||
.tp_basicsize = sizeof(cxoSodaOperation),
|
||||
.tp_dealloc = (destructor) cxoSodaOperation_free,
|
||||
.tp_repr = (reprfunc) cxoSodaOperation_repr,
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT,
|
||||
.tp_methods = cxoMethods
|
||||
};
|
||||
|
||||
245
src/cxoSubscr.c
245
src/cxoSubscr.c
@ -14,134 +14,6 @@
|
||||
|
||||
#include "cxoModule.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Declaration of subscription functions
|
||||
//-----------------------------------------------------------------------------
|
||||
static void cxoSubscr_free(cxoSubscr*);
|
||||
static PyObject *cxoSubscr_repr(cxoSubscr*);
|
||||
static PyObject *cxoSubscr_registerQuery(cxoSubscr*, PyObject*);
|
||||
static void cxoMessage_free(cxoMessage*);
|
||||
static void cxoMessageTable_free(cxoMessageTable*);
|
||||
static void cxoMessageRow_free(cxoMessageRow*);
|
||||
static void cxoMessageQuery_free(cxoMessageQuery*);
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of members for Python types
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyMemberDef cxoSubscrTypeMembers[] = {
|
||||
{ "callback", T_OBJECT, offsetof(cxoSubscr, callback), READONLY },
|
||||
{ "connection", T_OBJECT, offsetof(cxoSubscr, connection),
|
||||
READONLY },
|
||||
{ "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 },
|
||||
{ "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 },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
static PyMemberDef cxoMessageTypeMembers[] = {
|
||||
{ "subscription", T_OBJECT, offsetof(cxoMessage, subscription),
|
||||
READONLY },
|
||||
{ "type", T_INT, offsetof(cxoMessage, type), READONLY },
|
||||
{ "dbname", T_OBJECT, offsetof(cxoMessage, dbname), READONLY },
|
||||
{ "txid", T_OBJECT, offsetof(cxoMessage, txId), READONLY },
|
||||
{ "tables", T_OBJECT, offsetof(cxoMessage, tables), READONLY },
|
||||
{ "queries", T_OBJECT, offsetof(cxoMessage, queries), READONLY },
|
||||
{ "queueName", T_OBJECT, offsetof(cxoMessage, queueName), READONLY },
|
||||
{ "consumerName", T_OBJECT, offsetof(cxoMessage, consumerName), READONLY },
|
||||
{ "registered", T_BOOL, offsetof(cxoMessage, registered), READONLY },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
static PyMemberDef cxoMessageTableTypeMembers[] = {
|
||||
{ "name", T_OBJECT, offsetof(cxoMessageTable, name), READONLY },
|
||||
{ "rows", T_OBJECT, offsetof(cxoMessageTable, rows), READONLY },
|
||||
{ "operation", T_INT, offsetof(cxoMessageTable, operation), READONLY },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
static PyMemberDef cxoMessageRowTypeMembers[] = {
|
||||
{ "rowid", T_OBJECT, offsetof(cxoMessageRow, rowid), READONLY },
|
||||
{ "operation", T_INT, offsetof(cxoMessageRow, operation), READONLY },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
static PyMemberDef cxoMessageQueryTypeMembers[] = {
|
||||
{ "id", T_INT, offsetof(cxoMessageQuery, id), READONLY },
|
||||
{ "operation", T_INT, offsetof(cxoMessageQuery, operation), READONLY },
|
||||
{ "tables", T_OBJECT, offsetof(cxoMessageQuery, tables), READONLY },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of methods for Python types
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyMethodDef cxoSubscrTypeMethods[] = {
|
||||
{ "registerquery", (PyCFunction) cxoSubscr_registerQuery,
|
||||
METH_VARARGS },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Python type declarations
|
||||
//-----------------------------------------------------------------------------
|
||||
PyTypeObject cxoPyTypeSubscr = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
.tp_name = "cx_Oracle.Subscription",
|
||||
.tp_basicsize = sizeof(cxoSubscr),
|
||||
.tp_dealloc = (destructor) cxoSubscr_free,
|
||||
.tp_repr = (reprfunc) cxoSubscr_repr,
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT,
|
||||
.tp_methods = cxoSubscrTypeMethods,
|
||||
.tp_members = cxoSubscrTypeMembers
|
||||
};
|
||||
|
||||
PyTypeObject cxoPyTypeMessage = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
.tp_name = "cx_Oracle.Message",
|
||||
.tp_basicsize = sizeof(cxoMessage),
|
||||
.tp_dealloc = (destructor) cxoMessage_free,
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT,
|
||||
.tp_members = cxoMessageTypeMembers
|
||||
};
|
||||
|
||||
PyTypeObject cxoPyTypeMessageTable = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
.tp_name = "cx_Oracle.MessageTable",
|
||||
.tp_basicsize = sizeof(cxoMessageTable),
|
||||
.tp_dealloc = (destructor) cxoMessageTable_free,
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT,
|
||||
.tp_members = cxoMessageTableTypeMembers
|
||||
};
|
||||
|
||||
|
||||
PyTypeObject cxoPyTypeMessageRow = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
.tp_name = "cx_Oracle.MessageRow",
|
||||
.tp_basicsize = sizeof(cxoMessageRow),
|
||||
.tp_dealloc = (destructor) cxoMessageRow_free,
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT,
|
||||
.tp_members = cxoMessageRowTypeMembers
|
||||
};
|
||||
|
||||
|
||||
PyTypeObject cxoPyTypeMessageQuery = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
.tp_name = "cx_Oracle.MessageQuery",
|
||||
.tp_basicsize = sizeof(cxoMessageQuery),
|
||||
.tp_dealloc = (destructor) cxoMessageQuery_free,
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT,
|
||||
.tp_members = cxoMessageQueryTypeMembers
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// cxoMessageRow_initialize()
|
||||
// Initialize a new message row with the information from the descriptor.
|
||||
@ -532,3 +404,120 @@ static void cxoMessageTable_free(cxoMessageTable *table)
|
||||
Py_CLEAR(table->rows);
|
||||
Py_TYPE(table)->tp_free((PyObject*) table);
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of members for Python types
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyMemberDef cxoSubscrTypeMembers[] = {
|
||||
{ "callback", T_OBJECT, offsetof(cxoSubscr, callback), READONLY },
|
||||
{ "connection", T_OBJECT, offsetof(cxoSubscr, connection),
|
||||
READONLY },
|
||||
{ "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 },
|
||||
{ "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 },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
static PyMemberDef cxoMessageTypeMembers[] = {
|
||||
{ "subscription", T_OBJECT, offsetof(cxoMessage, subscription),
|
||||
READONLY },
|
||||
{ "type", T_INT, offsetof(cxoMessage, type), READONLY },
|
||||
{ "dbname", T_OBJECT, offsetof(cxoMessage, dbname), READONLY },
|
||||
{ "txid", T_OBJECT, offsetof(cxoMessage, txId), READONLY },
|
||||
{ "tables", T_OBJECT, offsetof(cxoMessage, tables), READONLY },
|
||||
{ "queries", T_OBJECT, offsetof(cxoMessage, queries), READONLY },
|
||||
{ "queueName", T_OBJECT, offsetof(cxoMessage, queueName), READONLY },
|
||||
{ "consumerName", T_OBJECT, offsetof(cxoMessage, consumerName), READONLY },
|
||||
{ "registered", T_BOOL, offsetof(cxoMessage, registered), READONLY },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
static PyMemberDef cxoMessageTableTypeMembers[] = {
|
||||
{ "name", T_OBJECT, offsetof(cxoMessageTable, name), READONLY },
|
||||
{ "rows", T_OBJECT, offsetof(cxoMessageTable, rows), READONLY },
|
||||
{ "operation", T_INT, offsetof(cxoMessageTable, operation), READONLY },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
static PyMemberDef cxoMessageRowTypeMembers[] = {
|
||||
{ "rowid", T_OBJECT, offsetof(cxoMessageRow, rowid), READONLY },
|
||||
{ "operation", T_INT, offsetof(cxoMessageRow, operation), READONLY },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
static PyMemberDef cxoMessageQueryTypeMembers[] = {
|
||||
{ "id", T_INT, offsetof(cxoMessageQuery, id), READONLY },
|
||||
{ "operation", T_INT, offsetof(cxoMessageQuery, operation), READONLY },
|
||||
{ "tables", T_OBJECT, offsetof(cxoMessageQuery, tables), READONLY },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of methods for Python types
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyMethodDef cxoSubscrTypeMethods[] = {
|
||||
{ "registerquery", (PyCFunction) cxoSubscr_registerQuery,
|
||||
METH_VARARGS },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Python type declarations
|
||||
//-----------------------------------------------------------------------------
|
||||
PyTypeObject cxoPyTypeSubscr = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
.tp_name = "cx_Oracle.Subscription",
|
||||
.tp_basicsize = sizeof(cxoSubscr),
|
||||
.tp_dealloc = (destructor) cxoSubscr_free,
|
||||
.tp_repr = (reprfunc) cxoSubscr_repr,
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT,
|
||||
.tp_methods = cxoSubscrTypeMethods,
|
||||
.tp_members = cxoSubscrTypeMembers
|
||||
};
|
||||
|
||||
PyTypeObject cxoPyTypeMessage = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
.tp_name = "cx_Oracle.Message",
|
||||
.tp_basicsize = sizeof(cxoMessage),
|
||||
.tp_dealloc = (destructor) cxoMessage_free,
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT,
|
||||
.tp_members = cxoMessageTypeMembers
|
||||
};
|
||||
|
||||
PyTypeObject cxoPyTypeMessageTable = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
.tp_name = "cx_Oracle.MessageTable",
|
||||
.tp_basicsize = sizeof(cxoMessageTable),
|
||||
.tp_dealloc = (destructor) cxoMessageTable_free,
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT,
|
||||
.tp_members = cxoMessageTableTypeMembers
|
||||
};
|
||||
|
||||
|
||||
PyTypeObject cxoPyTypeMessageRow = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
.tp_name = "cx_Oracle.MessageRow",
|
||||
.tp_basicsize = sizeof(cxoMessageRow),
|
||||
.tp_dealloc = (destructor) cxoMessageRow_free,
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT,
|
||||
.tp_members = cxoMessageRowTypeMembers
|
||||
};
|
||||
|
||||
|
||||
PyTypeObject cxoPyTypeMessageQuery = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
.tp_name = "cx_Oracle.MessageQuery",
|
||||
.tp_basicsize = sizeof(cxoMessageQuery),
|
||||
.tp_dealloc = (destructor) cxoMessageQuery_free,
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT,
|
||||
.tp_members = cxoMessageQueryTypeMembers
|
||||
};
|
||||
|
||||
119
src/cxoVar.c
119
src/cxoVar.c
@ -14,72 +14,6 @@
|
||||
|
||||
#include "cxoModule.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// forward declaration of functions
|
||||
//-----------------------------------------------------------------------------
|
||||
static void cxoVar_free(cxoVar*);
|
||||
static PyObject *cxoVar_repr(cxoVar*);
|
||||
static PyObject *cxoVar_externalCopy(cxoVar*, PyObject*);
|
||||
static PyObject *cxoVar_externalSetValue(cxoVar*, PyObject*);
|
||||
static PyObject *cxoVar_externalGetValue(cxoVar*, PyObject*, PyObject*);
|
||||
static PyObject *cxoVar_externalGetActualElements(cxoVar*, void*);
|
||||
static PyObject *cxoVar_externalGetValues(cxoVar*, void*);
|
||||
static PyObject *cxoVar_getType(cxoVar*, void*);
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of members
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyMemberDef cxoMembers[] = {
|
||||
{ "bufferSize", T_INT, offsetof(cxoVar, bufferSize), READONLY },
|
||||
{ "inconverter", T_OBJECT, offsetof(cxoVar, inConverter), 0 },
|
||||
{ "numElements", T_INT, offsetof(cxoVar, allocatedElements),
|
||||
READONLY },
|
||||
{ "outconverter", T_OBJECT, offsetof(cxoVar, outConverter), 0 },
|
||||
{ "size", T_INT, offsetof(cxoVar, size), READONLY },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of calculated members
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyGetSetDef cxoCalcMembers[] = {
|
||||
{ "actualElements", (getter) cxoVar_externalGetActualElements, 0, 0, 0 },
|
||||
{ "type", (getter) cxoVar_getType, 0, 0, 0 },
|
||||
{ "values", (getter) cxoVar_externalGetValues, 0, 0, 0 },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of methods
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyMethodDef cxoVarMethods[] = {
|
||||
{ "copy", (PyCFunction) cxoVar_externalCopy, METH_VARARGS },
|
||||
{ "setvalue", (PyCFunction) cxoVar_externalSetValue, METH_VARARGS },
|
||||
{ "getvalue", (PyCFunction) cxoVar_externalGetValue,
|
||||
METH_VARARGS | METH_KEYWORDS },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of Python type
|
||||
//-----------------------------------------------------------------------------
|
||||
PyTypeObject cxoPyTypeVar = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
.tp_name = "cx_Oracle.Var",
|
||||
.tp_basicsize = sizeof(cxoVar),
|
||||
.tp_dealloc = (destructor) cxoVar_free,
|
||||
.tp_repr = (reprfunc) cxoVar_repr,
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT,
|
||||
.tp_methods = cxoVarMethods,
|
||||
.tp_members = cxoMembers,
|
||||
.tp_getset = cxoCalcMembers
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// cxoVar_new()
|
||||
// Allocate a new variable.
|
||||
@ -778,3 +712,56 @@ static PyObject *cxoVar_repr(cxoVar *var)
|
||||
Py_DECREF(typeName);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of members
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyMemberDef cxoMembers[] = {
|
||||
{ "bufferSize", T_INT, offsetof(cxoVar, bufferSize), READONLY },
|
||||
{ "inconverter", T_OBJECT, offsetof(cxoVar, inConverter), 0 },
|
||||
{ "numElements", T_INT, offsetof(cxoVar, allocatedElements),
|
||||
READONLY },
|
||||
{ "outconverter", T_OBJECT, offsetof(cxoVar, outConverter), 0 },
|
||||
{ "size", T_INT, offsetof(cxoVar, size), READONLY },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of calculated members
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyGetSetDef cxoCalcMembers[] = {
|
||||
{ "actualElements", (getter) cxoVar_externalGetActualElements, 0, 0, 0 },
|
||||
{ "type", (getter) cxoVar_getType, 0, 0, 0 },
|
||||
{ "values", (getter) cxoVar_externalGetValues, 0, 0, 0 },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of methods
|
||||
//-----------------------------------------------------------------------------
|
||||
static PyMethodDef cxoVarMethods[] = {
|
||||
{ "copy", (PyCFunction) cxoVar_externalCopy, METH_VARARGS },
|
||||
{ "setvalue", (PyCFunction) cxoVar_externalSetValue, METH_VARARGS },
|
||||
{ "getvalue", (PyCFunction) cxoVar_externalGetValue,
|
||||
METH_VARARGS | METH_KEYWORDS },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// declaration of Python type
|
||||
//-----------------------------------------------------------------------------
|
||||
PyTypeObject cxoPyTypeVar = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
.tp_name = "cx_Oracle.Var",
|
||||
.tp_basicsize = sizeof(cxoVar),
|
||||
.tp_dealloc = (destructor) cxoVar_free,
|
||||
.tp_repr = (reprfunc) cxoVar_repr,
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT,
|
||||
.tp_methods = cxoVarMethods,
|
||||
.tp_members = cxoMembers,
|
||||
.tp_getset = cxoCalcMembers
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user