Re: [cx-oracle-users] problem with numbers when sizeof(long) > sizeof(int)
Brought to you by:
atuining
From: Anthony T. <ant...@gm...> - 2006-04-28 14:52:21
|
Apologies for the delay in getting back to you on this. I finally confirmed the problem and your solution. NumberVar_GetValue() also had problems as you suspected and I've fixed them as well. I've also added a test case to the test suite to test for this particular situation. Thank you for notifying me of the problem and providing a solution. On 4/20/06, Uwe Hoffmann <qu...@ti...> wrote: > > 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) !=3D 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 +01= 00 > *************** > *** 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 =3D PyInt_AS_LONG(value); > status =3D OCINumberFromInt(var->environment->errorHandle, > &integerValue, > ! sizeof(long), OCI_NUMBER_SIGNED, &var->data[pos]); > if (var->returnType =3D=3D gc_NumberAsUnknown) > var->returnType =3D gc_NumberAsInteger; > } else if (PyFloat_Check(value)) { > --- 160,166 ---- > if (PyInt_Check(value)) { > integerValue =3D PyInt_AS_LONG(value); > status =3D OCINumberFromInt(var->environment->errorHandle, > &integerValue, > ! sizeof(int), OCI_NUMBER_SIGNED, &var->data[pos]); > if (var->returnType =3D=3D gc_NumberAsUnknown) > var->returnType =3D gc_NumberAsInteger; > } else if (PyFloat_Check(value)) { > > > > ------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job ea= sier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronim= o > http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat= =3D121642 > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > |