[Zope-Checkins] CVS: Products/DCOracle2/src - dco2.c:1.105
Matthew T. Kromer
matt@zope.com
Mon, 25 Feb 2002 11:21:37 -0500
Update of /cvs-repository/Products/DCOracle2/src
In directory cvs.zope.org:/tmp/cvs-serv2436/src
Modified Files:
dco2.c
Log Message:
merges from object test branch
=== Products/DCOracle2/src/dco2.c 1.104 => 1.105 ===
#endif
+/* Turn on object mode by default (largely unused) */
+
+#if (defined(ORACLE8i) && !defined(NOOBJECT))
+#define USEOBJECT
+#endif
+
/* Get around unused warnings with GCC -Wall by using this on a def for
** intentionally unused items. Currently "ID" and "Traceprint" are
** meant to be unused; Traceprint is for debugging.
@@ -226,7 +232,6 @@
ub2 rcode; /* Result code */
int flags; /* Binding flags */
int pieces; /* # of pieces */
- int piecect; /* Piece count */
union {
int i; /* in place storage */
unsigned int ui;
@@ -1052,6 +1057,12 @@
TYPEENTRY(SQLT_INTERVAL_YM), /* Interval year - month*/
TYPEENTRY(SQLT_INTERVAL_DS), /* Interval day - second*/
#endif
+#define PLSQL_RECORD 250
+#define PLSQL_TABLE 251
+#define PLSQL_BOOLEAN 252
+ TYPEENTRY(PLSQL_RECORD), /* PL/SQL record */
+ TYPEENTRY(PLSQL_TABLE), /* PL/SQL table */
+ TYPEENTRY(PLSQL_BOOLEAN), /* PL/SQL boolean */
{0, NULL, 0, 0, NULL}
};
@@ -1296,8 +1307,11 @@
#ifdef ORACLE8i
TRACE(T_HCALL,("sA", "OCIEnvCreate", &sc->envhp));
- status = OCIEnvCreate(&sc->envhp, OCI_THREADED, NULL, NULL, NULL, NULL,
- 0, NULL);
+ status = OCIEnvCreate(&sc->envhp, OCI_THREADED
+#ifdef USEOBJECT
+ |OCI_OBJECT
+#endif
+ , NULL, NULL, NULL, NULL, 0, NULL);
TRACE(T_HRETURN,("sRA", "OCIEnvCreate", status, sc->envhp));
if (status != OCI_SUCCESS) {
fprintf(stderr, "OCIEnvCreate failed: %s:%d",
@@ -1308,7 +1322,11 @@
}
#else
TRACE(T_HCALL,("s", "OCIInitialize"));
- status = OCIInitialize(OCI_THREADED, NULL, NULL, NULL, NULL);
+ status = OCIInitialize(OCI_THREADED
+#ifdef USEOBJECT
+ |OCI_OBJECT
+#endif
+ , NULL, NULL, NULL, NULL);
TRACE(T_HRETURN,("sR", "OCIInitialize", status));
if (status != OCI_SUCCESS) {
@@ -2363,7 +2381,6 @@
bind->object = object;
bind->flags = 0;
bind->pieces = 0;
- bind->piecect = 0;
bind->u.i = 0;
bind->alen = 0;
bind->rcode = 0;
@@ -2682,6 +2699,13 @@
}
+ while (ba->entries < index) {
+ ba = BindingArray_realloc(ba, ba->entries + 10);
+ if (ba == NULL) return OCI_ERROR;
+ }
+
+ if (ba->count < index) ba->count = index;
+
/* bufpp is the output buffer, with the following rules:
** for a locator, it's the value of the locator, not the locator
** address. For a reference, it's the address of the reference.
@@ -2702,20 +2726,21 @@
/* This handles the simple case (no locators or REFs) */
*bufpp = (dvoid *) ((char *) ba->valuep +
- (binding->piecect * binding->valuesz));
+ (index * binding->valuesz));
/* OK, now, tell Oracle where it can set the length */
- *alenpp = (ub4 *) &ba->alenp[binding->piecect];
+ *alenpp = (ub4 *) &ba->alenp[index];
/* Set the size */
- ba->alenp[binding->piecect] = binding->valuesz;
+ ba->alenp[index] = binding->valuesz;
/* and where it can save the indicator value */
- *indpp = &ba->indp[binding->piecect];
+ *indpp = &ba->indp[index];
/* and the result code */
- *rcodepp = &ba->rcodep[binding->piecect];
+ *rcodepp = &ba->rcodep[index];
- TRACE(T_EXIT,("s","dynamicBindOut"));
+ TRACE(T_EXIT,("sAAdAA","dynamicBindOut", *bufpp, *alenpp,
+ binding->valuesz, *indpp, *rcodepp));
return OCI_CONTINUE;
}
@@ -2903,7 +2928,6 @@
} else if (self->bind[pos].valuesz > 32767) { /* Whoops ! too big */
- self->bind[pos].piecect = 0;
self->bind[pos].pieces = (self->bind[pos].valuesz +32766)
/ 32767;
@@ -4322,19 +4346,20 @@
return RaiseOCIError(sc->envhp, OCI_HTYPE_ENV);
}
- /* Allocate the per-locator error handle */
- TRACE(T_HCALL,("sAs","OCIHandleAlloc",&lob->errhp,
- "OCI_HTYPE_ERROR"));
- status = OCIHandleAlloc(sc->envhp, (dvoid **)&lob->errhp,
- OCI_HTYPE_ERROR, 0, NULL);
- TRACE(T_RETURN,("sRA","OCIHandleAlloc",status,lob->errhp));
+ }
- if (status != OCI_SUCCESS) {
- lob->errhp = NULL;
- RaiseOCIError(sc->envhp, OCI_HTYPE_ENV);
- Py_DECREF(lob);
- return NULL;
- }
+ /* Allocate the per-locator error handle */
+ TRACE(T_HCALL,("sAs","OCIHandleAlloc",&lob->errhp,
+ "OCI_HTYPE_ERROR"));
+ status = OCIHandleAlloc(sc->envhp, (dvoid **)&lob->errhp,
+ OCI_HTYPE_ERROR, 0, NULL);
+ TRACE(T_RETURN,("sRA","OCIHandleAlloc",status,lob->errhp));
+
+ if (status != OCI_SUCCESS) {
+ lob->errhp = NULL;
+ RaiseOCIError(sc->envhp, OCI_HTYPE_ENV);
+ Py_DECREF(lob);
+ return NULL;
}
TRACE(T_EXIT,("sA", "_LobLocator_alloc", lob));
@@ -6858,6 +6883,9 @@
#endif
#ifdef ORACLE9i
"-DORACLE9i "
+#endif
+#ifdef USEOBJECT
+ "-DUSEOBJECT "
#endif
#ifdef linux
"-Dlinux "