[Zope-Checkins] CVS: Products/DCOracle2/src - dco2.c:1.132
Matthew T. Kromer
matt@zope.com
Tue, 6 May 2003 12:08:17 -0400
Update of /cvs-repository/Products/DCOracle2/src
In directory cvs.zope.org:/tmp/cvs-serv27192/src
Modified Files:
dco2.c
Log Message:
2 fixes, one to try to mitigate a time conversion bug on Windows which can
crash dco2, and another which partially annuls a submitted patch (someone
who submitted a patch which only applied to Oracle 8.0 -- the logic seems
to be valid for all Oracle 8+)
=== Products/DCOracle2/src/dco2.c 1.131 => 1.132 ===
--- Products/DCOracle2/src/dco2.c:1.131 Fri Mar 14 10:08:11 2003
+++ Products/DCOracle2/src/dco2.c Tue May 6 12:08:16 2003
@@ -466,9 +466,7 @@
sb2 *indp; /* Indicator array */
ub2 *rlenp; /* Length array */
ub2 *rcodep; /* Column result codes */
-#ifndef ORACLE8i
- ub2 fetchResultCode;
-#endif
+ ub2 fetchResultCode; /* Fetch result */
} ResultSet;
staticforward PyTypeObject ResultSetType;
@@ -3864,9 +3862,8 @@
valuep = rs->valuep;
width = rs->width;
-#ifndef ORACLE8i
rs->fetchResultCode = OCI_SUCCESS;
-#endif
+
if (self->flags & LONG_COLUMN && (char) i == self->longcol) {
mode = OCI_DYNAMIC_FETCH;
longFetchInit((LongFetch *) rs->valuep);
@@ -4019,14 +4016,17 @@
Py_END_ALLOW_THREADS
TRACE(T_RETURN,("sR", "OCIStmtFetch", status));
-#ifndef ORACLE8i
+
+ /*
+ ** Copy the fetch status into each result
+ */
if (status == OCI_SUCCESS_WITH_INFO) {
- for (i = 0; i < PyList_Size(self->results); i++) {
- rs = (ResultSet *) PyList_GetItem(self->results, i);
- rs->fetchResultCode=status;
- }
+ for (i = 0; i < PyList_Size(self->results); i++) {
+ rs = (ResultSet *) PyList_GetItem(self->results, i);
+ rs->fetchResultCode=status;
+ }
}
-#endif
+
if (status != OCI_SUCCESS && status != OCI_SUCCESS_WITH_INFO) {
text buff[OCI_ERROR_MAXMSG_SIZE];
sb4 errcode;
@@ -4317,6 +4317,7 @@
self->dty = (ub2) type;
self->cdty = (ub2) ctype;
self->column = column;
+ self->fetchResultCode = OCI_SUCCESS;
volume = self->width * count; /* Base volume */
if (volume % PADSIZE != 0) volume += PADSIZE - (volume % PADSIZE);
@@ -4794,12 +4795,12 @@
indp = self->rs->indp;
indp += self->item;
- //check if fetch call return status was OCI_SUCCESS_WITH_INFO
- if (*indp == -1
-#ifndef ORACLE8i
- && self->rs->fetchResultCode==OCI_SUCCESS_WITH_INFO
-#endif
- ) {
+ /* If the indicator is -1 (NULL) and the fetch result is
+ * OCI_SUCCESS or OCI_SUCCESS_WITH_INFO, return None
+ */
+ if (*indp == -1 &&
+ (self->rs->fetchResultCode==OCI_SUCCESS_WITH_INFO ||
+ self->rs->fetchResultCode==OCI_SUCCESS)) {
Py_INCREF(Py_None);
TRACE(T_EXIT,("sAs", "ResultSetItem_value", Py_None,
"NULL"));
@@ -7405,11 +7406,15 @@
dateobject->tm.tm_zone = 0;
#endif
- dateobject->ticks = (long) mktime(&(dateobject->tm));
-
- tmbuff = (struct tm *) gmtime((const time_t *) &dateobject->ticks);
-
- bias = (time_t) mktime(tmbuff) - dateobject->ticks;
+ if (t < 1970 || t > 2037) {
+ dateobject->ticks = -1;
+ bias = 0;
+ } else {
+ dateobject->ticks = (long) mktime(&(dateobject->tm));
+ tmbuff = (struct tm *) gmtime((const time_t *)
+ &dateobject->ticks);
+ bias = (time_t) mktime(tmbuff) - dateobject->ticks;
+ }
if (dateobject->ticks == -1 && t == 0)
dateobject->ticks = second + minute * 60 + hour * 3600;