[Zope-DB] Floating point errors

M.-A. Lemburg mal at egenix.com
Sun Feb 3 06:37:10 EST 2008

On 2008-01-23 14:35, siribu wrote:
> Hi,
> I have got a problem:
> accessing an Oracle 10g database, whenever I ask for floats from a Zope Z SQL 
> method, they are automatically converted to integers, simply dropping the 
> decimal numbers.
> I am using Zope 2.10.4-final with Python 2.4.4 running on a Linux2 OS. 
> Furthermore, I am using UnixODBC with Easysoftâ€^(TM)s ODBC-Oracle driver together 
> with eGenix *mxODBC Zope DA*.

There's a connection option " Leave scale 0 floats untouched ?" to switch
this off.

The truncation to integers is done because some database drivers always
return numbers as floats - even integers. Zope would then display these
as floats (without additional formatting), which may not look right to
the user.

> Running iSQL on the server or even utilizing the mxODBC Zope DA driver directly 
> in Python works well without problems.  
> The error logs for the ODBC contained no sign or errors. Neither did I get any 
> response when I ran Event Log Manager in Zope. I could not find anything in syslog.
> Any clues on how to solve this?

See above: just switch on the option in the connection properties.

Marc-Andre Lemburg

Professional Python Services directly from the Source  (#1, Feb 03 2008)
>>> Python/Zope Consulting and Support ...        http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/

:::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! ::::

   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611

More information about the Zope-DB mailing list