[Zope-Checkins] CVS: Products/DCOracle2/src - dco2.c:1.112
Matthew T. Kromer
matt@zope.com
Wed, 5 Jun 2002 16:00:55 -0400
Update of /cvs-repository/Products/DCOracle2/src
In directory cvs.zope.org:/tmp/cvs-serv31663/src
Modified Files:
dco2.c
Log Message:
Add better ROWID support
=== Products/DCOracle2/src/dco2.c 1.111 => 1.112 === (439/539 lines abridged)
OCILobLocator *lobp; /* LOB Locator */
ub2 dty; /* Type of locator */
- ub2 ind; /* Indicator */
+ sb2 ind; /* Indicator */
} LobLocator;
staticforward PyTypeObject LobLocatorType;
@@ -425,6 +425,18 @@
staticforward PyTypeObject OracleDateType;
+/*
+** Row ID Descriptor
+*/
+
+typedef struct {
+ PyObject_HEAD
+ OCIRowid *rowid; /* Row ID */
+ ServerContext *sc; /* Server Context */
+} OracleRowID;
+
+staticforward PyTypeObject OracleRowIDType;
+
/*
** traceRecord
@@ -495,6 +507,7 @@
static PyObject *ServerContext_prepare(ServerContext *self, PyObject *args);
static PyObject *ServerContext_rollback(ServerContext *self, PyObject *args);
static PyObject *ServerContext_describe(ServerContext *self, PyObject *args);
+static PyObject *ServerContext_rowid(ServerContext *self, PyObject *args);
static void Cursor_dealloc(Cursor *self);
static PyObject *Cursor_getattr(Cursor *self, char *name);
static PyObject *Cursor_close(Cursor *self, PyObject *args);
@@ -546,6 +559,11 @@
static PyObject *OracleDate_int(OracleDate *self);
static PyObject *OracleDate_long(OracleDate *self);
static PyObject *OracleDate_float(OracleDate *self);
+static PyObject *OracleRowID_alloc(ServerContext *sc);
+static void OracleRowID_dealloc(OracleRowID *self);
+static int OracleRowID_cmp(OracleRowID *left, OracleRowID *right);
+static PyObject *OracleRowID_str(OracleRowID *self);
+static PyObject *OracleRowID_repr(OracleRowID *self);
static int longFetchInit(LongFetch *lf);
static char *longFetchAlloc(LongFetch *lf, long size);
static void longFetchRelease(LongFetch *lf);
@@ -634,6 +652,9 @@
static char OracleDateType__doc__[] =
"An Oracle 8 Date";
[-=- -=- -=- 439 lines omitted -=- -=- -=-]
** Binding Arrays
**
@@ -5687,7 +6005,7 @@
** handles this? Bleah.
*/
- if (mybind.dty == SQLT_RSET) {
+ if (mybind.dty == SQLT_RSET || mybind.dty == SQLT_RDD) {
if (ba->objectp[i] != NULL) {
Py_DECREF(ba->objectp[i]);
}
@@ -6094,12 +6412,23 @@
*/
CONVERTOUTF(SQLT_RDD) {
- PyObject *obj;
+ OracleRowID *rid;
+ OCIRowid *oldrid;
+ OCIRowid **ocirowidpp = (OCIRowid **) data;
TRACE(T_ENTRY,("s","CONVERTOUT(SQLT_RDD)"));
- obj = PyString_FromStringAndSize((char *) data, len);
- TRACE(T_EXIT,("sA", "CONVERTOUT(SQLT_RDD)", obj));
- return obj;
+
+ rid = (OracleRowID *) OracleRowID_alloc(sc);
+
+ /* copy the rowid POINTERs from the new and old */
+
+ oldrid = rid->rowid;
+ rid->rowid = *ocirowidpp;
+ *ocirowidpp = oldrid;
+
+ TRACE(T_EXIT,("sA","CONVERTOUT(SQLT_RDD)", rid));
+
+ return OBJECT(rid);
}
/*
@@ -6879,6 +7208,10 @@
OracleDateType.ob_type = &PyType_Type;
PyDict_SetItemString(dict, "OracleDateType",
OBJECT(&OracleDateType));
+
+ OracleRowIDType.ob_type = &PyType_Type;
+ PyDict_SetItemString(dict, "OracleRowIDType",
+ OBJECT(&OracleRowIDType));
BindingArrayObjectType.ob_type = &PyType_Type;
PyDict_SetItemString(dict, "BindingArrayObjectType",