[Zope] ZSQL Method's Precision
maciej.wisniowski at coig.katowice.pl
Tue Oct 24 02:47:56 EDT 2006
> In a PostgreSQL DB I have a Numeric data type with a precision of two
> decimal places. If I have 1.33 in as the result from my query, it's
> everything is good. However, if I have 1.30 it reduces the precision
> to one decimal place and I get 1.3. Not so good when dealing with
> currency ( I don't want to use the money data dype ).
> Any ideas on how I can get my ZSQL method to keep two decimal places?
As others said it's a matter of displaying. You say that you don't want
to use money datatype but keep in mind that postgre adapter
is able to use Python's Decimal datatype for money values (in python2.3
you need additional module decimal.py from Python 2.4 to enable it)
which may give you necessary precision for financial operations and is
able to store really big numbers.
More information about the Zope