Hi Again, Sorry I have just realised that the bug occurs after the sql execution so trunc(2.34) may return 2 but it will come back as 2.0 via DCOracle2. Anyone found a fix for this other than explicit type formatting via dtml / external python throughout a site? Cheers, Ed __________________________________________________________________ Ed Crewe ( Web Developer - ID Group ) ed.crewe@bris.ac.uk Institute for Learning and Research Technology ILRT University of Bristol Information Services +44 117 9287083 8-10 Berkeley Square, Bristol, BS8 1HH http://www.ilrt.bris.ac.uk On Tue, 4 Mar 2003, Ed Crewe wrote:
Hi Chris,
Thanks for the response. Appologies this is my mistake. It is not a Zope version issue, it is a DCOracle issue.
I have a site that is a front end to an Oracle database so nearly all data is passed via the DCOracle interface. I have just realised that DCOracle2 passes all integers as single decimal place floating points whilst DCOracle1 didn't have this bug.
Thus select count(*) from an empty table returns 0.0!
Similarily all the primary keys that are passed around between pages have .0 appended.
I have realised the solution is to wrap every integer field in TRUNC() in all the sql methods to avoid this bug.
Thus select trunc(count(*)) from table works OK.
Cheers, Ed
__________________________________________________________________ Ed Crewe ( Web Developer - ID Group ) ed.crewe@bris.ac.uk Institute for Learning and Research Technology ILRT University of Bristol Information Services +44 117 9287083 8-10 Berkeley Square, Bristol, BS8 1HH http://www.ilrt.bris.ac.uk
On Tue, 4 Mar 2003, Chris Beaven wrote:
I just tried a DTML in 2.6.1 and it looked like everything was working as it should:
<dtml-var link_id missing="0"> <dtml-call "REQUEST.set('link_id', 3)"> <dtml-var link_id missing="0"> <dtml-call "REQUEST.set('link_id', 3.0)"> <dtml-var link_id missing="0">
Returned:
0 3 3.0
Ed Crewe wrote:
Hi,
Rather than do uneccesary work can I just enquire about whether recent numeric handling changes in Zope 2.6.1 are intentional or might they be reversed?
Zope 2.6.1 has changed the default dtml number display format from integer to one decimal place floating point. This breaks any sites that use dtml integer display.
Was this a deliberate change? If so what is the recommended solution for replacing dtml such as <dtml-var link_id missing="0"> Should all dtml integer rendering be replaced with
<dtml-if "_.has_key('link_id')"><dtml-var link_id fmt="%i"><dtml-else>0</dtml-if>
or is there an economical way of displaying an integer in dtml?
Thanks, Ed Crewe
__________________________________________________________________ Ed Crewe ( Web Developer - ID Group ) ed.crewe@bris.ac.uk Institute for Learning and Research Technology ILRT University of Bristol Information Services +44 117 9287083 8-10 Berkeley Square, Bristol, BS8 1HH http://www.ilrt.bris.ac.uk
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )