[cx-oracle-users] problem with numbers when sizeof(long) > sizeof(int)
Brought to you by:
atuining
From: Uwe H. <qu...@ti...> - 2006-04-20 10:29:06
|
Hi , i think that there is a serious problem within cx_Oracle when dealing with large numbers (not python longs) for example 6088343244 on platforms where sizeof(long) != sizeof(int) The attached fix solves the problem for me (Solaris) but maybe there are other similar problems (NumberVar_GetValue) regards Uwe *** cx_Oracle-4.1.2/NumberVar.c 2006-04-20 12:17:28.000000000 +0200 --- cx_Oracle-4.1.2_org/NumberVar.c 2004-11-18 16:55:56.000000000 +0100 *************** *** 146,152 **** { PyObject *textValue; double doubleValue; ! long integerValue; sword status; // make sure a number is being bound --- 146,152 ---- { PyObject *textValue; double doubleValue; ! int integerValue; sword status; // make sure a number is being bound *************** *** 160,166 **** if (PyInt_Check(value)) { integerValue = PyInt_AS_LONG(value); status = OCINumberFromInt(var->environment->errorHandle, &integerValue, ! sizeof(long), OCI_NUMBER_SIGNED, &var->data[pos]); if (var->returnType == gc_NumberAsUnknown) var->returnType = gc_NumberAsInteger; } else if (PyFloat_Check(value)) { --- 160,166 ---- if (PyInt_Check(value)) { integerValue = PyInt_AS_LONG(value); status = OCINumberFromInt(var->environment->errorHandle, &integerValue, ! sizeof(int), OCI_NUMBER_SIGNED, &var->data[pos]); if (var->returnType == gc_NumberAsUnknown) var->returnType = gc_NumberAsInteger; } else if (PyFloat_Check(value)) { |